forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix incorrect gating of nonterminals in key-value attributes
Fixes rust-lang#85432 When processing a `#[derive]` or `#[cfg_eval]` attribute, we need to re-parse our attribute target, which requires flattenting all `Nonterminals`. However, this caused us to incorrectly gate on a (flattented) nonterminal in a key-value attribute, which is supposed to be allowed. Since we already perform this gating during the initial parse, we suppress it in `capture_cfg` mode.
- Loading branch information
1 parent
752c939
commit c05bbb7
Showing
2 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// check-pass | ||
// Regression test for issue #85432 | ||
// Ensures that we don't incorrectly gate nonterminals | ||
// in key-value macros when we need to reparse due to | ||
// the presence of `#[derive]` | ||
|
||
macro_rules! with_doc_comment { | ||
($comment:expr, $item:item) => { | ||
#[doc = $comment] | ||
$item | ||
}; | ||
} | ||
|
||
macro_rules! database_table_doc { | ||
() => { | ||
"" | ||
}; | ||
} | ||
|
||
with_doc_comment! { | ||
database_table_doc!(), | ||
#[derive(Debug)] | ||
struct Image { | ||
#[cfg(FALSE)] | ||
_f: (), | ||
} | ||
|
||
} | ||
|
||
fn main() {} |