Skip to content

Commit e6d9050

Browse files
committed
review comment: unnecessary check for object safety on sized trait
1 parent dd7b36f commit e6d9050

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

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

+11-14
Original file line numberDiff line numberDiff line change
@@ -638,20 +638,17 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
638638
err.span_label(span, explanation);
639639
}
640640

641-
if Some(trait_ref.def_id()) == self.tcx.lang_items().sized_trait() {
642-
if !self.tcx.object_safety_violations(trait_ref.def_id()).is_empty() {
643-
if let ObligationCauseCode::SizedCallReturnType(did)
644-
= obligation.cause.code()
645-
{
646-
let fn_sig = self.tcx.fn_sig(did);
647-
let ret_kind =
648-
fn_sig.skip_binder().output().skip_binder().kind();
649-
if let ty::Param(param_ty) = ret_kind
650-
&& param_ty.name == kw::SelfUpper
651-
{
652-
return err.delay_as_bug();
653-
}
654-
}
641+
if Some(trait_ref.def_id()) == self.tcx.lang_items().sized_trait()
642+
&& let ObligationCauseCode::SizedCallReturnType(did)
643+
= obligation.cause.code()
644+
{
645+
let fn_sig = self.tcx.fn_sig(did);
646+
let ret_kind =
647+
fn_sig.skip_binder().output().skip_binder().kind();
648+
if let ty::Param(param_ty) = ret_kind
649+
&& param_ty.name == kw::SelfUpper
650+
{
651+
return err.delay_as_bug();
655652
}
656653
}
657654

0 commit comments

Comments
 (0)