I found these pathlogical examples pass the lexer and the parser:
fn main() {
println!("{}", "Foo"_);
println!("{}", 10._);
}
The reason is that
scan_optional_raw_name eats _, but reports no suffix.
scan_number distinguishes between decimal points and field/method syntax by is_xid_start, which in fact excludes _.
According to the reference, it seems these examples shouldn't be allowed.
Tested on stable (rustc 1.17.0 (56124baa9 2017-04-24)) and nightly (rustc 1.19.0-nightly (6a5fc9eec 2017-05-02)) on the playground.
I found these pathlogical examples pass the lexer and the parser:
The reason is that
scan_optional_raw_nameeats_, but reports no suffix.scan_numberdistinguishes between decimal points and field/method syntax byis_xid_start, which in fact excludes_.According to the reference, it seems these examples shouldn't be allowed.
Tested on stable (
rustc 1.17.0 (56124baa9 2017-04-24)) and nightly (rustc 1.19.0-nightly (6a5fc9eec 2017-05-02)) on the playground.