Auto merge of #126505 - compiler-errors:no-vtable, r=lcnr
Only compute vtable information during codegen This PR removes vtable information from the `Object` and `TraitUpcasting` candidate sources in the trait solvers, and defers the computation of relevant information to `Instance::resolve`. This is because vtables really aren't a thing in the trait world -- they're an implementation detail in codegen. Previously it was just easiest to tangle this information together since we were already doing the work of looking at all the supertraits in the trait solver, and specifically because we use traits to represent when it's possible to call a method via a vtable (`Object` candidate) and do upcasting (`Unsize` candidate). but I am somewhat suspicious we're doing a *lot* of extra work, especially in polymorphic contexts, so let's see what perf says.
This commit is contained in:
commit
5639c21fb3
14 changed files with 141 additions and 195 deletions
|
@ -39,8 +39,7 @@ pub(crate) fn unsized_info<'tcx>(
|
|||
}
|
||||
|
||||
// trait upcasting coercion
|
||||
let vptr_entry_idx =
|
||||
fx.tcx.vtable_trait_upcasting_coercion_new_vptr_slot((source, target));
|
||||
let vptr_entry_idx = fx.tcx.supertrait_vtable_slot((source, target));
|
||||
|
||||
if let Some(entry_idx) = vptr_entry_idx {
|
||||
let entry_idx = u32::try_from(entry_idx).unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue