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.
Rollup merge of rust-lang#119286 - jyn514:linker-output, r=bjorn3
show linker output even if the linker succeeds - show stderr by default - show stdout if `--verbose` is passed - remove both from RUSTC_LOG - hide the linker cli args unless `--verbose` is passed fixes rust-lang#83436. fixes rust-lang#38206. fixes rust-lang#109979. helps with rust-lang#46998. cc https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/uplift.20some.20-Zverbose.20calls.20and.20rename.20to.E2.80.A6.20compiler-team.23706/near/408986134 this is based on rust-lang#119129 for convenience so i didn't have to duplicate the changes around saving `--verbose` in rust-lang@cb6d033#diff-7a49efa20548d6806dbe1c66dd4dc445fda18fcbbf1709520cadecc4841aae12 r? `@bjorn3`
- Loading branch information
Showing
19 changed files
with
284 additions
and
157 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 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 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
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,17 @@ | ||
#!/bin/sh | ||
|
||
code=0 | ||
while ! [ $# = 0 ]; do | ||
case "$1" in | ||
run_make_info) echo "foo" | ||
;; | ||
run_make_warn) echo "warning: bar" >&2 | ||
;; | ||
run_make_error) echo "error: baz" >&2; code=1 | ||
;; | ||
*) ;; # rustc passes lots of args we don't care about | ||
esac | ||
shift | ||
done | ||
|
||
exit $code |
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 @@ | ||
fn main() {} |
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
Oops, something went wrong.