Skip to content

Commit e52794d

Browse files
committed
Don't try to eat non-existent decimal digits.
After seeing a `0`, if it's followed by any of `[0-9]`, `_`, `.`, `e`, or `E`, we consume all the digits. But in the `.`, `e` and `E` cases this is pointless because we know there aren't any digits.
1 parent 19967c5 commit e52794d

File tree

1 file changed

+6
-2
lines changed
  • compiler/rustc_lexer/src

1 file changed

+6
-2
lines changed

compiler/rustc_lexer/src/lib.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -604,10 +604,14 @@ impl Cursor<'_> {
604604
return Int { base, empty_int: true };
605605
}
606606
}
607-
// Not a base prefix.
608-
'0'..='9' | '_' | '.' | 'e' | 'E' => {
607+
// Not a base prefix; consume additional digits.
608+
'0'..='9' | '_' => {
609609
self.eat_decimal_digits();
610610
}
611+
612+
// Also not a base prefix; nothing more to do here.
613+
'.' | 'e' | 'E' => {}
614+
611615
// Just a 0.
612616
_ => return Int { base, empty_int: false },
613617
}

0 commit comments

Comments
 (0)