-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Reduce kw::Empty usage, part 4 #139039
Merged
Merged
Reduce kw::Empty usage, part 4 #139039
+31
−24
Conversation
This file contains 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
Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred in compiler/rustc_passes/src/check_attr.rs |
blyxyas
reviewed
Mar 28, 2025
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
It makes it clearer that the symbol is unused and doesn't matter.
To use one `kw::Empty` instead of two. It's a little more direct this way, and avoids `kw::Empty` being used for both "no string" and "empty string".
This is part of the implementation of `#[doc(keyword = "match")]` attributes used by `std` to provide documentation for keywords. `is_doc_keyword` currently does a crude keyword range test that's intended to catch all keywords but misses `kw::Yeet`. This commit changes it to use `Symbol` methods, including the new `is_weak` method (required for `union`). `Symbol` methods are much less prone to falling out of date if new keywords are added.
By changing two of the fields to use `Option<Ident>` instead of `Ident`. As a result, `None` now means "no identifier", which is much clearer than using an empty identifier.
c3a1c31
to
2785063
Compare
@petrochenkov: I have removed the commit that modifies the decode placeholder and rebased. @rustbot ready |
@bors r+ |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 1, 2025
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#138426 (Fix `armv7-sony-vita-newlibeabihf` LLVM target triple) - rust-lang#138840 (rustc_resolve: Test the order that preludes are resolved) - rust-lang#139039 (Reduce kw::Empty usage, part 4) - rust-lang#139151 (tidy: properly check for orphaned unstable_book pages) - rust-lang#139176 (Remove fragile equal-pointers-unequal/*/print3.rs tests.) - rust-lang#139179 (Remove me from vacation) - rust-lang#139181 (Fix invalid link in docs) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 1, 2025
Rollup merge of rust-lang#139039 - nnethercote:less-kw-Empty-4, r=petrochenkov Reduce kw::Empty usage, part 4 Another step towards rust-lang#137978. r? `@petrochenkov`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-attributes
Area: Attributes (`#[…]`, `#![…]`)
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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.
Another step towards #137978.
r? @petrochenkov