Skip to content

Commit 8c2da71

Browse files
committed
add test to reproduce #137662 and fix it
1 parent 96cfc75 commit 8c2da71

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

compiler/rustc_attr_parsing/src/parser.rs

+9
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,15 @@ impl<'a> MetaItemListParserContext<'a> {
473473
{
474474
self.inside_delimiters.next();
475475
return Some(MetaItemOrLitParser::Lit(lit));
476+
} else if let Some(TokenTree::Delimited(.., Delimiter::Invisible(_), inner_tokens)) =
477+
self.inside_delimiters.peek()
478+
{
479+
self.inside_delimiters.next();
480+
return MetaItemListParserContext {
481+
inside_delimiters: inner_tokens.iter().peekable(),
482+
dcx: self.dcx,
483+
}
484+
.next();
476485
}
477486

478487
// or a path.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// tests for #137662
2+
//@ check-pass
3+
4+
macro_rules! foo {
5+
{
6+
$repr:ty
7+
} => {
8+
#[repr($repr)]
9+
pub enum Foo {
10+
Bar = 0i32,
11+
}
12+
}
13+
}
14+
15+
foo! {
16+
i32
17+
}
18+
19+
fn main() {}

0 commit comments

Comments
 (0)