Static rustc_lint_defs::builtin::RESERVED_PREFIX[−][src]

pub static RESERVED_PREFIX: &Lint
Expand description

The reserved_prefix lint detects identifiers that will be parsed as a prefix instead in Rust 2021.

Example

ⓘ
#![deny(reserved_prefix)]

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.