about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/consts.rs
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2024-10-19 12:17:33 +1100
committerZalathar <Zalathar@users.noreply.github.com>2024-10-26 20:20:20 +1100
commitb114040afbdf2366390dea7a53b8ca6fbf3f5951 (patch)
tree613ab33c1c7d77a52a7898d1a5e466cd146722da /compiler/rustc_codegen_llvm/src/consts.rs
parent983d258be3cbfc72a806c870a69743b6d14e4a33 (diff)
downloadrust-b114040afbdf2366390dea7a53b8ca6fbf3f5951.tar.gz
rust-b114040afbdf2366390dea7a53b8ca6fbf3f5951.zip
Use safe wrappers `get_visibility` and `set_visibility`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/consts.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/consts.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_llvm/src/consts.rs b/compiler/rustc_codegen_llvm/src/consts.rs
index 0bfd433418a..1e3abcfd1af 100644
--- a/compiler/rustc_codegen_llvm/src/consts.rs
+++ b/compiler/rustc_codegen_llvm/src/consts.rs
@@ -288,9 +288,7 @@ impl<'ll> CodegenCx<'ll, '_> {
             let g = self.declare_global(sym, llty);
 
             if !self.tcx.is_reachable_non_generic(def_id) {
-                unsafe {
-                    llvm::LLVMRustSetVisibility(g, llvm::Visibility::Hidden);
-                }
+                llvm::set_visibility(g, llvm::Visibility::Hidden);
             }
 
             g
@@ -308,7 +306,7 @@ impl<'ll> CodegenCx<'ll, '_> {
             llvm::set_thread_local_mode(g, self.tls_model);
         }
 
-        let dso_local = unsafe { self.should_assume_dso_local(g, true) };
+        let dso_local = self.should_assume_dso_local(g, true);
         if dso_local {
             unsafe {
                 llvm::LLVMRustSetDSOLocal(g, true);
@@ -398,7 +396,7 @@ impl<'ll> CodegenCx<'ll, '_> {
                 llvm::set_value_name(g, b"");
 
                 let linkage = llvm::get_linkage(g);
-                let visibility = llvm::LLVMRustGetVisibility(g);
+                let visibility = llvm::get_visibility(g);
 
                 let new_g = llvm::LLVMRustGetOrInsertGlobal(
                     self.llmod,
@@ -408,7 +406,7 @@ impl<'ll> CodegenCx<'ll, '_> {
                 );
 
                 llvm::set_linkage(new_g, linkage);
-                llvm::LLVMRustSetVisibility(new_g, visibility);
+                llvm::set_visibility(new_g, visibility);
 
                 // The old global has had its name removed but is returned by
                 // get_static since it is in the instance cache. Provide an