Skip to content

Add regression test to cover additional cases - #161412

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
KevinA-cpu:regression-test-53048
Oct 10, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
KevinA-cpu:regression-test-53048

Conversation

@KevinA-cpu

@KevinA-cpu KevinA-cpu commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

closes #53048

  1. Tests to cover rustc_parse\src\parser\mod.rs:187
  • m!(::core::clone::Clone)
  • m!(::), m!(1 + 1), m!(::foo)
  • #[derive(core::clone::Clone)]
  • #[derive(::core::clone::Clone)]
  1. Tests to cover rustc_ast\src\attr\mod.rs
  • m!(a(::b::c))
  1. Others
  • #[derive(Clone, ::core::marker::Copy)] — refutes the issue's implication that only a first list element failed.
  • #[cfg_attr(true, derive(::core::clone::Clone))] pub struct G; — covers the post-expansion re-parse route.

@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 20, 2026
@rustbot

rustbot commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project has assigned @fee1-dead (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks.

Please see the contribution instructions for more information.

Why was this reviewer chosen?

The reviewer was selected based on:

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

@rust-log-analyzer

This comment has been minimized.

@fee1-dead

Copy link
Copy Markdown
Member

r? fmease

@rustbot rustbot assigned fmease and unassigned fee1-dead Aug 26, 2026
@fmease
fmease force-pushed the regression-test-53048 branch from 99d9c1b to 82b821b Compare September 19, 2026 23:25
@rustbot

rustbot commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator

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.

@fmease

fmease commented Sep 19, 2026

Copy link
Copy Markdown
Member

Looks like you fixed the bug underlying the CI failure in PR #162246. I've rebased for you.


macro_rules! m { ($m:meta) => { #[derive($m)] pub struct S; }; }

m!(a(::b::c));

@fmease fmease Sep 19, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Now also exercised in tests/ui/macros/correct-meta-item-span.rs, so I would remove it here (and keep the other one).

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated

// This test ensures that invalid meta item or global path
// is rejected by the compiler.

extern crate core;

@fmease fmease Sep 19, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated

@fmease fmease Sep 19, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would move into the other FAIL test file.

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated

Comment thread tests/ui/macros/meta-item-global-path-issue-53048.rs Outdated
//~^ ERROR expected identifier, found `<eof>`

// a meta item must begin with a path
m!(1 + 1);

@fmease fmease Sep 19, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does not relate to global paths, similarly for the other 3 cases below.

I'm pretty sure that we have preexisting tests that exercise that (at least I'd hope). I would need to go through rg ':\s*meta\b' tests/ui to confirm that.

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks @fmease you're right, I did the rg and found that:

  • tests/ui/macros/macro-meta-items.rs and tests/ui/macros/macro-meta-items-modern.rs already exercise general $meta:meta matching forms.
  • tests/ui/macros/attr-path-metavar-generic-args.rs specifically exercises path/metavariable generic arguments restrictions.
  • tests/ui/parser/attribute/attr-bad-meta-4.rs and related parser tests cover syntax errors on invalid attribute/meta positions.

I will remove those cases

@fmease fmease 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 Sep 19, 2026
@KevinA-cpu

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@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 Oct 5, 2026

@fmease fmease left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for applying my feedback and for your patience!

@bors rollup
@bors r+ squash

View changes since this review

@rust-bors

This comment has been minimized.

* Add regression test to cover additional cases
* Update tests/ui/macros/meta-item-global-path-issue-53048.rs

* refactor: addressing comments

Co-authored-by: Bang Ly <bang.ly@keyloop.com>
Co-authored-by: Heisenburg <kevinanderson1410@gmail.com>
Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
@rust-bors

rust-bors Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

🔨 3 commits were squashed into ec0f940.

@rust-bors
rust-bors Bot force-pushed the regression-test-53048 branch from 052c62b to ec0f940 Compare October 9, 2026 18:06
@rust-bors

rust-bors Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

📌 Commit ec0f940 has been tentatively approved by fmease

It will be put into the queue for this repository once PR CI succeeds.

@rust-bors rust-bors Bot 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 Oct 9, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 9, 2026
…uwer

Rollup of 3 pull requests

Successful merges:

 - #164033 ( rustdoc: check reexport chain if inline before hidden)
 - #161412 (Add regression test to cover additional cases)
 - #164029 (Add a doc-comment for `rustc_ast_pretty::pprust::crate_to_string_for_macros`)
@rust-bors
rust-bors Bot merged commit 5e803f2 into rust-lang:main Oct 10, 2026
14 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 10, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 10, 2026
Rollup merge of #161412 - KevinA-cpu:regression-test-53048, r=fmease

Add regression test to cover additional cases

closes #53048

1. Tests to cover rustc_parse\src\parser\mod.rs:187

- m!(::core::clone::Clone)
- m!(::), m!(1 + 1), m!(<T>::foo)
- #[derive(core::clone::Clone)]
- #[derive(::core::clone::Clone)]

2. Tests to cover rustc_ast\src\attr\mod.rs
- m!(a(::b::c))

3. Others

- #[derive(Clone, ::core::marker::Copy)] — refutes the issue's implication that only a first list element failed.
- #[cfg_attr(true, derive(::core::clone::Clone))] pub struct G; — covers the post-expansion re-parse route.
@KevinA-cpu

Copy link
Copy Markdown
Contributor Author

@fmease thank you for giving me feedback and for your patience as well

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.

MetaItem fails to parse global paths

5 participants