mirror of https://github.com/rust-lang/rust.git
Improve `target` method API in `run-make-support`
This commit is contained in:
parent
b5b97dccae
commit
fcfac05657
|
@ -201,7 +201,8 @@ impl Rustc {
|
|||
}
|
||||
|
||||
/// Specify the target triple, or a path to a custom target json spec file.
|
||||
pub fn target(&mut self, target: &str) -> &mut Self {
|
||||
pub fn target<S: AsRef<str>>(&mut self, target: S) -> &mut Self {
|
||||
let target = target.as_ref();
|
||||
self.cmd.arg(format!("--target={target}"));
|
||||
self
|
||||
}
|
||||
|
|
|
@ -104,7 +104,8 @@ impl Rustdoc {
|
|||
}
|
||||
|
||||
/// Specify the target triple, or a path to a custom target json spec file.
|
||||
pub fn target(&mut self, target: &str) -> &mut Self {
|
||||
pub fn target<S: AsRef<str>>(&mut self, target: S) -> &mut Self {
|
||||
let target = target.as_ref();
|
||||
self.cmd.arg(format!("--target={target}"));
|
||||
self
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ fn main() {
|
|||
.stdin("fn main() {}")
|
||||
.emit("link,obj")
|
||||
.arg("-Csave-temps")
|
||||
.target(&target)
|
||||
.target(target)
|
||||
.run();
|
||||
|
||||
// Check linked output has a `.comment` section with the expected content.
|
||||
|
|
|
@ -28,7 +28,7 @@ fn main() {
|
|||
// Run rustc with `-Z temps-dir` set to a directory *inside* the inaccessible one,
|
||||
// so that it can't create `tmp`.
|
||||
rustc()
|
||||
.target(&target())
|
||||
.target(target())
|
||||
.input("program.rs")
|
||||
.arg("-Ztemps-dir=inaccessible/tmp")
|
||||
.run_fail()
|
||||
|
|
|
@ -51,7 +51,7 @@ fn test(compiler: &str) {
|
|||
|
||||
rustc()
|
||||
.input("test-aslr.rs")
|
||||
.target(&target())
|
||||
.target(target())
|
||||
.linker(compiler)
|
||||
.arg("-Clinker-flavor=gcc")
|
||||
.arg("-Ctarget-feature=+crt-static")
|
||||
|
|
Loading…
Reference in New Issue