diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs index 700d51927c59a..7dd6f4b838252 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs @@ -649,6 +649,14 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { if let ty::Param(param_ty) = ret_kind && param_ty.name == kw::SelfUpper { + // We expect the return type of an fn call is expected to be + // `Sized`. In the test `trait-missing-dyn-in-qualified-path.rs` + // under edition 2018, when writing `::default()`, we will + // check both `dyn Default` and `::default()` for + // being `Sized`, but in every case where an associated function + // like `Default::default` which returns `Self`, if the returned + // value is `!Sized`, so will be the `Self`, so we'd always have + // two redundat errors. return err.delay_as_bug(); } }