Skip to content

Commit 4d4baf7

Browse files
committed
Disallow TokenTree::{MetaVar,MetaVarExpr} in matchers.
They should only appear in transcribers.
1 parent 09c3e82 commit 4d4baf7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

compiler/rustc_expand/src/mbe/macro_parser.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,8 @@ fn nameize<I: Iterator<Item = NamedMatch>>(
439439
}
440440
Occupied(..) => return Err((sp, format!("duplicated bind name: {}", bind_name))),
441441
},
442-
// FIXME(c410-f3r) MetaVar and MetaVarExpr should be handled instead of being ignored
443-
// https://github.com/rust-lang/rust/issues/9390
444-
TokenTree::MetaVar(..) | TokenTree::MetaVarExpr(..) | TokenTree::Token(..) => {}
442+
TokenTree::Token(..) => (),
443+
TokenTree::MetaVar(..) | TokenTree::MetaVarExpr(..) => unreachable!(),
445444
}
446445

447446
Ok(())
@@ -655,7 +654,9 @@ fn inner_parse_loop<'root, 'tt>(
655654
// rules. NOTE that this is not necessarily an error unless _all_ items in
656655
// `cur_items` end up doing this. There may still be some other matchers that do
657656
// end up working out.
658-
TokenTree::Token(..) | TokenTree::MetaVar(..) | TokenTree::MetaVarExpr(..) => {}
657+
TokenTree::Token(..) => {}
658+
659+
TokenTree::MetaVar(..) | TokenTree::MetaVarExpr(..) => unreachable!(),
659660
}
660661
}
661662
}

0 commit comments

Comments
 (0)