-
-
Notifications
You must be signed in to change notification settings - Fork 133
Open
Description
Binary, octal, and hex literals immediately followed by a . (and then not followed by . _ or XID_Start) are reserved and generate a parse error, but proc-macro2 is accepting them (generally as three separate tokens).
use std::str::FromStr;
fn main() {
for input in [
"0b101.010",
"0x567.89",
"0o123.45",
] {
println!("{:?}", proc_macro2::TokenStream::from_str(input));
}
}outputs:
Ok(TokenStream [Literal { lit: 0b101 }, Punct { char: '.', spacing: Alone }, Literal { lit: 010 }])
Ok(TokenStream [Literal { lit: 0x567 }, Punct { char: '.', spacing: Alone }, Literal { lit: 89 }])
Ok(TokenStream [Literal { lit: 0o123 }, Punct { char: '.', spacing: Alone }, Literal { lit: 45 }])
but I would expect it to be a parse error.
Checked here in the compiler. It parses them as floats, and then later checks the base.
Using proc-macro2 1.0.106.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels