Skip to content
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 4 commits into from
Apr 1, 2025
Merged

Conversation

nnethercote
Copy link
Contributor

Another step towards #137978.

r? @petrochenkov

@rustbot
Copy link
Collaborator

rustbot commented Mar 28, 2025

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 28, 2025
@nnethercote nnethercote changed the title Reduce kw::Empty usage, part 2 #138347 Reduce kw::Empty usage, part 4 #138347 Mar 28, 2025
@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 28, 2025
@bors

This comment was marked as resolved.

@bors

This comment was marked as resolved.

@nnethercote nnethercote changed the title Reduce kw::Empty usage, part 4 #138347 Reduce kw::Empty usage, part 4 Mar 31, 2025
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.
@nnethercote
Copy link
Contributor Author

@petrochenkov: I have removed the commit that modifies the decode placeholder and rebased.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 31, 2025
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Mar 31, 2025

📌 Commit 2785063 has been approved by petrochenkov

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 31, 2025
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
@bors bors merged commit 2f5d548 into rust-lang:master Apr 1, 2025
6 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 1, 2025
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`
@nnethercote nnethercote deleted the less-kw-Empty-4 branch April 1, 2025 07:49
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants