Skip to content

Commit

Permalink
rename rust_2021_token_prefixes to rust_2021_prefixes_incompatible_sy…
Browse files Browse the repository at this point in the history
…ntax
  • Loading branch information
rylev committed Jul 6, 2021
1 parent 941eb2a commit d4e384b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions compiler/rustc_lint_defs/src/builtin.rs
Expand Up @@ -2973,7 +2973,7 @@ declare_lint_pass! {
RUST_2021_INCOMPATIBLE_OR_PATTERNS,
LARGE_ASSIGNMENTS,
RUST_2021_PRELUDE_COLLISIONS,
RUST_2021_TOKEN_PREFIXES,
RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX,
UNSUPPORTED_CALLING_CONVENTIONS,
]
}
Expand Down Expand Up @@ -3270,13 +3270,13 @@ declare_lint! {
}

declare_lint! {
/// The `rust_2021_token_prefixes` lint detects identifiers that will be parsed as a
/// The `rust_2021_prefixes_incompatible_syntax` lint detects identifiers that will be parsed as a
/// prefix instead in Rust 2021.
///
/// ### Example
///
/// ```rust,compile_fail
/// #![deny(rust_2021_token_prefixes)]
/// #![deny(rust_2021_prefixes_incompatible_syntax)]
///
/// macro_rules! m {
/// (z $x:expr) => ();
Expand All @@ -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 RUST_2021_TOKEN_PREFIXES,
pub RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX,
Allow,
"identifiers that will be parsed as a prefix in Rust 2021",
@future_incompatible = FutureIncompatibleInfo {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_parse/src/lexer/mod.rs
Expand Up @@ -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::RUST_2021_TOKEN_PREFIXES;
use rustc_session::lint::builtin::RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX;
use rustc_session::lint::BuiltinLintDiagnostics;
use rustc_session::parse::ParseSess;
use rustc_span::symbol::{sym, Symbol};
Expand Down Expand Up @@ -526,7 +526,7 @@ impl<'a> StringReader<'a> {
} else {
// Before Rust 2021, only emit a lint for migration.
self.sess.buffer_lint_with_diagnostic(
&RUST_2021_TOKEN_PREFIXES,
&RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX,
prefix_span,
ast::CRATE_NODE_ID,
&msg,
Expand Down
12 changes: 6 additions & 6 deletions src/test/ui/rust-2021/reserved-prefixes-migration.fixed
Expand Up @@ -2,7 +2,7 @@
// run-rustfix
// compile-flags: -Z unstable-options --edition 2018

#![warn(rust_2021_token_prefixes)]
#![warn(rust_2021_prefixes_incompatible_syntax)]

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

fn main() {
m2!(z "hey");
//~^ WARNING prefix `z` is unknown [rust_2021_token_prefixes]
//~^ WARNING prefix `z` is unknown [rust_2021_prefixes_incompatible_syntax]
//~| WARNING hard error in Rust 2021
m2!(prefix "hey");
//~^ WARNING prefix `prefix` is unknown [rust_2021_token_prefixes]
//~^ WARNING prefix `prefix` is unknown [rust_2021_prefixes_incompatible_syntax]
//~| WARNING hard error in Rust 2021
m3!(hey #123);
//~^ WARNING prefix `hey` is unknown [rust_2021_token_prefixes]
//~^ WARNING prefix `hey` is unknown [rust_2021_prefixes_incompatible_syntax]
//~| WARNING hard error in Rust 2021
m3!(hey #hey);
//~^ WARNING prefix `hey` is unknown [rust_2021_token_prefixes]
//~^ WARNING prefix `hey` is unknown [rust_2021_prefixes_incompatible_syntax]
//~| WARNING hard error in Rust 2021
}

Expand All @@ -33,6 +33,6 @@ macro_rules! quote {

quote! {
#name = #kind #value
//~^ WARNING prefix `kind` is unknown [rust_2021_token_prefixes]
//~^ WARNING prefix `kind` is unknown [rust_2021_prefixes_incompatible_syntax]
//~| WARNING hard error in Rust 2021
}
12 changes: 6 additions & 6 deletions src/test/ui/rust-2021/reserved-prefixes-migration.rs
Expand Up @@ -2,7 +2,7 @@
// run-rustfix
// compile-flags: -Z unstable-options --edition 2018

#![warn(rust_2021_token_prefixes)]
#![warn(rust_2021_prefixes_incompatible_syntax)]

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

fn main() {
m2!(z"hey");
//~^ WARNING prefix `z` is unknown [rust_2021_token_prefixes]
//~^ WARNING prefix `z` is unknown [rust_2021_prefixes_incompatible_syntax]
//~| WARNING hard error in Rust 2021
m2!(prefix"hey");
//~^ WARNING prefix `prefix` is unknown [rust_2021_token_prefixes]
//~^ WARNING prefix `prefix` is unknown [rust_2021_prefixes_incompatible_syntax]
//~| WARNING hard error in Rust 2021
m3!(hey#123);
//~^ WARNING prefix `hey` is unknown [rust_2021_token_prefixes]
//~^ WARNING prefix `hey` is unknown [rust_2021_prefixes_incompatible_syntax]
//~| WARNING hard error in Rust 2021
m3!(hey#hey);
//~^ WARNING prefix `hey` is unknown [rust_2021_token_prefixes]
//~^ WARNING prefix `hey` is unknown [rust_2021_prefixes_incompatible_syntax]
//~| WARNING hard error in Rust 2021
}

Expand All @@ -33,6 +33,6 @@ macro_rules! quote {

quote! {
#name = #kind#value
//~^ WARNING prefix `kind` is unknown [rust_2021_token_prefixes]
//~^ WARNING prefix `kind` is unknown [rust_2021_prefixes_incompatible_syntax]
//~| WARNING hard error in Rust 2021
}
4 changes: 2 additions & 2 deletions src/test/ui/rust-2021/reserved-prefixes-migration.stderr
Expand Up @@ -7,8 +7,8 @@ LL | m2!(z"hey");
note: the lint level is defined here
--> $DIR/reserved-prefixes-migration.rs:5:9
|
LL | #![warn(rust_2021_token_prefixes)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
LL | #![warn(rust_2021_prefixes_incompatible_syntax)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= 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
Expand Down

0 comments on commit d4e384b

Please sign in to comment.