Auto merge of #103861 - compiler-errors:codegen-select-in-vtable-slot, r=nagisa
Use `codegen_select` in `vtable_trait_upcasting_coercion_new_vptr_slot` A super tiny clean up
This commit is contained in:
commit
1e1e5b8d98
1 changed files with 6 additions and 18 deletions
|
@ -900,26 +900,14 @@ pub fn vtable_trait_upcasting_coercion_new_vptr_slot<'tcx>(
|
||||||
def_id: unsize_trait_did,
|
def_id: unsize_trait_did,
|
||||||
substs: tcx.mk_substs_trait(source, &[target.into()]),
|
substs: tcx.mk_substs_trait(source, &[target.into()]),
|
||||||
};
|
};
|
||||||
let obligation = Obligation::new(
|
|
||||||
ObligationCause::dummy(),
|
|
||||||
ty::ParamEnv::reveal_all(),
|
|
||||||
ty::Binder::dummy(ty::TraitPredicate {
|
|
||||||
trait_ref,
|
|
||||||
constness: ty::BoundConstness::NotConst,
|
|
||||||
polarity: ty::ImplPolarity::Positive,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
let infcx = tcx.infer_ctxt().build();
|
|
||||||
let mut selcx = SelectionContext::new(&infcx);
|
|
||||||
let implsrc = selcx.select(&obligation).unwrap();
|
|
||||||
|
|
||||||
let Some(ImplSource::TraitUpcasting(implsrc_traitcasting)) = implsrc else {
|
|
||||||
bug!();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
match tcx.codegen_select_candidate((ty::ParamEnv::reveal_all(), ty::Binder::dummy(trait_ref))) {
|
||||||
|
Ok(ImplSource::TraitUpcasting(implsrc_traitcasting)) => {
|
||||||
implsrc_traitcasting.vtable_vptr_slot
|
implsrc_traitcasting.vtable_vptr_slot
|
||||||
}
|
}
|
||||||
|
otherwise => bug!("expected TraitUpcasting candidate, got {otherwise:?}"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn provide(providers: &mut ty::query::Providers) {
|
pub fn provide(providers: &mut ty::query::Providers) {
|
||||||
object_safety::provide(providers);
|
object_safety::provide(providers);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue