Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk

Remove `SymbolStr`

This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences.

Best reviewed one commit at a time.

r? `@oli-obk`
This commit is contained in:
bors 2021-12-19 09:31:37 +00:00
commit c3a9a9b424
2 changed files with 6 additions and 5 deletions

View File

@ -369,7 +369,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
TodoItem::Static(def_id) => { TodoItem::Static(def_id) => {
//println!("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(); 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 { if let Some(section_name) = section_name {
let (segment_name, section_name) = if tcx.sess.target.is_like_osx { 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(',') { if let Some(names) = section_name.split_once(',') {
names names
} else { } else {
@ -397,7 +398,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
)); ));
} }
} else { } else {
("", &*section_name) ("", section_name.as_str())
}; };
data_ctx.set_segment_section(segment_name, section_name); data_ctx.set_segment_section(segment_name, section_name);
} }

View File

@ -84,7 +84,7 @@ fn reuse_workproduct_for_cgu(
let work_product = cgu.work_product(tcx); let work_product = cgu.work_product(tcx);
if let Some(saved_file) = &work_product.saved_file { if let Some(saved_file) = &work_product.saved_file {
let obj_out = let obj_out =
tcx.output_filenames(()).temp_path(OutputType::Object, Some(&cgu.name().as_str())); tcx.output_filenames(()).temp_path(OutputType::Object, Some(cgu.name().as_str()));
object = Some(obj_out.clone()); object = Some(obj_out.clone());
let source_file = rustc_incremental::in_incr_comp_dir_sess(&tcx.sess, &saved_file); let source_file = rustc_incremental::in_incr_comp_dir_sess(&tcx.sess, &saved_file);
if let Err(err) = rustc_fs_util::link_or_copy(&source_file, &obj_out) { if let Err(err) = rustc_fs_util::link_or_copy(&source_file, &obj_out) {
@ -176,7 +176,7 @@ fn module_codegen(
) )
}); });
codegen_global_asm(tcx, &cgu.name().as_str(), &cx.global_asm); codegen_global_asm(tcx, cgu.name().as_str(), &cx.global_asm);
codegen_result codegen_result
} }
@ -207,7 +207,7 @@ pub(crate) fn run_aot(
cgus.iter() cgus.iter()
.map(|cgu| { .map(|cgu| {
let cgu_reuse = determine_cgu_reuse(tcx, cgu); let cgu_reuse = determine_cgu_reuse(tcx, cgu);
tcx.sess.cgu_reuse_tracker.set_actual_reuse(&cgu.name().as_str(), cgu_reuse); tcx.sess.cgu_reuse_tracker.set_actual_reuse(cgu.name().as_str(), cgu_reuse);
match cgu_reuse { match cgu_reuse {
_ if backend_config.disable_incr_cache => {} _ if backend_config.disable_incr_cache => {}