inline format!() args up to and including rustc_codegen_llvm
This commit is contained in:
parent
2e0136a131
commit
3ce90b1649
72 changed files with 411 additions and 481 deletions
|
@ -748,7 +748,7 @@ fn link_natively<'a>(
|
|||
|
||||
for print in &sess.opts.prints {
|
||||
if print.kind == PrintKind::LinkArgs {
|
||||
let content = format!("{:?}", cmd);
|
||||
let content = format!("{cmd:?}");
|
||||
print.out.overwrite(&content, sess);
|
||||
}
|
||||
}
|
||||
|
@ -1236,22 +1236,21 @@ fn link_sanitizer_runtime(sess: &Session, linker: &mut dyn Linker, name: &str) {
|
|||
}
|
||||
}
|
||||
|
||||
let channel = option_env!("CFG_RELEASE_CHANNEL")
|
||||
.map(|channel| format!("-{}", channel))
|
||||
.unwrap_or_default();
|
||||
let channel =
|
||||
option_env!("CFG_RELEASE_CHANNEL").map(|channel| format!("-{channel}")).unwrap_or_default();
|
||||
|
||||
if sess.target.is_like_osx {
|
||||
// On Apple platforms, the sanitizer is always built as a dylib, and
|
||||
// LLVM will link to `@rpath/*.dylib`, so we need to specify an
|
||||
// rpath to the library as well (the rpath should be absolute, see
|
||||
// PR #41352 for details).
|
||||
let filename = format!("rustc{}_rt.{}", channel, name);
|
||||
let filename = format!("rustc{channel}_rt.{name}");
|
||||
let path = find_sanitizer_runtime(&sess, &filename);
|
||||
let rpath = path.to_str().expect("non-utf8 component in path");
|
||||
linker.args(&["-Wl,-rpath", "-Xlinker", rpath]);
|
||||
linker.link_dylib(&filename, false, true);
|
||||
} else {
|
||||
let filename = format!("librustc{}_rt.{}.a", channel, name);
|
||||
let filename = format!("librustc{channel}_rt.{name}.a");
|
||||
let path = find_sanitizer_runtime(&sess, &filename).join(&filename);
|
||||
linker.link_whole_rlib(&path);
|
||||
}
|
||||
|
@ -1415,12 +1414,12 @@ fn print_native_static_libs(
|
|||
} else if sess.target.linker_flavor.is_gnu() {
|
||||
Some(format!("-l{}{}", if verbatim { ":" } else { "" }, name))
|
||||
} else {
|
||||
Some(format!("-l{}", name))
|
||||
Some(format!("-l{name}"))
|
||||
}
|
||||
}
|
||||
NativeLibKind::Framework { .. } => {
|
||||
// ld-only syntax, since there are no frameworks in MSVC
|
||||
Some(format!("-framework {}", name))
|
||||
Some(format!("-framework {name}"))
|
||||
}
|
||||
// These are included, no need to print them
|
||||
NativeLibKind::Static { bundle: None | Some(true), .. }
|
||||
|
@ -1457,12 +1456,12 @@ fn print_native_static_libs(
|
|||
// `foo.lib` file if the dll doesn't actually export any symbols, so we
|
||||
// check to see if the file is there and just omit linking to it if it's
|
||||
// not present.
|
||||
let name = format!("{}.dll.lib", lib);
|
||||
let name = format!("{lib}.dll.lib");
|
||||
if path.join(&name).exists() {
|
||||
lib_args.push(name);
|
||||
}
|
||||
} else {
|
||||
lib_args.push(format!("-l{}", lib));
|
||||
lib_args.push(format!("-l{lib}"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1628,8 +1627,8 @@ fn exec_linker(
|
|||
write!(f, "\"")?;
|
||||
for c in self.arg.chars() {
|
||||
match c {
|
||||
'"' => write!(f, "\\{}", c)?,
|
||||
c => write!(f, "{}", c)?,
|
||||
'"' => write!(f, "\\{c}")?,
|
||||
c => write!(f, "{c}")?,
|
||||
}
|
||||
}
|
||||
write!(f, "\"")?;
|
||||
|
@ -1646,8 +1645,8 @@ fn exec_linker(
|
|||
// ensure the line is interpreted as one whole argument.
|
||||
for c in self.arg.chars() {
|
||||
match c {
|
||||
'\\' | ' ' => write!(f, "\\{}", c)?,
|
||||
c => write!(f, "{}", c)?,
|
||||
'\\' | ' ' => write!(f, "\\{c}")?,
|
||||
c => write!(f, "{c}")?,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2284,7 +2283,7 @@ fn add_order_independent_options(
|
|||
} else {
|
||||
""
|
||||
};
|
||||
cmd.arg(format!("--dynamic-linker={}ld.so.1", prefix));
|
||||
cmd.arg(format!("--dynamic-linker={prefix}ld.so.1"));
|
||||
}
|
||||
|
||||
if sess.target.eh_frame_header {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue