Invalid integer literals are accepted
- Dominant language
- Rust
- Stars
- 934
- Forks
- 135
- PR merge metrics
- No merged PRs in 30d
Description
Integer literals with suffix starting with `e` are accepted by `proc_macro2` but not by `proc_macro` or Rust compiler.
```Rust
let _: TokenStream = "0einvalidSuffix".parse().unwrap();
```
This parses with `proc_macro2` but panics with `proc_macro`.
Such literals are also rejected by Rust compiler: [playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=1c68cdc180ae546a281af81d4ff27870).
According to Rust reference [INTEGER_LITERAL](https://doc.rust-lang.org/stable/reference/tokens.html#railroad-INTEGER_LITERAL) must end with [SUFFIX_NO_E](https://doc.rust-lang.org/stable/reference/tokens.html#railroad-SUFFIX_NO_E).
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue with the shown `TokenStream` `.parse()` entry point and compare its result with `proc_macro` and the Rust compiler. Trace how integer literals and suffixes are parsed, then verify that `0einvalidSuffix` is rejected consistently with the Rust reference grammar.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100