Skip to content

Commit 7134a2b

Browse files
committed
review comment: unnecessary check for object safety on sized trait
1 parent c78e9f9 commit 7134a2b

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
@@ -639,20 +639,17 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
639639
err.span_label(span, explanation);
640640
}
641641

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

0 commit comments

Comments
 (0)