forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
don't show the full linker args unless
--verbose
is passed
the linker arguments can be *very* long, especially for crates with many dependencies. often they are not useful. omit them unless the user specifically requests them.
- Loading branch information
Showing
9 changed files
with
89 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
fn main() { | ||
for arg in std::env::args() { | ||
match &*arg { | ||
"run_make_info" => println!("foo"), | ||
"run_make_warn" => eprintln!("warning: bar"), | ||
"run_make_error" => { | ||
eprintln!("error: baz"); | ||
std::process::exit(1); | ||
} | ||
_ => (), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
use std::path::Path; | ||
|
||
use run_make_support::rfs::remove_file; | ||
use run_make_support::{rustc, Rustc}; | ||
|
||
fn run_rustc() -> Rustc { | ||
let mut rustc = rustc(); | ||
rustc.arg("main.rs").output("main").linker("./fake-linker"); | ||
rustc | ||
} | ||
|
||
fn main() { | ||
// first, compile our linker | ||
rustc().arg("fake-linker.rs").output("fake-linker").run(); | ||
|
||
// Run rustc with our fake linker, and make sure it shows warnings | ||
let warnings = run_rustc().link_arg("run_make_warn").run(); | ||
warnings.assert_stderr_contains("warning: linker stderr: bar"); | ||
|
||
// Make sure it shows stdout, but only when --verbose is passed | ||
run_rustc() | ||
.link_arg("run_make_info") | ||
.verbose() | ||
.run() | ||
.assert_stderr_contains("warning: linker stdout: foo"); | ||
run_rustc() | ||
.link_arg("run_make_info") | ||
.run() | ||
.assert_stderr_not_contains("warning: linker stdout: foo"); | ||
|
||
// Make sure we short-circuit this new path if the linker exits with an error | ||
// (so the diagnostic is less verbose) | ||
run_rustc().link_arg("run_make_error").run_fail().assert_stderr_contains("note: error: baz"); | ||
|
||
// Make sure we don't show the linker args unless `--verbose` is passed | ||
run_rustc() | ||
.link_arg("run_make_error") | ||
.verbose() | ||
.run_fail() | ||
.assert_stderr_contains_regex("fake-linker.*run_make_error"); | ||
run_rustc() | ||
.link_arg("run_make_error") | ||
.run_fail() | ||
.assert_stderr_not_contains_regex("fake-linker.*run_make_error"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters