diff options
| author | Ralf Jung <post@ralfj.de> | 2024-07-02 21:05:22 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-07-02 21:05:30 +0200 |
| commit | 41b98da42d0500e38b9dd85c82110ba177ac4de1 (patch) | |
| tree | 715c5787c45f093f51c827775a67240ff8f82727 /compiler/rustc_codegen_cranelift/src/constant.rs | |
| parent | 7d97c59438e933e86f557ed999da3b8dfc6855a7 (diff) | |
| download | rust-41b98da42d0500e38b9dd85c82110ba177ac4de1.tar.gz rust-41b98da42d0500e38b9dd85c82110ba177ac4de1.zip | |
Miri function identity hack: account for possible inlining
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/constant.rs')
| -rw-r--r-- | compiler/rustc_codegen_cranelift/src/constant.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/constant.rs b/compiler/rustc_codegen_cranelift/src/constant.rs index 87c5da3b7c3..9f7b95261d5 100644 --- a/compiler/rustc_codegen_cranelift/src/constant.rs +++ b/compiler/rustc_codegen_cranelift/src/constant.rs @@ -155,7 +155,7 @@ pub(crate) fn codegen_const_value<'tcx>( fx.bcx.ins().global_value(fx.pointer_type, local_data_id) } } - GlobalAlloc::Function(instance) => { + GlobalAlloc::Function { instance, .. } => { let func_id = crate::abi::import_function(fx.tcx, fx.module, instance); let local_func_id = fx.module.declare_func_in_func(func_id, &mut fx.bcx.func); @@ -351,7 +351,9 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant TodoItem::Alloc(alloc_id) => { let alloc = match tcx.global_alloc(alloc_id) { GlobalAlloc::Memory(alloc) => alloc, - GlobalAlloc::Function(_) | GlobalAlloc::Static(_) | GlobalAlloc::VTable(..) => { + GlobalAlloc::Function { .. } + | GlobalAlloc::Static(_) + | GlobalAlloc::VTable(..) => { unreachable!() } }; @@ -415,7 +417,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant let reloc_target_alloc = tcx.global_alloc(alloc_id); let data_id = match reloc_target_alloc { - GlobalAlloc::Function(instance) => { + GlobalAlloc::Function { instance, .. } => { assert_eq!(addend, 0); let func_id = crate::abi::import_function(tcx, module, instance.polymorphize(tcx)); |
