qryxip / cargo-equip

A Cargo subcommand to bundle your code into one `.rs` file for competitive programming
Apache License 2.0
76 stars 10 forks source link

cargo-equip Incompatible minify results with Rust 2021 #194

Closed mizar closed 11 months ago

mizar commented 1 year ago

https://doc.rust-lang.org/reference/tokens.html#reserved-prefixes

Edition Differences: Starting with the 2021 edition, reserved prefixes are reported as an error by the lexer (in particular, they cannot be passed to macros).

Before the 2021 edition, reserved prefixes are accepted by the lexer and interpreted as multiple tokens (for example, one token for the identifier or keyword, followed by a # token).

Examples accepted in all editions:

macro_rules! lexes {($($_:tt)*) => {}}
lexes!{a #foo}
lexes!{continue 'foo}
lexes!{match "..." {}}
lexes!{r#let#foo}         // three tokens: r#let # foo

Examples accepted before the 2021 edition but rejected later:

macro_rules! lexes {($($_:tt)*) => {}}
lexes!{a#foo}
lexes!{continue'foo}
lexes!{match"..." {}}