pub static RUST_2024_GUARDED_STRING_INCOMPATIBLE_SYNTAX: &Lint
Expand description
The rust_2024_guarded_string_incompatible_syntax
lint detects #
tokens
that will be parsed as part of a guarded string literal in Rust 2024.
§Example
ⓘ
#![deny(rust_2024_guarded_string_incompatible_syntax)]
macro_rules! m {
(# $x:expr #) => ();
(# $x:expr) => ();
}
m!(#"hey"#);
m!(#"hello");
{{produces}}
§Explanation
Prior to Rust 2024, #"hey"#
is three tokens: the first #
followed by the string literal "hey"
then the final #
.
In Rust 2024, the whole sequence is considered a single token.
This lint suggests to add whitespace between the leading #
and the string to keep them separated in Rust 2024.