Replace interning of string literals with preinterned symbols#14650
Merged
y21 merged 1 commit intorust-lang:masterfrom Apr 21, 2025
Merged
Replace interning of string literals with preinterned symbols#14650y21 merged 1 commit intorust-lang:masterfrom
y21 merged 1 commit intorust-lang:masterfrom
Conversation
Collaborator
113528c to
4a9bbbe
Compare
4a9bbbe to
b52bd96
Compare
y21
approved these changes
Apr 21, 2025
Member
y21
left a comment
There was a problem hiding this comment.
This is a really nice change, so good that we can preintern our own symbols now 👍
2 tasks
2 tasks
github-merge-queue bot
pushed a commit
that referenced
this pull request
May 5, 2025
The `&[&str]` path based `clippy_utils` have been removed and replace with a new type `PathLookup`: - [`match_trait_method`](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/fn.match_trait_method.html) - [`match_qpath`](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/fn.match_qpath.html) - [`match_path`](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/fn.match_path.html) - [`match_any_def_paths`](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/fn.match_any_def_paths.html) - [`match_def_path`](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/fn.match_def_path.html) - [`match_type`](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/ty/fn.match_type.html) - [`get_trait_def_id`](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/fn.get_trait_def_id.html) Internally `PathLookup` is a lazy call to `lookup_path` (the new name for [`def_path_res`](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/fn.def_path_res.html) to distinguish it from [`path_res`](https://doc.rust-lang.org/nightly/nightly-rustc/clippy_utils/fn.path_res.html)) The `invalid_paths` internal lint is removed, it could be reimplemented but it feels redundant since every path should be covered by a test anyway ### User facing changes - `manual_saturating_arithmetic` now checks for `u32::MAX/MIN` instead of only detecting the legacy numeric consts (`std::u32::MAX/MIN`), `clippy::legacy_numeric_constants` will redirect usages of the legacy versions to the new one - `allow-invalid = true` now suppresses all invalid path warnings, currently you can run into a warning that can't be ignored in some situations, e.g. with `serde` without the `derive` feature ``` warning: expected a macro, found a trait --> /home/gh-Alexendoo/temp/clippy.toml:2:5 | 2 | { path = "serde::Serialize", allow-invalid = true }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` - Re-exports of primitives types like `std::primitive::*` no longer work in `disallowed-types`, this seems acceptable since it would be unusual to deny a primitive this way rather than writing e.g. `usize`. Type aliases such as `c_char` are unaffected - A similar slight performance improvement to #14650 ```bash $ hyperfine -w 2 -p 'touch src/cargo/lib.rs' 'cargo +master clippy' 'cargo +lazy-paths clippy' ``` ``` Benchmark 1: cargo +master clippy Time (mean ± σ): 6.829 s ± 0.064 s [User: 6.079 s, System: 0.673 s] Range (min … max): 6.705 s … 6.907 s 10 runs Benchmark 2: cargo +lazy-paths clippy Time (mean ± σ): 6.765 s ± 0.064 s [User: 5.984 s, System: 0.698 s] Range (min … max): 6.636 s … 6.834 s 10 runs Summary cargo +lazy-paths clippy ran 1.01 ± 0.01 times faster than cargo +master clippy ``` changelog: none
BD103
added a commit
to TheBevyFlock/bevy_cli
that referenced
this pull request
Jun 24, 2025
It was removed in rust-lang/rust-clippy#14650. We can either call `Symbol::intern()` manually (which is what this commit does), or use the new preinterned symbol system (https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/interface/struct.Config.html#structfield.extra_symbols).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On rust-lang/cargo@8ddf367 it's a slight improvement
Part 1 of removing
Symbol <-> strconversionschangelog: none