diff options
| author | Ralf Jung <post@ralfj.de> | 2025-07-10 06:57:45 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-10 06:57:45 +0000 |
| commit | 317f59dfebb3ca584c4ab7c137208bbb23601eb2 (patch) | |
| tree | 4475de7055ec501bfa7d9789536894ddafe1dc6b /compiler/rustc_codegen_gcc | |
| parent | a09cf9cc5a7fd4e2e19d937ef03bfeec34993a49 (diff) | |
| parent | 17b240e04f8d14e5563b6afb2ed3b842f87d1c78 (diff) | |
| download | rust-317f59dfebb3ca584c4ab7c137208bbb23601eb2.tar.gz rust-317f59dfebb3ca584c4ab7c137208bbb23601eb2.zip | |
Merge pull request #4458 from rust-lang/rustup-2025-07-10
Automatic Rustup
Diffstat (limited to 'compiler/rustc_codegen_gcc')
| -rw-r--r-- | compiler/rustc_codegen_gcc/src/common.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_gcc/src/common.rs b/compiler/rustc_codegen_gcc/src/common.rs index 32713eb56c6..28848ca6184 100644 --- a/compiler/rustc_codegen_gcc/src/common.rs +++ b/compiler/rustc_codegen_gcc/src/common.rs @@ -1,7 +1,6 @@ use gccjit::{LValue, RValue, ToRValue, Type}; -use rustc_abi as abi; -use rustc_abi::HasDataLayout; use rustc_abi::Primitive::Pointer; +use rustc_abi::{self as abi, HasDataLayout}; use rustc_codegen_ssa::traits::{ BaseTypeCodegenMethods, ConstCodegenMethods, MiscCodegenMethods, StaticCodegenMethods, }; @@ -282,6 +281,13 @@ impl<'gcc, 'tcx> ConstCodegenMethods for CodegenCx<'gcc, 'tcx> { let init = self.const_data_from_alloc(alloc); self.static_addr_of(init, alloc.inner().align, None) } + GlobalAlloc::TypeId { .. } => { + let val = self.const_usize(offset.bytes()); + // This is still a variable of pointer type, even though we only use the provenance + // of that pointer in CTFE and Miri. But to make LLVM's type system happy, + // we need an int-to-ptr cast here (it doesn't matter at all which provenance that picks). + return self.context.new_cast(None, val, ty); + } GlobalAlloc::Static(def_id) => { assert!(self.tcx.is_static(def_id)); self.get_static(def_id).get_address(None) |
