@@ -4,7 +4,7 @@ use rustc_ast::Mutability;
4
4
use rustc_macros:: HashStable ;
5
5
6
6
use crate :: mir:: interpret:: { AllocId , Allocation , CTFE_ALLOC_SALT , Pointer , Scalar , alloc_range} ;
7
- use crate :: ty:: { self , Instance , PolyTraitRef , Ty , TyCtxt } ;
7
+ use crate :: ty:: { self , Instance , TraitRef , Ty , TyCtxt } ;
8
8
9
9
#[ derive( Clone , Copy , PartialEq , HashStable ) ]
10
10
pub enum VtblEntry < ' tcx > {
@@ -19,7 +19,7 @@ pub enum VtblEntry<'tcx> {
19
19
/// dispatchable associated function
20
20
Method ( Instance < ' tcx > ) ,
21
21
/// pointer to a separate supertrait vtable, can be used by trait upcasting coercion
22
- TraitVPtr ( PolyTraitRef < ' tcx > ) ,
22
+ TraitVPtr ( TraitRef < ' tcx > ) ,
23
23
}
24
24
25
25
impl < ' tcx > fmt:: Debug for VtblEntry < ' tcx > {
@@ -56,15 +56,15 @@ pub const COMMON_VTABLE_ENTRIES_ALIGN: usize = 2;
56
56
// function is an accurate approximation. We verify this when actually computing the vtable below.
57
57
pub ( crate ) fn vtable_min_entries < ' tcx > (
58
58
tcx : TyCtxt < ' tcx > ,
59
- trait_ref : Option < ty:: PolyExistentialTraitRef < ' tcx > > ,
59
+ trait_ref : Option < ty:: ExistentialTraitRef < ' tcx > > ,
60
60
) -> usize {
61
61
let mut count = TyCtxt :: COMMON_VTABLE_ENTRIES . len ( ) ;
62
62
let Some ( trait_ref) = trait_ref else {
63
63
return count;
64
64
} ;
65
65
66
66
// This includes self in supertraits.
67
- for def_id in tcx. supertrait_def_ids ( trait_ref. def_id ( ) ) {
67
+ for def_id in tcx. supertrait_def_ids ( trait_ref. def_id ) {
68
68
count += tcx. own_existential_vtable_entries ( def_id) . len ( ) ;
69
69
}
70
70
@@ -80,7 +80,7 @@ pub(crate) fn vtable_min_entries<'tcx>(
80
80
/// initial contents.)
81
81
pub ( super ) fn vtable_allocation_provider < ' tcx > (
82
82
tcx : TyCtxt < ' tcx > ,
83
- key : ( Ty < ' tcx > , Option < ty:: PolyExistentialTraitRef < ' tcx > > ) ,
83
+ key : ( Ty < ' tcx > , Option < ty:: ExistentialTraitRef < ' tcx > > ) ,
84
84
) -> AllocId {
85
85
let ( ty, poly_trait_ref) = key;
86
86
@@ -115,7 +115,7 @@ pub(super) fn vtable_allocation_provider<'tcx>(
115
115
116
116
for ( idx, entry) in vtable_entries. iter ( ) . enumerate ( ) {
117
117
let idx: u64 = u64:: try_from ( idx) . unwrap ( ) ;
118
- let scalar = match entry {
118
+ let scalar = match * entry {
119
119
VtblEntry :: MetadataDropInPlace => {
120
120
if ty. needs_drop ( tcx, ty:: TypingEnv :: fully_monomorphized ( ) ) {
121
121
let instance = ty:: Instance :: resolve_drop_in_place ( tcx, ty) ;
@@ -131,13 +131,12 @@ pub(super) fn vtable_allocation_provider<'tcx>(
131
131
VtblEntry :: Vacant => continue ,
132
132
VtblEntry :: Method ( instance) => {
133
133
// Prepare the fn ptr we write into the vtable.
134
- let fn_alloc_id = tcx. reserve_and_set_fn_alloc ( * instance, CTFE_ALLOC_SALT ) ;
134
+ let fn_alloc_id = tcx. reserve_and_set_fn_alloc ( instance, CTFE_ALLOC_SALT ) ;
135
135
let fn_ptr = Pointer :: from ( fn_alloc_id) ;
136
136
Scalar :: from_pointer ( fn_ptr, & tcx)
137
137
}
138
138
VtblEntry :: TraitVPtr ( trait_ref) => {
139
- let super_trait_ref = trait_ref
140
- . map_bound ( |trait_ref| ty:: ExistentialTraitRef :: erase_self_ty ( tcx, trait_ref) ) ;
139
+ let super_trait_ref = ty:: ExistentialTraitRef :: erase_self_ty ( tcx, trait_ref) ;
141
140
let supertrait_alloc_id = tcx. vtable_allocation ( ( ty, Some ( super_trait_ref) ) ) ;
142
141
let vptr = Pointer :: from ( supertrait_alloc_id) ;
143
142
Scalar :: from_pointer ( vptr, & tcx)
0 commit comments