Rollup merge of #114828 - compiler-errors:next-solver-probe-upcasting, r=lcnr
Probe when assembling upcast candidates so they don't step on eachother's toes in new solver Lack of a probe causes one candidate to disqualify the other due to inference side-effects. r? lcnr
This commit is contained in:
commit
47bdda2b45
4 changed files with 27 additions and 13 deletions
|
@ -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 }));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue