@@ -6,7 +6,7 @@ use cranelift_module::*;
6
6
use rustc_data_structures:: fx:: FxHashSet ;
7
7
use rustc_middle:: middle:: codegen_fn_attrs:: CodegenFnAttrFlags ;
8
8
use rustc_middle:: mir:: interpret:: { AllocId , GlobalAlloc , Scalar , read_target_uint} ;
9
- use rustc_middle:: ty:: { Binder , ExistentialTraitRef , ScalarInt } ;
9
+ use rustc_middle:: ty:: { ExistentialTraitRef , ScalarInt } ;
10
10
11
11
use crate :: prelude:: * ;
12
12
@@ -167,7 +167,9 @@ pub(crate) fn codegen_const_value<'tcx>(
167
167
& mut fx. constants_cx ,
168
168
fx. module ,
169
169
ty,
170
- dyn_ty. principal ( ) ,
170
+ dyn_ty. principal ( ) . map ( |principal| {
171
+ fx. tcx . instantiate_bound_regions_with_erased ( principal)
172
+ } ) ,
171
173
) ;
172
174
let local_data_id =
173
175
fx. module . declare_data_in_func ( data_id, & mut fx. bcx . func ) ;
@@ -243,12 +245,9 @@ pub(crate) fn data_id_for_vtable<'tcx>(
243
245
cx : & mut ConstantCx ,
244
246
module : & mut dyn Module ,
245
247
ty : Ty < ' tcx > ,
246
- trait_ref : Option < Binder < ' tcx , ExistentialTraitRef < ' tcx > > > ,
248
+ trait_ref : Option < ExistentialTraitRef < ' tcx > > ,
247
249
) -> DataId {
248
- let alloc_id = tcx. vtable_allocation ( (
249
- ty,
250
- trait_ref. map ( |principal| tcx. instantiate_bound_regions_with_erased ( principal) ) ,
251
- ) ) ;
250
+ let alloc_id = tcx. vtable_allocation ( ( ty, trait_ref) ) ;
252
251
data_id_for_alloc_id ( cx, module, alloc_id, Mutability :: Not )
253
252
}
254
253
@@ -463,9 +462,15 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
463
462
GlobalAlloc :: Memory ( target_alloc) => {
464
463
data_id_for_alloc_id ( cx, module, alloc_id, target_alloc. inner ( ) . mutability )
465
464
}
466
- GlobalAlloc :: VTable ( ty, dyn_ty) => {
467
- data_id_for_vtable ( tcx, cx, module, ty, dyn_ty. principal ( ) )
468
- }
465
+ GlobalAlloc :: VTable ( ty, dyn_ty) => data_id_for_vtable (
466
+ tcx,
467
+ cx,
468
+ module,
469
+ ty,
470
+ dyn_ty
471
+ . principal ( )
472
+ . map ( |principal| tcx. instantiate_bound_regions_with_erased ( principal) ) ,
473
+ ) ,
469
474
GlobalAlloc :: Static ( def_id) => {
470
475
if tcx. codegen_fn_attrs ( def_id) . flags . contains ( CodegenFnAttrFlags :: THREAD_LOCAL )
471
476
{
0 commit comments