Skip to content

rustc_expand: improve diagnostics for non-repeatable metavars#154014

Open
Unique-Usman wants to merge 1 commit intorust-lang:mainfrom
Unique-Usman:ua/decmacrounrepeatable2
Open

rustc_expand: improve diagnostics for non-repeatable metavars#154014
Unique-Usman wants to merge 1 commit intorust-lang:mainfrom
Unique-Usman:ua/decmacrounrepeatable2

Conversation

@Unique-Usman
Copy link
Contributor

@Unique-Usman Unique-Usman commented Mar 17, 2026

There was an initally opened pr which solve this issue here #152679. It got merged but, there was a perf regression. And this new pr is opened to address the problem. The first did the computation of binding and matched_rule and then passed them as owned value down to diagnostics::emit_frag_parse_err( but, now this pr address the issue by passing lhs and rules as borrowed value to from_tts and the move the logic to diagnostics::emit_frag_parse_err(.

Fix #47452.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 17, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 17, 2026

r? @adwinwhite

rustbot has assigned @adwinwhite.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 69 candidates
  • Random selection from 15 candidates

@Unique-Usman
Copy link
Contributor Author

r? @estebank

@rustbot rustbot assigned estebank and unassigned adwinwhite Mar 17, 2026
@Unique-Usman Unique-Usman marked this pull request as draft March 17, 2026 21:04
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 17, 2026
@rust-log-analyzer

This comment has been minimized.

@Unique-Usman Unique-Usman force-pushed the ua/decmacrounrepeatable2 branch from a2e1edc to 1bfa30d Compare March 19, 2026 06:30
@rust-log-analyzer

This comment has been minimized.

@Unique-Usman Unique-Usman marked this pull request as ready for review March 23, 2026 17:21
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 23, 2026
@estebank
Copy link
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 23, 2026
rust-bors bot pushed a commit that referenced this pull request Mar 23, 2026
rustc_expand: improve diagnostics for non-repeatable metavars
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 23, 2026

☀️ Try build successful (CI)
Build commit: c7819c5 (c7819c57c7c6744e29582575ea34a29d6e8a3905, parent: 13e2abaac846b2680ae93e1b3bd9fe7fe1b9a7fe)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c7819c5): comparison URL.

Overall result: ❌ regressions - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.2% [0.2%, 0.2%] 6
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.2% [0.2%, 0.2%] 6

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results (secondary -0.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.9% [1.9%, 1.9%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.9% [-2.9%, -2.9%] 1
All ❌✅ (primary) - - 0

Binary size

Results (primary 0.1%, secondary 0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.1% [0.0%, 0.1%] 55
Regressions ❌
(secondary)
0.1% [0.0%, 0.2%] 24
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [0.0%, 0.1%] 55

Bootstrap: 482.731s -> 482.467s (-0.05%)
Artifact size: 396.84 MiB -> 396.93 MiB (0.02%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Mar 23, 2026
@estebank
Copy link
Contributor

The regressions here are all in html5ever. I think this should be fine.

@Unique-Usman could you provide a description, a link to the previous PR and squash the commits?

@Unique-Usman
Copy link
Contributor Author

@estebank, I will do that. Thanks.

Co-authored-by: Esteban Küber <esteban@kuber.com.ar>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
@Unique-Usman Unique-Usman force-pushed the ua/decmacrounrepeatable2 branch from 35d11f3 to ed4a1f8 Compare March 24, 2026 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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.

macro_rules: "no syntax variables matched as repeating at this depth" fires before "unknown macro variable"

6 participants