about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-06-13 13:40:14 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2024-06-20 04:50:38 +1000
commit7d9a92ba31122950f2c7f6a71ad6dee49b3e95e4 (patch)
tree14f587f5aec4a62d91a1747efa0630c0d5d92f0a /compiler/rustc_parse/src/parser
parent894f7a4ba6554d3797404bbf550d9919df060b97 (diff)
downloadrust-7d9a92ba31122950f2c7f6a71ad6dee49b3e95e4.tar.gz
rust-7d9a92ba31122950f2c7f6a71ad6dee49b3e95e4.zip
Inline `can_begin_literal_maybe_minus` call into two places.
It's clearer this way, because the `Interpolated` cases in
`can_begin_const_arg` and `is_pat_range_end_start` are more permissive
than the `Interpolated` cases in `can_begin_literal_maybe_minus`.
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/pat.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs
index 03aea0888d9..6f2b7177159 100644
--- a/compiler/rustc_parse/src/parser/pat.rs
+++ b/compiler/rustc_parse/src/parser/pat.rs
@@ -939,7 +939,8 @@ impl<'a> Parser<'a> {
             || self.look_ahead(dist, |t| {
                 t.is_path_start() // e.g. `MY_CONST`;
                 || t.kind == token::Dot // e.g. `.5` for recovery;
-                || t.can_begin_literal_maybe_minus() // e.g. `42`.
+                || matches!(t.kind, token::Literal(..) | token::BinOp(token::Minus))
+                || t.is_bool_lit()
                 || t.is_whole_expr()
                 || t.is_lifetime() // recover `'a` instead of `'a'`
                 || (self.may_recover() // recover leading `(`