about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/common.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-02-12 06:07:35 +0100
committerGitHub <noreply@github.com>2025-02-12 06:07:35 +0100
commit9e89feefb9ce0309cc7fdba91b4e42c4bfe7bbb8 (patch)
tree5a95a808bb78c41fc231c0676b751bf4013f49e0 /compiler/rustc_codegen_llvm/src/common.rs
parent34a5ea911c56e79bd451c63f04ea2f5023d7d1a3 (diff)
parentdcf1e4d72b4dbda592050dcde7d7972414b05d3c (diff)
downloadrust-9e89feefb9ce0309cc7fdba91b4e42c4bfe7bbb8.tar.gz
rust-9e89feefb9ce0309cc7fdba91b4e42c4bfe7bbb8.zip
Rollup merge of #135549 - oli-obk:push-tmxtpnrloyqu, r=compiler-errors
Document some safety constraints and use more safe wrappers

Lots of unsafe codegen_llvm code has safe wrappers already, so I used some of them and added some where applicable. I stopped here because this diff is large enough and should probably be reviewed independently of other changes.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/common.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/common.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/common.rs b/compiler/rustc_codegen_llvm/src/common.rs
index 8c94a46ebf3..78b3a7f8541 100644
--- a/compiler/rustc_codegen_llvm/src/common.rs
+++ b/compiler/rustc_codegen_llvm/src/common.rs
@@ -219,8 +219,8 @@ impl<'ll, 'tcx> ConstCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
                 let g = self.define_global(&sym, self.val_ty(sc)).unwrap_or_else(|| {
                     bug!("symbol `{}` is already defined", sym);
                 });
+                llvm::set_initializer(g, sc);
                 unsafe {
-                    llvm::LLVMSetInitializer(g, sc);
                     llvm::LLVMSetGlobalConstant(g, True);
                     llvm::LLVMSetUnnamedAddress(g, llvm::UnnamedAddr::Global);
                 }