Repository navigation
Add regression test to cover additional cases - #161412
Conversation
|
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:
|
This comment has been minimized.
This comment has been minimized.
|
r? fmease |
99d9c1b to
82b821b
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. |
|
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)); |
There was a problem hiding this comment.
Now also exercised in tests/ui/macros/correct-meta-item-span.rs, so I would remove it here (and keep the other one).
| // This test ensures that invalid meta item or global path | ||
| // is rejected by the compiler. | ||
|
|
||
| extern crate core; |
There was a problem hiding this comment.
Not needed IINM.
There was a problem hiding this comment.
I would move into the other FAIL test file.
| //~^ ERROR expected identifier, found `<eof>` | ||
|
|
||
| // a meta item must begin with a path | ||
| m!(1 + 1); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
|
@rustbot ready |
This comment has been minimized.
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>
|
🔨 3 commits were squashed into ec0f940. |
052c62b to
ec0f940
Compare
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.
|
@fmease thank you for giving me feedback and for your patience as well |
closes #53048