diff options
| author | Michael Goulet <michael@errs.io> | 2023-08-15 00:48:09 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-08-15 01:02:13 +0000 |
| commit | ab126c2a4e6b6835073949da4ab913d85989db09 (patch) | |
| tree | b60fc1b720cb4168d1e3d8bd0608305ecb06f063 /compiler/rustc_trait_selection/src | |
| parent | 1b198b3a196442e14fb06978166ab46a4618d131 (diff) | |
Probe when assembling upcast candidates so they don't step on eachother's toes
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/solve/trait_goals.rs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/trait_goals.rs b/compiler/rustc_trait_selection/src/solve/trait_goals.rs index ee6f1686b82..8bab20e1942 100644 --- a/compiler/rustc_trait_selection/src/solve/trait_goals.rs +++ b/compiler/rustc_trait_selection/src/solve/trait_goals.rs @@ -552,16 +552,18 @@ impl<'tcx> EvalCtxt<'_, 'tcx> { self.walk_vtable( a_principal.with_self_ty(tcx, a_ty), |ecx, new_a_principal, _, vtable_vptr_slot| { - if let Ok(resp) = ecx.consider_builtin_upcast_to_principal( - goal, - a_data, - a_region, - b_data, - b_region, - Some(new_a_principal.map_bound(|trait_ref| { - ty::ExistentialTraitRef::erase_self_ty(tcx, trait_ref) - })), - ) { + if let Ok(resp) = ecx.probe_candidate("dyn upcast").enter(|ecx| { + ecx.consider_builtin_upcast_to_principal( + goal, + a_data, + a_region, + b_data, + b_region, + Some(new_a_principal.map_bound(|trait_ref| { + ty::ExistentialTraitRef::erase_self_ty(tcx, trait_ref) + })), + ) + }) { responses .push((resp, BuiltinImplSource::TraitUpcasting { vtable_vptr_slot })); } |
