@@ -175,6 +175,13 @@ pub(crate) fn codegen_const_value<'tcx>(
175
175
fx. module . declare_data_in_func ( data_id, & mut fx. bcx . func ) ;
176
176
fx. bcx . ins ( ) . global_value ( fx. pointer_type , local_data_id)
177
177
}
178
+ GlobalAlloc :: TypeId { .. } => {
179
+ return CValue :: const_val (
180
+ fx,
181
+ layout,
182
+ ScalarInt :: try_from_target_usize ( offset. bytes ( ) , fx. tcx ) . unwrap ( ) ,
183
+ ) ;
184
+ }
178
185
GlobalAlloc :: Static ( def_id) => {
179
186
assert ! ( fx. tcx. is_static( def_id) ) ;
180
187
let data_id = data_id_for_static (
@@ -360,6 +367,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
360
367
GlobalAlloc :: Memory ( alloc) => alloc,
361
368
GlobalAlloc :: Function { .. }
362
369
| GlobalAlloc :: Static ( _)
370
+ | GlobalAlloc :: TypeId { .. }
363
371
| GlobalAlloc :: VTable ( ..) => {
364
372
unreachable ! ( )
365
373
}
@@ -471,6 +479,11 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
471
479
. principal ( )
472
480
. map ( |principal| tcx. instantiate_bound_regions_with_erased ( principal) ) ,
473
481
) ,
482
+ GlobalAlloc :: TypeId { .. } => {
483
+ // Nothing to do, the bytes/offset of this pointer have already been written together with all other bytes,
484
+ // so we just need to drop this provenance.
485
+ continue ;
486
+ }
474
487
GlobalAlloc :: Static ( def_id) => {
475
488
if tcx. codegen_fn_attrs ( def_id) . flags . contains ( CodegenFnAttrFlags :: THREAD_LOCAL )
476
489
{
0 commit comments