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