Skip to content
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

Fix wrong source location for some incorrect macro definitions #129154

Merged
merged 1 commit into from
Aug 16, 2024

Conversation

wafarm
Copy link
Contributor

@wafarm wafarm commented Aug 16, 2024

Fixes #95463

Currently the code will consume the next token tree after var when trying to parse $var:some_type even when it's not a : (e.g. a $ when input is ($foo $bar:tt) => {}). Additionally it will return the wrong span when it's not a :.

This PR fixes these problems.

@rustbot
Copy link
Collaborator

rustbot commented Aug 16, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pnkfelix (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@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 Aug 16, 2024
Comment on lines 1 to +5
error: missing fragment specifier
--> $DIR/macro-match-nonterminal.rs:2:8
--> $DIR/macro-match-nonterminal.rs:2:6
|
LL | ($a, $b) => {
| ^
| ^^
Copy link
Contributor

@estebank estebank Aug 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error deserves more context and a structured suggestion (not in this PR).

@estebank
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Aug 16, 2024

📌 Commit e03cc14 has been approved by estebank

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 16, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 16, 2024
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#128990 (Re-enable more debuginfo tests on freebsd)
 - rust-lang#129042 (Special-case alias ty during the delayed bug emission in `try_from_lit`)
 - rust-lang#129086 (Stabilize `is_none_or`)
 - rust-lang#129149 (Migrate `validate_json.py` script to rust in `run-make/rustdoc-map-file` test)
 - rust-lang#129154 (Fix wrong source location for some incorrect macro definitions)
 - rust-lang#129161 (Stabilize std::thread::Builder::spawn_unchecked)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 5bceee4 into rust-lang:master Aug 16, 2024
6 checks passed
@rustbot rustbot added this to the 1.82.0 milestone Aug 16, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Aug 16, 2024
Rollup merge of rust-lang#129154 - wafarm:fix-95463, r=estebank

Fix wrong source location for some incorrect macro definitions

Fixes rust-lang#95463

Currently the code will consume the next token tree after `var` when trying to parse `$var:some_type` even when it's not a `:` (e.g. a `$` when input is `($foo $bar:tt) => {}`). Additionally it will return the wrong span when it's not a `:`.

This PR fixes these problems.
@wafarm wafarm deleted the fix-95463 branch August 17, 2024 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

Confusing source location for "missing fragment specifier"
5 participants