Skip to content

Commit 4315b85

Browse files
committed
Add back check_inline_const
Needed for range pattern parsing.
1 parent 24fa10f commit 4315b85

File tree

1 file changed

+9
-0
lines changed
  • compiler/rustc_parse/src/parser

1 file changed

+9
-0
lines changed

compiler/rustc_parse/src/parser/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,15 @@ impl<'a> Parser<'a> {
552552
self.check_or_expected(self.token.can_begin_const_arg(), TokenType::Const)
553553
}
554554

555+
fn check_inline_const(&self, dist: usize) -> bool {
556+
self.is_keyword_ahead(dist, &[kw::Const])
557+
&& self.look_ahead(dist + 1, |t| match t.kind {
558+
token::Interpolated(ref nt) => matches!(**nt, token::NtBlock(..)),
559+
token::OpenDelim(DelimToken::Brace) => true,
560+
_ => false,
561+
})
562+
}
563+
555564
/// Checks to see if the next token is either `+` or `+=`.
556565
/// Otherwise returns `false`.
557566
fn check_plus(&mut self) -> bool {

0 commit comments

Comments
 (0)