Skip to content

Commit

Permalink
Unrolled build for rust-lang#118686
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#118686 - compiler-errors:object-safety, r=lcnr

Only check principal trait ref for object safety

It should make things a bit faster, in case we end up registering a bunch of object safety preds.

r? ```@ghost```
  • Loading branch information
rust-timer committed Dec 8, 2023
2 parents 503e129 + 5d3a294 commit 07f9736
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions compiler/rustc_trait_selection/src/traits/wf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,18 +761,15 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
let defer_to_coercion = self.tcx().features().object_safe_for_dispatch;

if !defer_to_coercion {
let cause = self.cause(traits::WellFormed(None));
let component_traits = data.auto_traits().chain(data.principal_def_id());
let tcx = self.tcx();
self.out.extend(component_traits.map(|did| {
traits::Obligation::with_depth(
tcx,
cause.clone(),
if let Some(principal) = data.principal_def_id() {
self.out.push(traits::Obligation::with_depth(
self.tcx(),
self.cause(traits::WellFormed(None)),
depth,
param_env,
ty::Binder::dummy(ty::PredicateKind::ObjectSafe(did)),
)
}));
ty::Binder::dummy(ty::PredicateKind::ObjectSafe(principal)),
));
}
}
}

Expand Down

0 comments on commit 07f9736

Please sign in to comment.