Skip to content

Commit 5d8b31a

Browse files
committed
Add explanatory comment
1 parent 7134a2b commit 5d8b31a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs

+8
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,14 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
649649
if let ty::Param(param_ty) = ret_kind
650650
&& param_ty.name == kw::SelfUpper
651651
{
652+
// We expect the return type of an fn call is expected to be
653+
// `Sized`. In the test `trait-missing-dyn-in-qualified-path.rs`
654+
// under edition 2018, when writing `<Default>::default()`, we will
655+
// check both `dyn Default` and `<dyn Default>::default()` for
656+
// being `Sized`, but in every case where an associated function
657+
// like `Default::default` which returns `Self`, if the returned
658+
// value is `!Sized`, so will be the `Self`, so we'd always have
659+
// two redundat errors.
652660
return err.delay_as_bug();
653661
}
654662
}

0 commit comments

Comments
 (0)