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