Add AcceptContext::expect_key_value#155831
Draft
scrabsha wants to merge 1 commit intorust-lang:mainfrom
Draft
Conversation
scrabsha
commented
Apr 26, 2026
This comment has been minimized.
This comment has been minimized.
scrabsha
commented
Apr 26, 2026
scrabsha
commented
Apr 26, 2026
scrabsha
commented
Apr 26, 2026
scrabsha
commented
Apr 26, 2026
| /// there | ||
| /// - `#[doc = "hello"]`: `doc = "hello` is also a name value pair | ||
| pub fn name_value(&self) -> Option<&NameValueParser> { | ||
| pub fn as_name_value(&self) -> Option<&NameValueParser> { |
Contributor
Author
There was a problem hiding this comment.
mention in the PR description:
- how many uses of the
as_name_valueare there in theattributesmodule? - what are they still relevant?
| } | ||
|
|
||
| pub fn meta_item(&self) -> Option<&MetaItemParser> { | ||
| pub fn as_meta_item(&self) -> Option<&MetaItemParser> { |
Contributor
Author
There was a problem hiding this comment.
mention in the PR description:
- how many uses of the
as_name_valueare there in theattributesmodule? - what are they still relevant?
5c6f7cf to
27cefb8
Compare
This comment has been minimized.
This comment has been minimized.
27cefb8 to
1e7d852
Compare
This comment has been minimized.
This comment has been minimized.
1e7d852 to
601b48d
Compare
This comment has been minimized.
This comment has been minimized.
601b48d to
8cc254b
Compare
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
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.
(I would like to do one more self-review, I'm not sure reading right now this is the best use of your time)
This PR adds
AcceptContext::expect_name_valuethat takes any name-value-ish node and returns what's in it (it depends on the node). It follows the same style asAcceptContext::expect_listandAcceptContext::single.As
expect_name_valuetakes care of all the error emission, this allowed to remove any call toAttributeDiagnosticContext::expected_name_valuefrom outsiderustc_attr_parsing::context. The method now private.TODO: PR description:
as_name_valueis still usedas_meta_itemis still used