about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRyan Levick <me@ryanlevick.com>2021-06-30 15:56:50 +0200
committerRyan Levick <me@ryanlevick.com>2021-07-06 20:13:16 +0200
commit81c11a212eda360ee3808dacf8065685f4a2e07b (patch)
tree45c84e9b1044e99a9fc873aaeb869fcdc4d96f3f
parenta902e25f589b929b65bd0b55abdeb2f22796401a (diff)
downloadrust-81c11a212eda360ee3808dacf8065685f4a2e07b.tar.gz
rust-81c11a212eda360ee3808dacf8065685f4a2e07b.zip
rust_2021_token_prefixes
-rw-r--r--compiler/rustc_lint_defs/src/builtin.rs8
-rw-r--r--compiler/rustc_parse/src/lexer/mod.rs4
-rw-r--r--src/test/ui/rust-2021/reserved-prefixes-migration.fixed12
-rw-r--r--src/test/ui/rust-2021/reserved-prefixes-migration.rs12
-rw-r--r--src/test/ui/rust-2021/reserved-prefixes-migration.stderr4
5 files changed, 20 insertions, 20 deletions
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
index 52bdb4f3e41..9d809e388a1 100644
--- a/compiler/rustc_lint_defs/src/builtin.rs
+++ b/compiler/rustc_lint_defs/src/builtin.rs
@@ -2973,7 +2973,7 @@ declare_lint_pass! {
         RUST_2021_INCOMPATIBLE_OR_PATTERNS,
         LARGE_ASSIGNMENTS,
         FUTURE_PRELUDE_COLLISIONS,
-        RESERVED_PREFIXES,
+        RUST_2021_TOKEN_PREFIXES,
         UNSUPPORTED_CALLING_CONVENTIONS,
     ]
 }
