Skip to content

[beta] Clippy backport#155051

Open
flip1995 wants to merge 3 commits intorust-lang:betafrom
flip1995:clippy-beta-backport
Open

[beta] Clippy backport#155051
flip1995 wants to merge 3 commits intorust-lang:betafrom
flip1995:clippy-beta-backport

Conversation

@flip1995
Copy link
Copy Markdown
Member

@flip1995 flip1995 commented Apr 9, 2026

Clippy is backporting 2 ICE fixes and 1 perf regression:

r? cuviper

Jarcho and others added 3 commits April 9, 2026 17:57
The wrong `TypeckResults` was used in the fallback equality function
passed by the `match_same_arms` and `filter_map` lints. Previously,
those fallback functions had no way of using the proper `TypeckResults`.
Those (one per expression being compared) are now passed to the
registered fallback function.

changelog: [`match_same_arms`]: fix internal compiler error

Fixes rust-lang/rust-clippy#16678
Fixes rust-lang/rust-clippy#16686

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_SUMMARY_START -->

### Summary Notes

- [Beta
nomination](rust-lang/rust-clippy#16685 (comment))
by [samueltardieu](https://github.com/samueltardieu)

*Managed by `@rustbot`—see
[help](https://forge.rust-lang.org/triagebot/note.html) for details*

<!-- TRIAGEBOT_SUMMARY_END -->
<!-- TRIAGEBOT_END -->
Make `swap_binop()` a method of `HirEqInterExpr`, and use the proper
typeck to check the type of an expression.

changelog: none (fix of a regression, should be backported)

Fixes rust-lang/rust-clippy#16505

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_SUMMARY_START -->

### Summary Notes

-
[Beta-nomination](rust-lang/rust-clippy#16659 (comment))
by [samueltardieu](https://github.com/samueltardieu)

*Managed by `@rustbot`—see
[help](https://forge.rust-lang.org/triagebot/note.html) for details*

<!-- TRIAGEBOT_SUMMARY_END -->
<!-- TRIAGEBOT_END -->
…gression (rust-lang#16652)

Fixes rust-lang/rust-clippy#16605

This PR addresses the 6.2% compilation performance regression introduced
by the original `allow_unwrap_types` implementation (which natively
allocated AST strings on every `unwrap` call via `bumpalo`).

The implementation has been refactored to pre-resolve types securely
without a performance penalty:

**Pre-Resolution Cache via `LateLintPass`**: Instead of executing
`ty.to_string()` and `lookup_path_str` inside the immediate
`unwrap_expect_used` hot check for every method call encountered,
`allow-unwrap-types` configuration strings are now parsed exactly *once*
per crate compilation during the `LateLintPass::check_crate` hook in
`clippy_lints/src/methods/mod.rs`.
**`DefId` Native Storage**: The parsed `DefId` representations are
stored in-memory using highly efficient caching maps directly on the
main `Methods` struct:
- `unwrap_allowed_ids: FxHashSet<DefId>`: Allows instant O(1) lookups
for standard types.
- `unwrap_allowed_aliases: Vec<DefId>`: Tracks type aliases requiring
signature substitution checking later.
**Execution Relief**: Inside `unwrap_expect_used::check()`, string
manipulation is completely removed and `ty::Adt` checking uses
lightning-fast `.contains(&adt.did())` operations to categorically avoid
regression allocation loops. This implementation strongly parallels the
pre-resolution type-routing logic in
`clippy_config::types::create_disallowed_map` without altering the core
`clippy.toml` config requirements.

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_SUMMARY_START -->

### Summary Notes

-
[Beta-nomination](rust-lang/rust-clippy#16652 (comment))
by [samueltardieu](https://github.com/samueltardieu)

*Managed by `@rustbot`—see
[help](https://forge.rust-lang.org/triagebot/note.html) for details*

<!-- TRIAGEBOT_SUMMARY_END -->
<!-- TRIAGEBOT_END -->
changelog: none
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 9, 2026

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. labels Apr 9, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 9, 2026

⚠️ Warning ⚠️

  • Pull requests are usually filed against the main branch for this repo, but this one is against beta. Please double check that you specified the right target!
  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

@Mark-Simulacrum
Copy link
Copy Markdown
Member

r=me once CI is happy

@flip1995 flip1995 changed the title Clippy beta backport [beta] Clippy backport Apr 9, 2026
@cuviper cuviper added this to the 1.95.0 milestone Apr 9, 2026
@cuviper cuviper added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Apr 9, 2026
rust-bors bot pushed a commit that referenced this pull request Apr 9, 2026
[beta] reverts and backports

This reverts two `dbg!` changes to avoid regressions[^1][^2] in the upcoming 1.95 release:

- std: avoid tearing `dbg!` prints #149869
- don't drop arguments' temporaries in `dbg!` #154074
  - ... which was previously backported in #154725

This also reverts a stabilization over a late issue[^3] of semantics:

- Stabilize `assert_matches` #137487

And a few other backport/reverts from `main`:

- Revert performing basic const checks in typeck on stable #154930 / #155033
- Revert "`-Znext-solver` Remove the forced ambiguity hack from search graph" #154712
- Clarify that core::range ranges do not have special syntax #155002

Clippy is backporting 2 ICE fixes and 1 perf regression (via #155051):

- rust-lang/rust-clippy#16685 already backported in #154211 to stable. This makes sure that it doesn't regress again in beta/next stable
- rust-lang/rust-clippy#16659 The ICE that is being fixed here was introduced in the 1.95 release cycle
- rust-lang/rust-clippy#16652 Perf regression introduced in the 1.95 release cycle.
  
[^1]: #153850
[^2]: #154988
[^3]: #154406
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beta-accepted Accepted for backporting to the compiler in the beta channel. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants