Rename reserved_prefix lint to reserved_prefixes
This commit is contained in:
parent
ecca9a8b1a
commit
6c87772e3c
@ -2973,7 +2973,7 @@ declare_lint_pass! {
|
|||||||
RUST_2021_INCOMPATIBLE_OR_PATTERNS,
|
RUST_2021_INCOMPATIBLE_OR_PATTERNS,
|
||||||
LARGE_ASSIGNMENTS,
|
LARGE_ASSIGNMENTS,
|
||||||
FUTURE_PRELUDE_COLLISIONS,
|
FUTURE_PRELUDE_COLLISIONS,
|
||||||
RESERVED_PREFIX,
|
RESERVED_PREFIXES,
|
||||||
UNSUPPORTED_CALLING_CONVENTIONS,
|
UNSUPPORTED_CALLING_CONVENTIONS,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -3270,13 +3270,13 @@ declare_lint! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare_lint! {
|
declare_lint! {
|
||||||
/// The `reserved_prefix` lint detects identifiers that will be parsed as a
|
/// The `reserved_prefixes` lint detects identifiers that will be parsed as a
|
||||||
/// prefix instead in Rust 2021.
|
/// prefix instead in Rust 2021.
|
||||||
///
|
///
|
||||||
/// ### Example
|
/// ### Example
|
||||||
///
|
///
|
||||||
/// ```rust,compile_fail
|
/// ```rust,compile_fail
|
||||||
/// #![deny(reserved_prefix)]
|
/// #![deny(reserved_prefixes)]
|
||||||
///
|
///
|
||||||
/// macro_rules! m {
|
/// macro_rules! m {
|
||||||
/// (z $x:expr) => ();
|
/// (z $x:expr) => ();
|
||||||
@ -3295,7 +3295,7 @@ declare_lint! {
|
|||||||
///
|
///
|
||||||
/// This lint suggests to add whitespace between the `z` and `"hey"` tokens
|
/// This lint suggests to add whitespace between the `z` and `"hey"` tokens
|
||||||
/// to keep them separated in Rust 2021.
|
/// to keep them separated in Rust 2021.
|
||||||
pub RESERVED_PREFIX,
|
pub RESERVED_PREFIXES,
|
||||||
Allow,
|
Allow,
|
||||||
"identifiers that will be parsed as a prefix in Rust 2021",
|
"identifiers that will be parsed as a prefix in Rust 2021",
|
||||||
@future_incompatible = FutureIncompatibleInfo {
|
@future_incompatible = FutureIncompatibleInfo {
|
||||||
|
@ -4,7 +4,7 @@ use rustc_ast::tokenstream::{Spacing, TokenStream};
|
|||||||
use rustc_errors::{error_code, Applicability, DiagnosticBuilder, FatalError, PResult};
|
use rustc_errors::{error_code, Applicability, DiagnosticBuilder, FatalError, PResult};
|
||||||
use rustc_lexer::unescape::{self, Mode};
|
use rustc_lexer::unescape::{self, Mode};
|
||||||
use rustc_lexer::{Base, DocStyle, RawStrError};
|
use rustc_lexer::{Base, DocStyle, RawStrError};
|
||||||
use rustc_session::lint::builtin::RESERVED_PREFIX;
|
use rustc_session::lint::builtin::RESERVED_PREFIXES;
|
||||||
use rustc_session::lint::BuiltinLintDiagnostics;
|
use rustc_session::lint::BuiltinLintDiagnostics;
|
||||||
use rustc_session::parse::ParseSess;
|
use rustc_session::parse::ParseSess;
|
||||||
use rustc_span::symbol::{sym, Symbol};
|
use rustc_span::symbol::{sym, Symbol};
|
||||||
@ -526,7 +526,7 @@ impl<'a> StringReader<'a> {
|
|||||||
} else {
|
} else {
|
||||||
// Before Rust 2021, only emit a lint for migration.
|
// Before Rust 2021, only emit a lint for migration.
|
||||||
self.sess.buffer_lint_with_diagnostic(
|
self.sess.buffer_lint_with_diagnostic(
|
||||||
&RESERVED_PREFIX,
|
&RESERVED_PREFIXES,
|
||||||
prefix_span,
|
prefix_span,
|
||||||
ast::CRATE_NODE_ID,
|
ast::CRATE_NODE_ID,
|
||||||
&msg,
|
&msg,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// run-rustfix
|
// run-rustfix
|
||||||
// compile-flags: -Z unstable-options --edition 2018
|
// compile-flags: -Z unstable-options --edition 2018
|
||||||
|
|
||||||
#![warn(reserved_prefix)]
|
#![warn(reserved_prefixes)]
|
||||||
|
|
||||||
macro_rules! m2 {
|
macro_rules! m2 {
|
||||||
($a:tt $b:tt) => {};
|
($a:tt $b:tt) => {};
|
||||||
@ -14,16 +14,16 @@ macro_rules! m3 {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
m2!(z "hey");
|
m2!(z "hey");
|
||||||
//~^ WARNING prefix `z` is unknown [reserved_prefix]
|
//~^ WARNING prefix `z` is unknown [reserved_prefixes]
|
||||||
//~| WARNING hard error in Rust 2021
|
//~| WARNING hard error in Rust 2021
|
||||||
m2!(prefix "hey");
|
m2!(prefix "hey");
|
||||||
//~^ WARNING prefix `prefix` is unknown [reserved_prefix]
|
//~^ WARNING prefix `prefix` is unknown [reserved_prefixes]
|
||||||
//~| WARNING hard error in Rust 2021
|
//~| WARNING hard error in Rust 2021
|
||||||
m3!(hey #123);
|
m3!(hey #123);
|
||||||
//~^ WARNING prefix `hey` is unknown [reserved_prefix]
|
//~^ WARNING prefix `hey` is unknown [reserved_prefixes]
|
||||||
//~| WARNING hard error in Rust 2021
|
//~| WARNING hard error in Rust 2021
|
||||||
m3!(hey #hey);
|
m3!(hey #hey);
|
||||||
//~^ WARNING prefix `hey` is unknown [reserved_prefix]
|
//~^ WARNING prefix `hey` is unknown [reserved_prefixes]
|
||||||
//~| WARNING hard error in Rust 2021
|
//~| WARNING hard error in Rust 2021
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,6 +33,6 @@ macro_rules! quote {
|
|||||||
|
|
||||||
quote! {
|
quote! {
|
||||||
#name = #kind #value
|
#name = #kind #value
|
||||||
//~^ WARNING prefix `kind` is unknown [reserved_prefix]
|
//~^ WARNING prefix `kind` is unknown [reserved_prefixes]
|
||||||
//~| WARNING hard error in Rust 2021
|
//~| WARNING hard error in Rust 2021
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// run-rustfix
|
// run-rustfix
|
||||||
// compile-flags: -Z unstable-options --edition 2018
|
// compile-flags: -Z unstable-options --edition 2018
|
||||||
|
|
||||||
#![warn(reserved_prefix)]
|
#![warn(reserved_prefixes)]
|
||||||
|
|
||||||
macro_rules! m2 {
|
macro_rules! m2 {
|
||||||
($a:tt $b:tt) => {};
|
($a:tt $b:tt) => {};
|
||||||
@ -14,16 +14,16 @@ macro_rules! m3 {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
m2!(z"hey");
|
m2!(z"hey");
|
||||||
//~^ WARNING prefix `z` is unknown [reserved_prefix]
|
//~^ WARNING prefix `z` is unknown [reserved_prefixes]
|
||||||
//~| WARNING hard error in Rust 2021
|
//~| WARNING hard error in Rust 2021
|
||||||
m2!(prefix"hey");
|
m2!(prefix"hey");
|
||||||
//~^ WARNING prefix `prefix` is unknown [reserved_prefix]
|
//~^ WARNING prefix `prefix` is unknown [reserved_prefixes]
|
||||||
//~| WARNING hard error in Rust 2021
|
//~| WARNING hard error in Rust 2021
|
||||||
m3!(hey#123);
|
m3!(hey#123);
|
||||||
//~^ WARNING prefix `hey` is unknown [reserved_prefix]
|
//~^ WARNING prefix `hey` is unknown [reserved_prefixes]
|
||||||
//~| WARNING hard error in Rust 2021
|
//~| WARNING hard error in Rust 2021
|
||||||
m3!(hey#hey);
|
m3!(hey#hey);
|
||||||
//~^ WARNING prefix `hey` is unknown [reserved_prefix]
|
//~^ WARNING prefix `hey` is unknown [reserved_prefixes]
|
||||||
//~| WARNING hard error in Rust 2021
|
//~| WARNING hard error in Rust 2021
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,6 +33,6 @@ macro_rules! quote {
|
|||||||
|
|
||||||
quote! {
|
quote! {
|
||||||
#name = #kind#value
|
#name = #kind#value
|
||||||
//~^ WARNING prefix `kind` is unknown [reserved_prefix]
|
//~^ WARNING prefix `kind` is unknown [reserved_prefixes]
|
||||||
//~| WARNING hard error in Rust 2021
|
//~| WARNING hard error in Rust 2021
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ LL | m2!(z"hey");
|
|||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/reserved-prefixes-migration.rs:5:9
|
--> $DIR/reserved-prefixes-migration.rs:5:9
|
||||||
|
|
|
|
||||||
LL | #![warn(reserved_prefix)]
|
LL | #![warn(reserved_prefixes)]
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
|
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
|
||||||
= note: for more information, see issue #84978 <https://github.com/rust-lang/rust/issues/84978>
|
= note: for more information, see issue #84978 <https://github.com/rust-lang/rust/issues/84978>
|
||||||
help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021
|
help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021
|
||||||
|
Loading…
x
Reference in New Issue
Block a user