Skip to content

Commit 5f22c02

Browse files
committed
Add explanatory comment
1 parent e6d9050 commit 5f22c02

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

0 commit comments

Comments
 (0)