Add AcceptContext::expect_no_args#156037
Open
scrabsha wants to merge 1 commit intorust-lang:mainfrom
Open
Conversation
846e90c to
f77fc05
Compare
Contributor
|
The problem with |
Contributor
Author
|
Absolutely. I would LOVE opening a PR that essentially removes every call to r? JonathanBrouwer |
Collaborator
|
Some changes occurred in compiler/rustc_attr_parsing |
JonathanBrouwer
approved these changes
May 1, 2026
Contributor
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
May 1, 2026
…, r=JonathanBrouwer Add AcceptContext::expect_no_args
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.
This PR adds
AcceptContext::expect_no_argsthat follows the same style as what was added in #155696 and #155831 (albeit much smaller this time).AttributeDiagnosticContext::expected_no_argsinproc_macro_attrs:136and I have no idea how to remove it. Any suggestion on what to replace this call with is welcome :)ArgParser::no_argsstill remain in places where we emit custom errors. They show up in the diff due to theno_args->as_no_argsrenaming.I did a little experiment in which I made
AcceptContext::expect_no_argsunconditionally returnSome(())so parsing always continues, but it led to lots of gibberish errors being emitted. Full diff for this is available here: expect_no_args_experiment.patch. This means there's no simple way to get rid of thelet _ = cx.expect_no_args(/* ... */);and I am not super happy with that.