8000 macro_rules: `NtLifetime` cannot start with an identifier by petrochenkov · Pull Request #70768 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content
8000

macro_rules: NtLifetime cannot start with an identifier #70768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
macro_rules: NtLifetime cannot start with an identifier
  • Loading branch information
petrochenkov committed Apr 4, 2020
commit 106b30e86989cb4f201ef7a1b7fac7150b662b92
2 changes: 1 addition & 1 deletion src/librustc_expand/mbe/macro_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
Expand Down
13 changes: 13 additions & 0 deletions src/test/ui/macros/issue-70446.rs
Original file line number Diff line number Diff line change
@@ -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() {}
0