Invalid characters accepted for byte and char literals
Open
- Dominant language
- Rust
- Stars
- 934
- Forks
- 135
- PR merge metrics
- No merged PRs in 30d
Description
Byte and char literals must not contain the characters `'`, `LF`, `CR`, or `TAB`. However, proc-macro2 accepts all of these and parses them as a byte literal.
```rust
use std::str::FromStr;
fn main() {
for input in [
"b'''",
"b'\r'",
"b'\n'",
"b'\t'",
] {
println!("{:?}", proc_macro2::TokenStream::from_str(input));
}
}
```
Checked [here](https://github.com/rust-lang/literal-escaper/blob/637cc2e289f081b77c3d46ac934932024fb6e19e/src/lib.rs#L326-L337) I believe.
Using `proc-macro2 1.0.106`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.