Rollup merge of #70768 - petrochenkov:macambig, r=Centril,mark-i-m
macro_rules: `NtLifetime` cannot start with an identifier Fixes https://github.com/rust-lang/rust/issues/70446
This commit is contained in:
commit
d0dda18bd1
@ -768,7 +768,7 @@ fn may_begin_with(token: &Token, name: Name) -> bool {
|
||||
/// Checks whether the non-terminal may contain a single (non-keyword) identifier.
|
||||
fn may_be_ident(nt: &token::Nonterminal) -> bool {
|
||||
match *nt {
|
||||
token::NtItem(_) | token::NtBlock(_) | token::NtVis(_) => false,
|
||||
token::NtItem(_) | token::NtBlock(_) | token::NtVis(_) | token::NtLifetime(_) => false,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
|
13
src/test/ui/macros/issue-70446.rs
Normal file
13
src/test/ui/macros/issue-70446.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// check-pass
|
||||
|
||||
macro_rules! foo {
|
||||
($(: $p:path)? $(: $l:lifetime)? ) => { bar! {$(: $p)? $(: $l)? } };
|
||||
}
|
||||
|
||||
macro_rules! bar {
|
||||
($(: $p:path)? $(: $l:lifetime)? ) => {};
|
||||
}
|
||||
|
||||
foo! {: 'a }
|
||||
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user