Clippy subtree update#152862
Conversation
We might not have the declaration around if `extern crate` is used, or if rust-src is not installed for the standard library. Better err on the safe side rather than having a behavior depending on what happens to be available at compile time.
Fixes a FP for assertions_on_result_states, missing_assert_message on edition 2015/2018
Co-authored-by: Michael Goulet <michael@errs.io>
) Closes rust-lang/rust-clippy#16515 changelog: [`iter_kv_map`] extend to cover `flat_map` and `filter_map`
The `RustcCallbacks::config()` function used by `clippy-driver` was not setting `config.extra_symbols`, so when interned symbols were computed, such as `sym::CLIPPY_ARGS`, it was using some random string in the binary. The fix is to set ```rust config.extra_symbols = sym::EXTRA_SYMBOLS.into(); ``` in the config() function. This mirrors what is done in the `ClippyCallbacks::config()` function, which did not show a problem. # Steps to repro the problem (WITHOUT this PR): I'm on a mac laptop now, but I repro'd this on Linux too: ```console ❯ cargo -V cargo 1.95.0-nightly (fe2f314ae 2026-01-30) ``` 1. Create a dummy project ```console ❯ cargo new --lib /tmp/foo ``` 2. Run `clippy-driver` from this repo on `/tmp/foo/src/lib.rs`. You must specify `--cap-lints allow` in order for the `RustcCallbacks` to be used; otherwise, the `ClippyCallbacks` are used ad you won't see the problem. ```console ❯ cargo run --bin clippy-driver -- rustc --crate-name foo --edition=2024 /tmp/foo/src/lib.rs --crate-type lib --emit=dep-info --out-dir /tmp/foo --cap-lints allow ``` 3. **The problem**: The problem is the `env-dep:macos` line. It is _incorrectly_ recording that the "macos" environment varialbe is relevant for this build. On Linux it showed the string "linux". I've also seen other random strings, like "128". I believe these strings are arbitrary. The problem is that the `sym::CLIPPY_ARGS` symbol is read without the `exta_symbols` table being set. ```console ❯ cat /tmp/foo/foo.d /tmp/foo/foo.d: /tmp/foo/src/lib.rs /tmp/foo/src/lib.rs: # env-dep:macos ``` # The fix: With this fix in this PR, we can re-run the `clippy-driver` invocation in step 2 above and see the expected dep-info showing `env-dep:CLIPPY_ARGS` instead of `env-dep:macos`. ```console ❯ cargo run --bin clippy-driver -- rustc --crate-name foo --edition=2024 /tmp/foo/src/lib.rs --crate-type lib --emit=dep-info --out-dir /tmp/foo --cap-lints allow ❯ cat /tmp/foo/foo.d /tmp/foo/foo.d: /tmp/foo/src/lib.rs /tmp/foo/src/lib.rs: # env-dep:CLIPPY_ARGS ```
…ting to a path that's distinct from `target-dir`.
…g#16415) We might not have the declaration around if `extern crate` is used, or if rust-src is not installed for the standard library. Better err on the safe side rather than having a behavior depending on what happens to be available at compile time. Fixes rust-lang/rust-clippy#14625 changelog: [`unnecessary_cast`]: do not warn on casts of external function return type
…ting to a path that's distinct from `target-dir` (rust-lang#16568) Fixes rust-lang/rust-clippy#16567. Fix the compile-test tests when Cargo's `build.build-dir` is set to a path that's distinct from `target-dir`. Right now, the uitest harness assumes that `clippy-driver` (a final build artifact) is located in the parent directory of `compile_test-…` (an intermediate artifact or, rather, a dependency's final artifact), and that doesn't hold when `build-dir` is configured independently from `target-dir`, like so (in ~/.cargo/config.toml): ```toml [build] build-dir = "{cargo-cache-home}/build-artifacts/{workspace-path-hash}" ``` changelog: none
…ust-lang#16620) Closes rust-lang/rust-clippy#16612 Previous implementation hardcoded `0` as loop counter start, this PR lifts that restriction. changelog: [`explicit_counter_loop`] fix FN when loop counter starts at non-zero
9d06e5d to
0028f34
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
|
Thanks for the investigation! I redid the sync. Conflict resolution was a bit tedious. But now Let's hope CI agrees. |
This comment has been minimized.
This comment has been minimized.
|
@flip1995 If you haven't addressed the failure yet, I have commit 289720f in the clippy-subtree-update branch of samueltardieu/rust which makes |
|
Some changes occurred in compiler/rustc_codegen_gcc |
|
Thanks! cherry-picked that commit |
| .get_target_builtin_function("__builtin_ia32_vfcmaddcsh_mask_round") | ||
| .get_address(None); | ||
| } | ||
| "__builtin_ia32_vfcmaddcsh_mask3_round" if format!("{:?}", args[3]).ends_with("255") => { |
There was a problem hiding this comment.
Instead of changing the code, could you please add an attribute #[allow(clippy:_)] at the crate root?
I prefer the old code.
There was a problem hiding this comment.
Sure! Whatever you prefer 👍
There was a problem hiding this comment.
uninlined_format_args is marked as expected. I can also change the allow added for this lint to an expect, if you want.
There was a problem hiding this comment.
#[allow] is OK for this.
Thanks!
295a335 to
f597b0f
Compare
|
Previous CI run was green, with only the lint change that should do it, let's roll. @bors r+ p=1 rollup=never |
This comment has been minimized.
This comment has been minimized.
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 58745ca (parent) -> 3f98535 (this PR) Test differencesNo test diffs found Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 3f9853562c73af38a5e6af8b0da1b2734a327e19 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (3f98535): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (secondary 8.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 478.569s -> 480.701s (0.45%) |
View all comments
r? Manishearth