-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cargo caches failed cargo clippy -- --bad-arg
#14385
Comments
Note that |
Would not caching failed invocations in |
The command being invoked is $ /home/epage/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/clippy-driver /home/epage/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc -vV So CLIPPY_ARGS is being passed through to this which is causing it to fail. Trying 1.75, this wasn't a problem. Looks like this might have been broken by #13659 CC @RalfJung |
Caching of failures was intentionally added in #9112 (cc5e9df)
The problem in that case isn't too clear to me and would need further investigation to go down that route. |
That issue explains the motivation, not sure what to add. Also, what good is a "wrapper" that doesn't actually get invoked for all rustc invocation? If the goal of the wrapper is to e.g. swap out which rustc is being called, it is crucial that all invocations are made through the wrapper. Seems like the clippy wrapper is just blindly adding extra arguments to all invocations. Note that |
From my looking it came down to
without an explanation of why that call needs to be intercepted
This would be a good next step to investigate when considering all possible directions for resolving this. |
Please also read the rest of the issue. :) The context is that Miri and bootstrap use RUSTC_WRAPPER to completely replace the rustc being invoked; there is no a priori relationship between |
It was an issue in 1.75 also export RUSTUP_TOOLCHAIN=1.75
cargo new --lib demo && cd demo
cargo check
cargo clippy -- -x
cargo clippy
Skipping some steps if we encounter |
Yeah that is exactly the other "query invocation" I mentioned above. #13659 just made it so that both query invocations are fed through the wrapper consistently, but clippy's wrapper behavior in combination with caching was a problem even when just one of the queries is fed through the wrapper. |
FWIW, this is Miri's logic for determining whether the invocation is an "info query" and hence needs to be treated differently: |
@RalfJung please assume people have made a good faith effort. In this case, I did look over the issue and another one it links to, multiple times in case I missed something. Whats still not clear is the end-user side effect of what you are wanting, the end-user either being the Looking over the code, it looks like we primarily use it for MSRV checks and fingerprinting of rustc. The first requires the result to be representative of the compiler / stdlib version being performed. Unsure if there are other factors helping with fingerprinting or if that is ultimately what you are looking for here. |
@epage sorry for that. I was slightly frustrated since your questions sounded somewhat dismissive. I think there are nicer ways to ask "would you mind explaining which RUSTC_WRAPPER usecase is affected by this"; the undertone of your question that I received was "this looks useless, what are you doing". My reply was still unnecessary. As described here (but admittedly without going into much detail), the end users I am concerned about are rustc bootstrap and Anyway I think the discussion is rather moot now since the Clippy issue predates my PR. |
Yes, with the verification that that change didn't break rustc, it is no longer a blocker for this issue. I'll copy the relevant notes to that issue. |
Alex was referring to calls like let supports_split_debuginfo = rustc
.cached_output(process.clone().arg("-Csplit-debuginfo=packed"))
.is_ok(); which we do when we don't wait two releases before calling something. If we reverted cc5e9df, then the next time we add a probe, it will break the tests for our caching and the mixture of messages from the failure (not cached) and success (cached) cases would reduce the tests insight into what is working. This test change would then need to be reverted if/when we remove the probe. This wasn't called out but cc5e9df should have also reduced the overhead from the flag probing. While miri and clippy can workaround this, it is a foot gun for anyone writing a |
FWIW I don't think Miri is concerned with working around this. It anyway has to detect these "info queries" as they otherwise throw off our heuristics for whether the current rustc invocation is a "host" or a "target" build (which matters a lot for Miri because all "target" builds are just interpreted, not compiled to machine code). |
Problem
From rust-lang/rust-clippy#12623 (comment):
Output:
cargo clippy -- -x
is expected to fail but the followingcargo clippy
is notIn normal operation
clippy-driver
gets far enough along to registerCLIPPY_ARGS
into the env depinfo but that doesn't happen hereSteps
No response
Possible Solution(s)
CLIPPY_ARGS
could be added to the fingerprint as a special case, but the issue could also exist for other wrappersNotes
No response
Version
No response
The text was updated successfully, but these errors were encountered: