about summary refs log tree commit diff
path: root/src/librustc_codegen_ssa/back
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2020-07-08 11:04:10 +1000
committerNicholas Nethercote <nnethercote@mozilla.com>2020-07-15 08:42:59 +1000
commitf04e866e5752f47e0896550faf40e19fea22d8ea (patch)
treedc192030f27fb19c6c842775f931f6a7494a0020 /src/librustc_codegen_ssa/back
parente284f5d050029906d32667635af9c839fafd3eca (diff)
downloadrust-f04e866e5752f47e0896550faf40e19fea22d8ea.tar.gz
rust-f04e866e5752f47e0896550faf40e19fea22d8ea.zip
Add and use more static symbols.
Note that the output of `unpretty-debug.stdout` has changed. In that
test the hash values are normalized from a symbol numbers to small
numbers like "0#0" and "0#1". The increase in the number of static
symbols must have caused the original numbers to contain more digits,
resulting in different pretty-printing prior to normalization.
Diffstat (limited to 'src/librustc_codegen_ssa/back')
-rw-r--r--src/librustc_codegen_ssa/back/symbol_export.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs
index 2efbfcb9950..faf6809f35b 100644
--- a/src/librustc_codegen_ssa/back/symbol_export.rs
+++ b/src/librustc_codegen_ssa/back/symbol_export.rs
@@ -16,6 +16,7 @@ use rustc_middle::ty::subst::{GenericArgKind, SubstsRef};
 use rustc_middle::ty::Instance;
 use rustc_middle::ty::{SymbolName, TyCtxt};
 use rustc_session::config::{CrateType, SanitizerSet};
+use rustc_span::symbol::sym;
 
 pub fn threshold(tcx: TyCtxt<'_>) -> SymbolExportLevel {
     crates_export_threshold(&tcx.sess.crate_types())
@@ -107,7 +108,7 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, cnum: CrateNum) -> DefIdMap<
         })
         .map(|def_id| {
             let export_level = if special_runtime_crate {
-                let name = tcx.symbol_name(Instance::mono(tcx, def_id.to_def_id())).name.as_str();
+                let name = tcx.symbol_name(Instance::mono(tcx, def_id.to_def_id())).name;
                 // We can probably do better here by just ensuring that
                 // it has hidden visibility rather than public
                 // visibility, as this is primarily here to ensure it's
@@ -115,13 +116,12 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, cnum: CrateNum) -> DefIdMap<
                 //
                 // In general though we won't link right if these
                 // symbols are stripped, and LTO currently strips them.
-                if name == "rust_eh_personality"
-                    || name == "rust_eh_register_frames"
-                    || name == "rust_eh_unregister_frames"
-                {
-                    SymbolExportLevel::C
-                } else {
-                    SymbolExportLevel::Rust
+                match name {
+                    sym::rust_eh_personality
+                    | sym::rust_eh_register_frames
+                    | sym::rust_eh_unregister_frames =>
+                        SymbolExportLevel::C,
+                    _ => SymbolExportLevel::Rust,
                 }
             } else {
                 symbol_export_level(tcx, def_id.to_def_id())