about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2021-12-15 08:32:21 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2021-12-15 13:30:26 +1100
commit75f6118ad1920487117c5eef361d2edd817bb27f (patch)
tree2f9cd0c155fef272a4c2eac5d0bc0907b33721ce
parente05ad7f8199f0da52892d96f37c72581f1f56e87 (diff)
downloadrust-75f6118ad1920487117c5eef361d2edd817bb27f.tar.gz
rust-75f6118ad1920487117c5eef361d2edd817bb27f.zip
Remove `SymbolStr`.
By changing `as_str()` to take `&self` instead of `self`, we can just
return `&str`. We're still lying about lifetimes, but it's a smaller lie
than before, where `SymbolStr` contained a (fake) `&'static str`!
-rw-r--r--src/constant.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/constant.rs b/src/constant.rs
index 5c4991f1fb6..9a6c45ae98d 100644
--- a/src/constant.rs
+++ b/src/constant.rs
@@ -369,7 +369,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
             TodoItem::Static(def_id) => {
                 //println!("static {:?}", def_id);
 
-                let section_name = tcx.codegen_fn_attrs(def_id).link_section.map(|s| s.as_str());
+                let section_name = tcx.codegen_fn_attrs(def_id).link_section;
 
                 let alloc = tcx.eval_static_initializer(def_id).unwrap();
 
@@ -388,6 +388,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
 
         if let Some(section_name) = section_name {
             let (segment_name, section_name) = if tcx.sess.target.is_like_osx {
+                let section_name = section_name.as_str();
                 if let Some(names) = section_name.split_once(',') {
                     names
                 } else {
@@ -397,7 +398,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
                     ));
                 }
             } else {
-                ("", &*section_name)
+                ("", section_name.as_str())
             };
             data_ctx.set_segment_section(segment_name, section_name);
         }