1
Fork 0

Add rustc_do_not_implement_via_object

This commit is contained in:
Michael Goulet 2023-06-02 05:54:52 +00:00
parent 5683791ebb
commit 657d3f43a9
11 changed files with 47 additions and 3 deletions

View file

@ -631,6 +631,11 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
goal: Goal<'tcx, G>,
candidates: &mut Vec<Candidate<'tcx>>,
) {
let tcx = self.tcx();
if !tcx.trait_def(goal.predicate.trait_def_id(tcx)).implement_via_object {
return;
}
let self_ty = goal.predicate.self_ty();
let bounds = match *self_ty.kind() {
ty::Bool
@ -663,7 +668,6 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
ty::Dynamic(bounds, ..) => bounds,
};
let tcx = self.tcx();
let own_bounds: FxIndexSet<_> =
bounds.iter().map(|bound| bound.with_self_ty(tcx, self_ty)).collect();
for assumption in elaborate(tcx, own_bounds.iter().copied())