Skip to content

Commit d4e384b

Browse files
committed
rename rust_2021_token_prefixes to rust_2021_prefixes_incompatible_syntax
1 parent 941eb2a commit d4e384b

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

compiler/rustc_lint_defs/src/builtin.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2973,7 +2973,7 @@ declare_lint_pass! {
29732973
RUST_2021_INCOMPATIBLE_OR_PATTERNS,
29742974
LARGE_ASSIGNMENTS,
29752975
RUST_2021_PRELUDE_COLLISIONS,
2976-
RUST_2021_TOKEN_PREFIXES,
2976+
RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX,
29772977
UNSUPPORTED_CALLING_CONVENTIONS,
29782978
]
29792979
}
@@ -3270,13 +3270,13 @@ declare_lint! {
32703270
}
32713271

32723272
declare_lint! {
3273-
/// The `rust_2021_token_prefixes` lint detects identifiers that will be parsed as a
3273+
/// The `rust_2021_prefixes_incompatible_syntax` lint detects identifiers that will be parsed as a
32743274
/// prefix instead in Rust 2021.
32753275
///
32763276
/// ### Example
32773277
///
32783278
/// ```rust,compile_fail
3279-
/// #![deny(rust_2021_token_prefixes)]
3279+
/// #![deny(rust_2021_prefixes_incompatible_syntax)]
32803280
///
32813281
/// macro_rules! m {
32823282
/// (z $x:expr) => ();
@@ -3295,7 +3295,7 @@ declare_lint! {
32953295
///
32963296
/// This lint suggests to add whitespace between the `z` and `"hey"` tokens
32973297
/// to keep them separated in Rust 2021.
3298-
pub RUST_2021_TOKEN_PREFIXES,
3298+
pub RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX,
32993299
Allow,
33003300
"identifiers that will be parsed as a prefix in Rust 2021",
33013301
@future_incompatible = FutureIncompatibleInfo {

compiler/rustc_parse/src/lexer/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_ast::tokenstream::{Spacing, TokenStream};
44
use rustc_errors::{error_code, Applicability, DiagnosticBuilder, FatalError, PResult};
55
use rustc_lexer::unescape::{self, Mode};
66
use rustc_lexer::{Base, DocStyle, RawStrError};
7-
use rustc_session::lint::builtin::RUST_2021_TOKEN_PREFIXES;
7+
use rustc_session::lint::builtin::RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX;
88
use rustc_session::lint::BuiltinLintDiagnostics;
99
use rustc_session::parse::ParseSess;
1010
use rustc_span::symbol::{sym, Symbol};
@@ -526,7 +526,7 @@ impl<'a> StringReader<'a> {
526526
} else {
527527
// Before Rust 2021, only emit a lint for migration.
528528
self.sess.buffer_lint_with_diagnostic(
529-
&RUST_2021_TOKEN_PREFIXES,
529+
&RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX,
530530
prefix_span,
531531
ast::CRATE_NODE_ID,
532532
&msg,

src/test/ui/rust-2021/reserved-prefixes-migration.fixed

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// run-rustfix
33
// compile-flags: -Z unstable-options --edition 2018
44

5-
#![warn(rust_2021_token_prefixes)]
5+
#![warn(rust_2021_prefixes_incompatible_syntax)]
66

77
macro_rules! m2 {
88
($a:tt $b:tt) => {};
@@ -14,16 +14,16 @@ macro_rules! m3 {
1414

1515
fn main() {
1616
m2!(z "hey");
17-
//~^ WARNING prefix `z` is unknown [rust_2021_token_prefixes]
17+
//~^ WARNING prefix `z` is unknown [rust_2021_prefixes_incompatible_syntax]
1818
//~| WARNING hard error in Rust 2021
1919
m2!(prefix "hey");
20-
//~^ WARNING prefix `prefix` is unknown [rust_2021_token_prefixes]
20+
//~^ WARNING prefix `prefix` is unknown [rust_2021_prefixes_incompatible_syntax]
2121
//~| WARNING hard error in Rust 2021
2222
m3!(hey #123);
23-
//~^ WARNING prefix `hey` is unknown [rust_2021_token_prefixes]
23+
//~^ WARNING prefix `hey` is unknown [rust_2021_prefixes_incompatible_syntax]
2424
//~| WARNING hard error in Rust 2021
2525
m3!(hey #hey);
26-
//~^ WARNING prefix `hey` is unknown [rust_2021_token_prefixes]
26+
//~^ WARNING prefix `hey` is unknown [rust_2021_prefixes_incompatible_syntax]
2727
//~| WARNING hard error in Rust 2021
2828
}
2929

@@ -33,6 +33,6 @@ macro_rules! quote {
3333

3434
quote! {
3535
#name = #kind #value
36-
//~^ WARNING prefix `kind` is unknown [rust_2021_token_prefixes]
36+
//~^ WARNING prefix `kind` is unknown [rust_2021_prefixes_incompatible_syntax]
3737
//~| WARNING hard error in Rust 2021
3838
}

src/test/ui/rust-2021/reserved-prefixes-migration.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// run-rustfix
33
// compile-flags: -Z unstable-options --edition 2018
44

5-
#![warn(rust_2021_token_prefixes)]
5+
#![warn(rust_2021_prefixes_incompatible_syntax)]
66

77
macro_rules! m2 {
88
($a:tt $b:tt) => {};
@@ -14,16 +14,16 @@ macro_rules! m3 {
1414

1515
fn main() {
1616
m2!(z"hey");
17-
//~^ WARNING prefix `z` is unknown [rust_2021_token_prefixes]
17+
//~^ WARNING prefix `z` is unknown [rust_2021_prefixes_incompatible_syntax]
1818
//~| WARNING hard error in Rust 2021
1919
m2!(prefix"hey");
20-
//~^ WARNING prefix `prefix` is unknown [rust_2021_token_prefixes]
20+
//~^ WARNING prefix `prefix` is unknown [rust_2021_prefixes_incompatible_syntax]
2121
//~| WARNING hard error in Rust 2021
2222
m3!(hey#123);
23-
//~^ WARNING prefix `hey` is unknown [rust_2021_token_prefixes]
23+
//~^ WARNING prefix `hey` is unknown [rust_2021_prefixes_incompatible_syntax]
2424
//~| WARNING hard error in Rust 2021
2525
m3!(hey#hey);
26-
//~^ WARNING prefix `hey` is unknown [rust_2021_token_prefixes]
26+
//~^ WARNING prefix `hey` is unknown [rust_2021_prefixes_incompatible_syntax]
2727
//~| WARNING hard error in Rust 2021
2828
}
2929

@@ -33,6 +33,6 @@ macro_rules! quote {
3333

3434
quote! {
3535
#name = #kind#value
36-
//~^ WARNING prefix `kind` is unknown [rust_2021_token_prefixes]
36+
//~^ WARNING prefix `kind` is unknown [rust_2021_prefixes_incompatible_syntax]
3737
//~| WARNING hard error in Rust 2021
3838
}

src/test/ui/rust-2021/reserved-prefixes-migration.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ LL | m2!(z"hey");
77
note: the lint level is defined here
88
--> $DIR/reserved-prefixes-migration.rs:5:9
99
|
10-
LL | #![warn(rust_2021_token_prefixes)]
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^
10+
LL | #![warn(rust_2021_prefixes_incompatible_syntax)]
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
1313
= note: for more information, see issue #84978 <https://github.com/rust-lang/rust/issues/84978>
1414
help: insert whitespace here to avoid this being parsed as a prefix in Rust 2021

0 commit comments

Comments
 (0)