pub static RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX: &Lint
Expand description
The rust_2021_prefixes_incompatible_syntax
lint detects identifiers that will be parsed as a
prefix instead in Rust 2021.
Example
ⓘ
#![deny(rust_2021_prefixes_incompatible_syntax)]
macro_rules! m {
(z $x:expr) => ();
}
m!(z"hey");
{{produces}}
Explanation
In Rust 2015 and 2018, z"hey"
is two tokens: the identifier z
followed by the string literal "hey"
. In Rust 2021, the z
is
considered a prefix for "hey"
.
This lint suggests to add whitespace between the z
and "hey"
tokens
to keep them separated in Rust 2021.