Skip to content

Commit 75f6118

Browse files
committed
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`!
1 parent e05ad7f commit 75f6118

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/constant.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
369369
TodoItem::Static(def_id) => {
370370
//println!("static {:?}", def_id);
371371

372-
let section_name = tcx.codegen_fn_attrs(def_id).link_section.map(|s| s.as_str());
372+
let section_name = tcx.codegen_fn_attrs(def_id).link_section;
373373

374374
let alloc = tcx.eval_static_initializer(def_id).unwrap();
375375

@@ -388,6 +388,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
388388

389389
if let Some(section_name) = section_name {
390390
let (segment_name, section_name) = if tcx.sess.target.is_like_osx {
391+
let section_name = section_name.as_str();
391392
if let Some(names) = section_name.split_once(',') {
392393
names
393394
} else {
@@ -397,7 +398,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
397398
));
398399
}
399400
} else {
400-
("", &*section_name)
401+
("", section_name.as_str())
401402
};
402403
data_ctx.set_segment_section(segment_name, section_name);
403404
}

0 commit comments

Comments
 (0)