@@ -571,6 +571,7 @@ impl<'a> Parser<'a> {
571
571
// integer literal (e.g. `1:42`), it's likely a range
572
572
// expression for Pythonistas and we can suggest so.
573
573
if self . prev_token . is_integer_lit ( )
574
+ && self . may_recover ( )
574
575
&& self . look_ahead ( 1 , |token| token. is_integer_lit ( ) )
575
576
{
576
577
// FIXME(hkmatsumoto): Might be better to trigger
@@ -581,22 +582,22 @@ impl<'a> Parser<'a> {
581
582
".." ,
582
583
Applicability :: MaybeIncorrect ,
583
584
) ;
584
- }
585
-
586
- // if next token is following a colon, it's likely a path
587
- // and we can suggest a path separator
588
- self . bump ( ) ;
589
- if self . token . span . lo ( ) == self . prev_token . span . hi ( ) {
590
- err . span_suggestion_verbose (
591
- self . prev_token . span ,
592
- "maybe write a path separator here ",
593
- "::" ,
594
- Applicability :: MaybeIncorrect ,
595
- ) ;
596
- }
597
- if self . sess . unstable_features . is_nightly_build ( ) {
598
- // FIXME(Nilstrieb): Remove this again after a few months.
599
- err . note ( "type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>" ) ;
585
+ } else {
586
+ // if next token is following a colon, it's likely a path
587
+ // and we can suggest a path separator
588
+ self . bump ( ) ;
589
+ if self . token . span . lo ( ) == self . prev_token . span . hi ( ) {
590
+ err . span_suggestion_verbose (
591
+ self . prev_token . span ,
592
+ "maybe write a path separator here" ,
593
+ ":: ",
594
+ Applicability :: MaybeIncorrect ,
595
+ ) ;
596
+ }
597
+ if self . sess . unstable_features . is_nightly_build ( ) {
598
+ // FIXME(Nilstrieb): Remove this again after a few months.
599
+ err . note ( "type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>" ) ;
600
+ }
600
601
}
601
602
}
602
603
0 commit comments