-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Remove Ident::empty
#140252
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
base: master
Are you sure you want to change the base?
Remove Ident::empty
#140252
Conversation
ccb01ef
to
3e46e7b
Compare
Helps with #137978. |
3e46e7b
to
889e4c6
Compare
fmease is on vacation. Please choose another assignee. |
Some changes occurred in compiler/rustc_attr_parsing |
Oh, the first commit here is from #140095 and doesn't need to be reviewed; this PR shouldn't be merged until that one has been. |
r=me when the other PR landed @bors reviewed |
889e4c6
to
e7efeff
Compare
☔ The latest upstream changes (presumably #140388) made this pull request unmergeable. Please resolve the merge conflicts. |
As part of this, streamline a bunch of related stuff: - Introduce `PathParser::word_sym`, as an alternative to `PathParser::word`. - Remove `MetaItemParser::path`, and just get the two parsers one at a time. - Rename `MetaItemParser::path_without_args` as `MetaItemParser::path`, and avoid the clone. - Inline and remove `MetaItemParser::word_without_args`, which has a single use. - Remove `MetaItemParser::word_or_empty_without_args`, which has a single use. - Remove `MetaItemParser::path_is`, which is unused. - Remove `MetaItemListParser::all_{word,path}_list`, which are unused.
All uses have been removed. And it's nonsensical: an identifier by definition has at least one char. The commits adds an is-non-empty assertion to `Ident::new` to enforce this, and converts some `Ident` constructions to use `Ident::new`. Adding the assertion requires making `Ident::new` and `Ident::with_dummy_span` non-const, which is no great loss. The commit amends a couple of places that do path splitting to ensure no empty identifiers are created.
e7efeff
to
40952d7
Compare
All uses have been removed. And it's nonsensical: an identifier by definition has at least one char.
r? @oli-obk