mbe: Rework the concat metavariable expression by tgross35 · Pull Request #142975 · rust-lang/rust (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation5 Commits5 Checks11 Files changed
Conversation
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
[ Show hidden characters]({{ revealButtonHref }})
Area: The tidy tool
Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
This comment has been minimized.
This was referenced
Jun 24, 2025
petrochenkov added the S-blocked
Status: Blocked on something else such as an RFC or other implementation work.
label
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
…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
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 .
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.
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
Status: Blocked on something else such as an RFC or other implementation work.
label
Reminder, once the PR becomes ready for a review, use @rustbot ready.
rustbot added the S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
label
Labels
Area: The tidy tool
Silences rust-log-analyzer postings to the PR it's added on.
Status: This is awaiting some action (such as code changes or more information) from the author.
Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Relevant to the compiler team, which will review and decide on the PR/issue.