@@ -175,6 +175,13 @@ pub(crate) fn codegen_const_value<'tcx>(
175175 fx. module . declare_data_in_func ( data_id, & mut fx. bcx . func ) ;
176176 fx. bcx . ins ( ) . global_value ( fx. pointer_type , local_data_id)
177177 }
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+ }
178185 GlobalAlloc :: Static ( def_id) => {
179186 assert ! ( fx. tcx. is_static( def_id) ) ;
180187 let data_id = data_id_for_static (
@@ -360,6 +367,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
360367 GlobalAlloc :: Memory ( alloc) => alloc,
361368 GlobalAlloc :: Function { .. }
362369 | GlobalAlloc :: Static ( _)
370+ | GlobalAlloc :: TypeId { .. }
363371 | GlobalAlloc :: VTable ( ..) => {
364372 unreachable ! ( )
365373 }
@@ -471,6 +479,11 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
471479 . principal ( )
472480 . map ( |principal| tcx. instantiate_bound_regions_with_erased ( principal) ) ,
473481 ) ,
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+ }
474487 GlobalAlloc :: Static ( def_id) => {
475488 if tcx. codegen_fn_attrs ( def_id) . flags . contains ( CodegenFnAttrFlags :: THREAD_LOCAL )
476489 {
0 commit comments