dtolnay / dtolnay/proc-macro2

Invalid underscore suffix is accepted

Open
#532 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
934
Forks
135
PR merge metrics
No merged PRs in 30d

Description

The literal suffix cannot be a bare underscore, but proc-macro2 is accepting the following:

```rust
use std::str::FromStr;

fn main() {
for input in [
"'x'_",
"\"s\"_",
"r#\"s\"#_",
] {
println!("{:?}", proc_macro2::TokenStream::from_str(input));
}
}
```

This was an FCW (https://github.com/rust-lang/rust/issues/42326) but was made a hard error in 1.67 (https://github.com/rust-lang/rust/pull/103914).

Using `proc-macro2 1.0.106`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.