@@ -3270,13 +3270,13 @@ declare_lint! {
 }
 
 declare_lint! {
-    /// The `reserved_prefixes` lint detects identifiers that will be parsed as a
+    /// The `rust_2021_token_prefixes` lint detects identifiers that will be parsed as a
     /// prefix instead in Rust 2021.
     ///
     /// ### Example
     ///
     /// ```rust,compile_fail
-    /// #![deny(reserved_prefixes)]
+    /// #![deny(rust_2021_token_prefixes)]
     ///
     /// macro_rules! m {
     ///     (z $x:expr) => ();
@@ -3295,7 +3295,7 @@ declare_lint! {
     ///
     /// This lint suggests to add whitespace between the `z` and `"hey"` tokens
     /// to keep them separated in Rust 2021.
-    pub RESERVED_PREFIXES,
+    pub RUST_2021_TOKEN_PREFIXES,
     Allow,
     "identifiers that will be parsed as a prefix in Rust 2021",
     @future_incompatible = FutureIncompatibleInfo {
diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs
index 3f58476296b..73ca9b04b37 100644
--- a/compiler/rustc_parse/src/lexer/mod.rs
+++ b/compiler/rustc_parse/src/lexer/mod.rs
@@ -4,7 +4,7 @@ use rustc_ast::tokenstream::{Spacing, TokenStream};
 use rustc_errors::{error_code, Applicability, DiagnosticBuilder, FatalError, PResult};
 use rustc_lexer::unescape::{self, Mode};
 use rustc_lexer::{Base, DocStyle, RawStrError};
-use rustc_session::lint::builtin::RESERVED_PREFIXES;
+use rustc_session::lint::builtin::RUST_2021_TOKEN_PREFIXES;
 use rustc_session::lint::BuiltinLintDiagnostics;
 use rustc_session::parse::ParseSess;
 use rustc_span::symbol::{sym, Symbol};
@@ -526,7 +526,7 @@ impl<'a> StringReader<'a> {
         } else {
             // Before Rust 2021, only emit a lint for migration.
             self.sess.buffer_lint_with_diagnostic(
-                &RESERVED_PREFIXES,
+                &RUST_2021_TOKEN_PREFIXES,
                 prefix_span,
                 ast::CRATE_NODE_ID,
                 &msg,
diff --git a/src/test/ui/rust-2021/reserved-prefixes-migration.fixed b/src/test/ui/rust-2021/reserved-prefixes-migration.fixed
index f6b6f7405a6..3392970d8d3 100644
--- a/src/test/ui/rust-2021/reserved-prefixes-migration.fixed
+++ b/src/test/ui/rust-2021/reserved-prefixes-migration.fixed
@@ -2,7 +2,7 @@
 // run-rustfix
 // compile-flags: -Z unstable-options --edition 2018
 
-#![warn(reserved_prefixes)]
+#![warn(rust_2021_token_prefixes)]
 
 macro_rules! m2 {
     ($a:tt $b:tt) => {};
@@ -14,16 +14,16 @@ macro_rules! m3 {
 
 fn main() {
     m2!(z "hey");
-    //~^ WARNING prefix `z` is unknown [reserved_prefixes]
+    //~^ WARNING prefix `z` is unknown [rust_2021_token_prefixes]
     //~| WARNING hard error in Rust 2021
     m2!(prefix "hey");
-    //~^ WARNING prefix `prefix` is unknown [reserved_prefixes]
+    //~^ WARNING prefix `prefix` is unknown [rust_2021_token_prefixes]
     //~| WARNING hard error in Rust 2021
     m3!(hey #123);
-    //~^ WARNING prefix `hey` is unknown [reserved_prefixes]
+    //~^ WARNING prefix `hey` is unknown [rust_2021_token_prefixes]
     //~| WARNING hard error in Rust 2021
     m3!(hey #hey);
-    //~^ WARNING prefix `hey` is unknown [reserved_prefixes]
+    //~^ WARNING prefix `hey` is unknown [rust_2021_token_prefixes]
     //~| WARNING hard error in Rust 2021
 }
 
@@ -33,6 +33,6 @@ macro_rules! quote {
 
 quote! {
     #name = #kind #value
-    //~^ WARNING prefix `kind` is unknown [reserved_prefixes]
+    //~^ WARNING prefix `kind` is unknown [rust_2021_token_prefixes]
     //~| WARNING hard error in Rust 2021
 }
diff --git a/src/test/ui/rust-2021/reserved-prefixes-migration.rs b/src/test/ui/rust-2021/reserved-prefixes-migration.rs
index 2b056245a99..b8a75224f84 100644
--- a/src/test/ui/rust-2021/reserved-prefixes-migration.rs
+++ b/src/test/ui/rust-2021/reserved-prefixes-migration.rs
@@ -2,7 +2,7 @@
 // run-rustfix
 // compile-flags: -Z unstable-options --edition 2018
 
-#![warn(reserved_prefixes)]
+#![warn(rust_2021_token_prefixes)]
 
 macro_rules! m2 {
     ($a:tt $b:tt) => {};
@@ -14,16 +14,16 @@ macro_rules! m3 {
 
 fn main() {
     m2!(z"hey");
-    //~^ WARNING prefix `z` is unknown [reserved_prefixes]
+    //~^ WARNING prefix `z` is unknown [rust_2021_token_prefixes]
     //~| WARNING hard error in Rust 2021
     m2!(prefix"hey");
-    //~^ WARNING prefix `prefix` is unknown [reserved_prefixes]
+    //~^ WARNING prefix `prefix` is unknown [rust_2021_token_prefixes]
     //~| WARNING hard error in Rust 2021
     m3!(hey#123);
-    //~^ WARNING prefix `hey` is unknown [reserved_prefixes]
+    //~^ WARNING prefix `hey` is unknown [rust_2021_token_prefixes]
     //~| WARNING hard error in Rust 2021
     m3!(hey#hey);
-    //~^ WARNING prefix `hey` is unknown [reserved_prefixes]
+    //~^ WARNING prefix `hey` is unknown [rust_2021_token_prefixes]
     //~| WARNING hard error in Rust 2021
 }
 
@@ -33,6 +33,6 @@ macro_rules! quote {
 
 quote! {
     #name = #kind#value
-    //~^ WARNING prefix `kind` is unknown [reserved_prefixes]
+    //~^ WARNING prefix `kind` is unknown [rust_2021_token_prefixes]
     //~| WARNING hard error in Rust 2021
 }
diff --git a/src/test/ui/rust-2021/reserved-prefixes-migration.stderr b/src/test/ui/rust-2021/reserved-prefixes-migration.stderr
index ec27b68e2df..872aefc0715 100644
--- a/src/test/ui/rust-2021/reserved-prefixes-migration.stderr
+++ b/src/test/ui/rust-2021/reserved-prefixes-migration.stderr
@@ -7,8 +7,8 @@ LL |     m2!(z"hey");
 note: the lint level is defined here
   --> $DIR/reserved-prefixes-migration.rs:5:9
    |
-LL | #![warn(reserved_prefixes)]
-   |         ^^^^^^^^^^^^^^^^^
+LL | #![warn(rust_2021_token_prefixes)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^
    = 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>
 help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021