@@ -7,9 +7,9 @@ use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs}
7
7
use rustc_middle:: mir:: mono:: MonoItem ;
8
8
use rustc_middle:: ty:: { self , Instance , Ty } ;
9
9
use rustc_middle:: ty:: layout:: LayoutOf ;
10
- use rustc_middle:: mir:: interpret:: { self , ConstAllocation , ErrorHandled , GlobalAlloc , Scalar as InterpScalar , read_target_uint} ;
10
+ use rustc_middle:: mir:: interpret:: { self , ConstAllocation , ErrorHandled , Scalar as InterpScalar , read_target_uint} ;
11
11
use rustc_span:: def_id:: DefId ;
12
- use rustc_target:: abi:: { self , AddressSpace , Align , HasDataLayout , Primitive , Size , WrappingRange } ;
12
+ use rustc_target:: abi:: { self , Align , HasDataLayout , Primitive , Size , WrappingRange } ;
13
13
14
14
use crate :: base;
15
15
use crate :: context:: CodegenCx ;
@@ -323,12 +323,7 @@ pub fn const_alloc_to_gcc<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, alloc: ConstAl
323
323
. expect ( "const_alloc_to_llvm: could not read relocation pointer" )
324
324
as u64 ;
325
325
326
- let address_space = match cx. tcx . global_alloc ( alloc_id) {
327
- GlobalAlloc :: Function ( ..) => cx. data_layout ( ) . instruction_address_space ,
328
- GlobalAlloc :: Static ( ..) | GlobalAlloc :: Memory ( ..) | GlobalAlloc :: VTable ( ..) => {
329
- AddressSpace :: DATA
330
- }
331
- } ;
326
+ let address_space = cx. tcx . global_alloc ( alloc_id) . address_space ( cx) ;
332
327
333
328
llvals. push ( cx. scalar_to_backend (
334
329
InterpScalar :: from_pointer (
0 commit comments