diff options
| author | Camelid <camelidcamel@gmail.com> | 2020-12-17 13:51:20 -0800 |
|---|---|---|
| committer | Camelid <camelidcamel@gmail.com> | 2020-12-17 13:58:56 -0800 |
| commit | d6f1787447e1132d929efbb5b772be232e336c23 (patch) | |
| tree | f02ac3dcf0018cfdcf48a704ebfc6b3330724b2e /compiler/rustc_parse/src/parser | |
| parent | b32e6e6ac8921035177256ab6806e6ab0d4b9b94 (diff) | |
| download | rust-d6f1787447e1132d929efbb5b772be232e336c23.tar.gz rust-d6f1787447e1132d929efbb5b772be232e336c23.zip | |
Don't allow `const` to begin a nonterminal
Thanks to Vadim Petrochenkov who [told me what the fix was][z]! [z]: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/finding.20which.20macro.20rule.20to.20use/near/220240422
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/nonterminal.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/nonterminal.rs b/compiler/rustc_parse/src/parser/nonterminal.rs index c007f96a798..76ad5acd530 100644 --- a/compiler/rustc_parse/src/parser/nonterminal.rs +++ b/compiler/rustc_parse/src/parser/nonterminal.rs @@ -27,6 +27,8 @@ impl<'a> Parser<'a> { token.can_begin_expr() // This exception is here for backwards compatibility. && !token.is_keyword(kw::Let) + // This exception is here for backwards compatibility. + && !token.is_keyword(kw::Const) } NonterminalKind::Ty => token.can_begin_type(), NonterminalKind::Ident => get_macro_ident(token).is_some(), |
