Replace every String
in Target(Options) with Cow<'static, str>
This commit is contained in:
parent
15a242a432
commit
ccff48f97b
223 changed files with 1252 additions and 1243 deletions
|
@ -675,10 +675,10 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>(
|
|||
linker::disable_localization(&mut cmd);
|
||||
|
||||
for &(ref k, ref v) in &sess.target.link_env {
|
||||
cmd.env(k, v);
|
||||
cmd.env(k.as_ref(), v.as_ref());
|
||||
}
|
||||
for k in &sess.target.link_env_remove {
|
||||
cmd.env_remove(k);
|
||||
cmd.env_remove(k.as_ref());
|
||||
}
|
||||
|
||||
if sess.opts.prints.contains(&PrintRequest::LinkArgs) {
|
||||
|
@ -1216,7 +1216,7 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
|
|||
|
||||
if let Some(ret) = infer_from(
|
||||
sess,
|
||||
sess.target.linker.clone().map(PathBuf::from),
|
||||
sess.target.linker.as_ref().map(|l| PathBuf::from(l.as_ref())),
|
||||
Some(sess.target.linker_flavor),
|
||||
) {
|
||||
return ret;
|
||||
|
@ -1602,7 +1602,7 @@ fn add_link_script(cmd: &mut dyn Linker, sess: &Session, tmpdir: &Path, crate_ty
|
|||
let file_name = ["rustc", &sess.target.llvm_target, "linkfile.ld"].join("-");
|
||||
|
||||
let path = tmpdir.join(file_name);
|
||||
if let Err(e) = fs::write(&path, script) {
|
||||
if let Err(e) = fs::write(&path, script.as_ref()) {
|
||||
sess.fatal(&format!("failed to write link script to {}: {}", path.display(), e));
|
||||
}
|
||||
|
||||
|
@ -1960,8 +1960,8 @@ fn add_order_independent_options(
|
|||
cmd.arg(&codegen_results.crate_info.target_cpu);
|
||||
cmd.arg("--cpu-features");
|
||||
cmd.arg(match &sess.opts.cg.target_feature {
|
||||
feat if !feat.is_empty() => feat,
|
||||
_ => &sess.target.options.features,
|
||||
feat if !feat.is_empty() => feat.as_ref(),
|
||||
_ => sess.target.options.features.as_ref(),
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2478,12 +2478,12 @@ fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
|
|||
let os = &sess.target.os;
|
||||
let llvm_target = &sess.target.llvm_target;
|
||||
if sess.target.vendor != "apple"
|
||||
|| !matches!(os.as_str(), "ios" | "tvos")
|
||||
|| !matches!(os.as_ref(), "ios" | "tvos")
|
||||
|| flavor != LinkerFlavor::Gcc
|
||||
{
|
||||
return;
|
||||
}
|
||||
let sdk_name = match (arch.as_str(), os.as_str()) {
|
||||
let sdk_name = match (arch.as_ref(), os.as_ref()) {
|
||||
("aarch64", "tvos") => "appletvos",
|
||||
("x86_64", "tvos") => "appletvsimulator",
|
||||
("arm", "ios") => "iphoneos",
|
||||
|
|
|
@ -75,7 +75,7 @@ pub fn get_linker<'a>(
|
|||
if let Some(ref tool) = msvc_tool {
|
||||
let original_path = tool.path();
|
||||
if let Some(ref root_lib_path) = original_path.ancestors().nth(4) {
|
||||
let arch = match t.arch.as_str() {
|
||||
let arch = match t.arch.as_ref() {
|
||||
"x86_64" => Some("x64"),
|
||||
"x86" => Some("x86"),
|
||||
"aarch64" => Some("arm64"),
|
||||
|
@ -1520,7 +1520,7 @@ impl<'a> L4Bender<'a> {
|
|||
|
||||
pub(crate) fn exported_symbols(tcx: TyCtxt<'_>, crate_type: CrateType) -> Vec<String> {
|
||||
if let Some(ref exports) = tcx.sess.target.override_export_symbols {
|
||||
return exports.clone();
|
||||
return exports.iter().map(ToString::to_string).collect();
|
||||
}
|
||||
|
||||
let mut symbols = Vec::new();
|
||||
|
|
|
@ -218,7 +218,7 @@ impl ModuleConfig {
|
|||
false
|
||||
),
|
||||
emit_obj,
|
||||
bc_cmdline: sess.target.bitcode_llvm_cmdline.clone(),
|
||||
bc_cmdline: sess.target.bitcode_llvm_cmdline.to_string(),
|
||||
|
||||
verify_llvm_ir: sess.verify_llvm_ir(),
|
||||
no_prepopulate_passes: sess.opts.cg.no_prepopulate_passes,
|
||||
|
@ -1061,7 +1061,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
|
|||
is_pe_coff: tcx.sess.target.is_like_windows,
|
||||
target_can_use_split_dwarf: tcx.sess.target_can_use_split_dwarf(),
|
||||
target_pointer_width: tcx.sess.target.pointer_width,
|
||||
target_arch: tcx.sess.target.arch.clone(),
|
||||
target_arch: tcx.sess.target.arch.to_string(),
|
||||
debuginfo: tcx.sess.opts.debuginfo,
|
||||
split_debuginfo: tcx.sess.split_debuginfo(),
|
||||
split_dwarf_kind: tcx.sess.opts.debugging_opts.split_dwarf_kind,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue