@@ -126,7 +126,7 @@ impl<'a> Parser<'a> {
126
126
/// ```
127
127
fn recover_colon_before_qpath_proj ( & mut self ) -> bool {
128
128
if !self . check_noexpect ( & TokenKind :: Colon )
129
- || self . look_ahead ( 1 , |t| !t. is_ident ( ) || t . is_reserved_ident ( ) )
129
+ || self . look_ahead ( 1 , |t| !t. is_non_reserved_ident ( ) )
130
130
{
131
131
return false ;
132
132
}
@@ -260,7 +260,7 @@ impl<'a> Parser<'a> {
260
260
if self . may_recover ( )
261
261
&& style == PathStyle :: Expr // (!)
262
262
&& self . token == token:: Colon
263
- && self . look_ahead ( 1 , |token| token. is_ident ( ) && !token . is_reserved_ident ( ) )
263
+ && self . look_ahead ( 1 , |token| token. is_non_reserved_ident ( ) )
264
264
{
265
265
// Emit a special error message for `a::b:c` to help users
266
266
// otherwise, `a: c` might have meant to introduce a new binding
@@ -334,9 +334,7 @@ impl<'a> Parser<'a> {
334
334
self . expect_gt ( ) . map_err ( |mut err| {
335
335
// Try to recover a `:` into a `::`
336
336
if self . token == token:: Colon
337
- && self . look_ahead ( 1 , |token| {
338
- token. is_ident ( ) && !token. is_reserved_ident ( )
339
- } )
337
+ && self . look_ahead ( 1 , |token| token. is_non_reserved_ident ( ) )
340
338
{
341
339
err. cancel ( ) ;
342
340
err = self . dcx ( ) . create_err ( PathSingleColon {
0 commit comments