Open
Description
Problem
After cargo fix
emits warnings, subsequent cargo check
commands with the same arguments will not emit an error despite existence of -D
flag, until the build cache is cleared.
Steps
user@31c2faa23618:/unfixable$ cargo init && cargo update
Created binary (application) package
user@31c2faa23618:/unfixable$ cat > src/main.rs
fn main() {
'unused: loop {}
}
user@31c2faa23618:/unfixable$ git add -A && git commit -m initial
[master (root-commit) 339f77e] initial
4 files changed, 54 insertions(+)
create mode 100644 .gitignore
create mode 100644 Cargo.lock
create mode 100644 Cargo.toml
create mode 100644 src/main.rs
user@31c2faa23618:/unfixable$ RUSTFLAGS="-D unused_labels" cargo check
Checking unfixable v0.1.0 (/unfixable)
error: unused label
--> src/main.rs:2:5
|
2 | 'unused: loop {}
| ^^^^^^^
|
= note: requested on the command line with `-D unused-labels`
error: could not compile `unfixable` (bin "unfixable") due to 1 previous error
user@31c2faa23618:/unfixable$ RUSTFLAGS="-D unused_labels" cargo fix
Checking unfixable v0.1.0 (/unfixable)
warning: unused label
--> src/main.rs:2:5
|
2 | 'unused: loop {}
| ^^^^^^^
|
= note: requested on the command line with `-D unused-labels`
warning: `unfixable` (bin "unfixable" test) generated 1 warning
warning: `unfixable` (bin "unfixable") generated 1 warning (1 duplicate)
Finished dev [unoptimized + debuginfo] target(s) in 0.09s
user@31c2faa23618:/unfixable$ RUSTFLAGS="-D unused_labels" cargo check
warning: unused label
--> src/main.rs:2:5
|
2 | 'unused: loop {}
| ^^^^^^^
|
= note: requested on the command line with `-D unused-labels`
warning: `unfixable` (bin "unfixable") generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
Possible Solution(s)
No response
Notes
This looks like it's caused by forced demotion of errors into warnings in fix mode, which pollutes the result cache for cargo check
.
Version
cargo 1.77.0-nightly (ac6bbb332 2023-12-26)
release: 1.77.0-nightly
commit-hash: ac6bbb33293d8d424c17ecdb42af3aac25fb7295
commit-date: 2023-12-26
host: x86_64-unknown-linux-gnu
libgit2: 1.7.1 (sys:0.18.1 vendored)
libcurl: 8.5.0-DEV (sys:0.4.70+curl-8.5.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w 11 Sep 2023
os: Debian 11.0.0 [64-bit]