mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
fix: emit warnings as warnings when learning rust target info
This is a horrible hack, It lets the rustc invocation for learning target info always emit warnings as warnings. But at least it unblocks people who pass `-Awarnings` via RUSTFLAGS. A long-term solution is a better interface between build systems and the compiler. See the discussion on Zulip: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Improving.20communication.20interface.20between.20cargo.2Frustc Fixes rust-lang/cargo#8010
This commit is contained in:
parent
e57a2f43c2
commit
5e3558cf07
@ -206,6 +206,10 @@ impl TargetInfo {
|
||||
process.arg("--print=crate-name"); // `___` as a delimiter.
|
||||
process.arg("--print=cfg");
|
||||
|
||||
// parse_crate_type() relies on "unsupported/unknown crate type" error message,
|
||||
// so make warnings always emitted as warnings.
|
||||
process.arg("-Wwarnings");
|
||||
|
||||
let (output, error) = rustc
|
||||
.cached_output(&process, extra_fingerprint)
|
||||
.with_context(|| {
|
||||
|
@ -1287,11 +1287,11 @@ fn always_emit_warnings_as_warnings_when_learning_target_info() {
|
||||
p.cargo("build -v --target")
|
||||
.env("RUSTFLAGS", "-Awarnings")
|
||||
.arg(target)
|
||||
.with_status(101)
|
||||
.with_stderr_data(str![[r#"
|
||||
[ERROR] output of --print=file-names missing when learning about target-specific information from rustc
|
||||
command was: `rustc - --crate-name ___ --print=file-names -Awarnings --target wasm32-unknown-unknown --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg`
|
||||
...
|
||||
[COMPILING] foo v0.0.0 ([ROOT]/foo)
|
||||
[RUNNING] `rustc --crate-name foo [..]-Awarnings[..]`
|
||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||
|
||||
"#]])
|
||||
.run();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user