Skip to content

mbe: Rework the concat metavariable expression #142975

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

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

tgross35
Copy link
Contributor

@tgross35 tgross35 commented Jun 24, 2025

#142950 plus followup

r? @ghost

@rustbot rustbot added A-tidy Area: The tidy tool T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 24, 2025
@rust-log-analyzer

This comment has been minimized.

@tgross35 tgross35 added the rla-silenced Silences rust-log-analyzer postings to the PR it's added on. label Jun 24, 2025
@petrochenkov petrochenkov self-assigned this Jun 30, 2025
@petrochenkov petrochenkov added the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label Jun 30, 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 .
@bors
Copy link
Collaborator

bors commented Jul 1, 2025

☔ The latest upstream changes (presumably #143267) made this pull request unmergeable. Please resolve the merge conflicts.

tgross35 added 5 commits July 4, 2025 01:18
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 some more context.

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.
Give a more user-friendly diagnostic about the following:

* Invalid syntax within the `${...}` braces, including missing
  parentheses or trailing tokens.
* Incorrect number of arguments passed to specific metavariable
  expressions.
* Now accept numbers, chars
* Suffixes are stripped (needs more testing)
* Report specific locations of errors
* TODO: handle idents the same for expanded tokens
@tgross35 tgross35 force-pushed the metavariable-expr-rework-concat branch from b576c49 to ada588e Compare July 4, 2025 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tidy Area: The tidy tool rla-silenced Silences rust-log-analyzer postings to the PR it's added on. S-blocked Status: Blocked on something else such as an RFC or other implementation work. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants