diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-06-04 04:48:08 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-04 04:48:08 +0200 |
| commit | 156351419611f3ee6f6b1327e6021676630e64a8 (patch) | |
| tree | 394818604f165ef372b5aad8d028678c88320a39 /src/libsyntax | |
| parent | fb4652e85f1729412f6298aea033cb26b4755de9 (diff) | |
| parent | 2b27c6235b4feb1e2aaac2dde5c5c67a29470127 (diff) | |
| download | rust-156351419611f3ee6f6b1327e6021676630e64a8.tar.gz rust-156351419611f3ee6f6b1327e6021676630e64a8.zip | |
Rollup merge of #61409 - varkor:condition-trait-param-ice, r=oli-obk
Fix an ICE with a const argument in a trait This goes some way towards fixing https://github.com/rust-lang/rust/issues/61383 (the reduced test case is fixed).
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index f200d3ec8d5..671b313c7f2 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -5244,9 +5244,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()? }; |
