rustc_expand: improve diagnostics for non-repeatable metavars#152679
rustc_expand: improve diagnostics for non-repeatable metavars#152679rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Conversation
|
r? @BoxyUwU rustbot has assigned @BoxyUwU. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
r? @estebank |
|
This is rebased on top of ->791ee34 |
This comment has been minimized.
This comment has been minimized.
0fbe120 to
81f68bb
Compare
This comment has been minimized.
This comment has been minimized.
81f68bb to
60060dd
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
9704509 to
d4e8858
Compare
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Esteban Küber <esteban@kuber.com.ar> Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
d4e8858 to
93b9973
Compare
|
@estebank - this is ready to land. Thank you for the review. |
|
@bors r+ |
|
this #47452 should be closed now ? |
|
Updated the description so that when the PR merges the ticket gets autoclosed. |
…le, r=estebank rustc_expand: improve diagnostics for non-repeatable metavars Fix rust-lang#47452.
Rollup of 8 pull requests Successful merges: - #149169 (ptr::replace: make calls on ZST null ptr not UB) - #150562 (Fix doc link used in suggestion for pinning self) - #152679 (rustc_expand: improve diagnostics for non-repeatable metavars) - #153017 (Implement debuginfo for unsafe binder types) - #152868 (delete some very old trivial `Box` tests) - #152922 (rustc_public: Make fields that shouldn't be exposed visible only in `rustc_public`) - #153029 (Rename `rustc::pass_by_value` lint as `rustc::disallowed_pass_by_ref`.) - #153051 (Migration of `LintDiagnostic` - part 3)
Rollup of 12 pull requests Successful merges: - #149169 (ptr::replace: make calls on ZST null ptr not UB) - #150562 (Fix doc link used in suggestion for pinning self) - #152418 (`BTreeMap::merge` optimized) - #152679 (rustc_expand: improve diagnostics for non-repeatable metavars) - #152952 (mGCA: improve ogca diagnostic message ) - #152977 (Fix relative path handling for --extern-html-root-url) - #153017 (Implement debuginfo for unsafe binder types) - #152868 (delete some very old trivial `Box` tests) - #152922 (rustc_public: Make fields that shouldn't be exposed visible only in `rustc_public`) - #153032 (Fix attribute parser and kind names.) - #153051 (Migration of `LintDiagnostic` - part 3) - #153060 (Give a better error when updating a submodule fails)
|
@rust-timer build 2f7d51a For #153074. |
|
Missing artifact for sha |
|
@rust-timer build 2f7d51a |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (2f7d51a): comparison URL. Overall result: ❌ regressions - please read the text belowBenchmarking 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 @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 1.7%, secondary -4.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.2%, secondary -1.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 482.035s -> 479.929s (-0.44%) |
|
Oof, that's a significant regression :c |
|
Seems like there might be room for improvement here, e.g. merge the two |
|
Created a revert PR here: #153095 |
|
Yes, lets revert and clean up. |
| let mut bindings = vec![]; | ||
| for rule in rules { | ||
| let MacroRule::Func { lhs, .. } = rule else { continue }; | ||
| for param in lhs { | ||
| let MatcherLoc::MetaVarDecl { bind, .. } = param else { continue }; | ||
| bindings.push(*bind); | ||
| } | ||
| } | ||
|
|
||
| let mut matched_rule_bindings = vec![]; | ||
| for param in lhs { | ||
| let MatcherLoc::MetaVarDecl { bind, .. } = param else { continue }; | ||
| matched_rule_bindings.push(*bind); | ||
| } |
There was a problem hiding this comment.
Without closely looking at the lifetimes, it might be that we can pass lhs and rules to from_tts and move this logic to the error code path.
View all comments
Fix #47452.