about summary refs log tree commit diff
diff options
context:
space:
mode:
authorantoyo <antoyo@users.noreply.github.com>2023-05-25 19:35:38 -0400
committerGitHub <noreply@github.com>2023-05-25 19:35:38 -0400
commit4d8c6d35024666cf1486e84c12a7b2a86b211e22 (patch)
tree43c6a350e08321d6e713d0310a6af6bc1a2f9675
parent0cbf2b97157e0c3e2d1f809453a527bed4689247 (diff)
parenta512e98028bf830e1ebc0fa018d210801c86793c (diff)
downloadrust-4d8c6d35024666cf1486e84c12a7b2a86b211e22.tar.gz
rust-4d8c6d35024666cf1486e84c12a7b2a86b211e22.zip
Merge pull request #277 from rust-lang/feature/global-visibility
Set visibility of global
-rw-r--r--src/consts.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/consts.rs b/src/consts.rs
index 792ab8f890d..56513c29ce0 100644
--- a/src/consts.rs
+++ b/src/consts.rs
@@ -1,5 +1,5 @@
 #[cfg(feature = "master")]
-use gccjit::FnAttribute;
+use gccjit::{FnAttribute, VarAttribute, Visibility};
 use gccjit::{Function, GlobalKind, LValue, RValue, ToRValue, Type};
 use rustc_codegen_ssa::traits::{BaseTypeMethods, ConstMethods, DerivedTypeMethods, StaticMethods};
 use rustc_middle::span_bug;
@@ -249,7 +249,8 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
             );
 
             if !self.tcx.is_reachable_non_generic(def_id) {
-                // TODO(antoyo): set visibility.
+                #[cfg(feature = "master")]
+                global.add_attribute(VarAttribute::Visibility(Visibility::Hidden));
             }
 
             global