mbe: Rework the concat metavariable expression#142975
Draft
tgross35 wants to merge 5 commits intorust-lang:mainfrom
Draft
mbe: Rework the concat metavariable expression#142975tgross35 wants to merge 5 commits intorust-lang:mainfrom
concat metavariable expression#142975tgross35 wants to merge 5 commits intorust-lang:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
This was referenced Jun 24, 2025
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Jul 1, 2025
…ation, r=petrochenkov mbe: Add tests and restructure metavariable expressions Add tests that show better diagnostics, and factor `concat` handling to a separate function. Each commit message has further details. This performs the nonfunctional perparation for further changes such as rust-lang#142950 and rust-lang#142975 .
rust-timer
added a commit
that referenced
this pull request
Jul 1, 2025
Rollup merge of #143245 - tgross35:metavariable-expr-organization, r=petrochenkov mbe: Add tests and restructure metavariable expressions Add tests that show better diagnostics, and factor `concat` handling to a separate function. Each commit message has further details. This performs the nonfunctional perparation for further changes such as #142950 and #142975 .
Collaborator
|
☔ The latest upstream changes (presumably #143267) made this pull request unmergeable. Please resolve the merge conflicts. |
b576c49 to
ada588e
Compare
Give a more user-friendly diagnostic about the following:
* Trailing tokens within braces, e.g. `${foo() extra}`
* Missing parentheses, e.g. `${foo}`
* Incorrect number of arguments, with a hint about correct usage.
Change to a structural diagnostic, update the valid list, and move the valid list to a note.
ada588e to
ebcfec9
Compare
The current messages have the potential to be more accurate; "expected identifier or string literal" is printed in a few cases where only an identifier should be expected, and it suggests removing string literals when that might not solve the problem. Add a new diagnostic for these kind of errors that gives more context and a better description. For `count` and `ignore` this should likely be combined with the diagnositcs for `eat_dollar` to produce a helpful error if they get anything other than a metavariable first argument. I am planning to do this in a followup.
* Now accept numbers, chars * Suffixes are stripped (needs more testing) * Report specific locations of errors * TODO: handle idents the same for expanded tokens
ebcfec9 to
0cd1695
Compare
0cd1695 to
e0fbd12
Compare
Collaborator
|
☔ The latest upstream changes (presumably #143721) made this pull request unmergeable. Please resolve the merge conflicts. |
Contributor
Collaborator
|
Reminder, once the PR becomes ready for a review, use |
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.
#142950 plus followup
r? @ghost