about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-05-31 21:18:43 +0100
committervarkor <github@varkor.com>2019-06-03 09:59:45 +0100
commit2b27c6235b4feb1e2aaac2dde5c5c67a29470127 (patch)
tree41faa50b78aa59dc7964ef7ea2f4391df0f1dd19 /src/libsyntax/parse
parent2be25e93addf6f5dc64bc033be8636e3028082fa (diff)
downloadrust-2b27c6235b4feb1e2aaac2dde5c5c67a29470127.tar.gz
rust-2b27c6235b4feb1e2aaac2dde5c5c67a29470127.zip
Allow `true` and `false` in const generic arguments
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 746e9cad496..a562d2a1d2b 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -5250,9 +5250,13 @@ impl<'a> Parser<'a> {
                     // FIXME(const_generics): to distinguish between idents for types and consts,
                     // we should introduce a GenericArg::Ident in the AST and distinguish when
                     // lowering to the HIR. For now, idents for const args are not permitted.
-                    return Err(
-                        self.fatal("identifiers may currently not be used for const generics")
-                    );
+                    if self.token.is_keyword(kw::True) || self.token.is_keyword(kw::False) {
+                        self.parse_literal_maybe_minus()?
+                    } else {
+                        return Err(
+                            self.fatal("identifiers may currently not be used for const generics")
+                        );
+                    }
                 } else {
                     self.parse_literal_maybe_minus()?
                 };