about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/common.rs
diff options
context:
space:
mode:
authorOli Scherer <github333195615777966@oli-obk.de>2025-01-14 12:25:16 +0000
committerOli Scherer <github333195615777966@oli-obk.de>2025-02-11 09:47:13 +0000
commitdcf1e4d72b4dbda592050dcde7d7972414b05d3c (patch)
treeb56ce5ad454c1692896c3f38db52327ac674b0fc /compiler/rustc_codegen_llvm/src/common.rs
parent4b83038d637c1664df94895c82cb8b26716bad1d (diff)
downloadrust-dcf1e4d72b4dbda592050dcde7d7972414b05d3c.tar.gz
rust-dcf1e4d72b4dbda592050dcde7d7972414b05d3c.zip
Document some safety constraints and use more safe wrappers
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);
                 }