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