From d837c00d1008c2ab13bf80117b81f5e482fc9edb Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Mon, 14 Jun 2021 12:56:49 +0000 Subject: Add migration lint for reserved prefixes. --- compiler/rustc_lint/src/context.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'compiler/rustc_lint/src') diff --git a/compiler/rustc_lint/src/context.rs b/compiler/rustc_lint/src/context.rs index 2dc04d57d1e..933f7e47c3e 100644 --- a/compiler/rustc_lint/src/context.rs +++ b/compiler/rustc_lint/src/context.rs @@ -723,6 +723,15 @@ pub trait LintContext: Sized { BuiltinLintDiagnostics::OrPatternsBackCompat(span,suggestion) => { db.span_suggestion(span, "use pat_param to preserve semantics", suggestion, Applicability::MachineApplicable); } + BuiltinLintDiagnostics::ReservedPrefix(span) => { + db.span_label(span, "unknown prefix"); + db.span_suggestion_verbose( + span.shrink_to_hi(), + "insert whitespace here to avoid this being parsed as a prefix in Rust 2021", + " ".into(), + Applicability::MachineApplicable, + ); + } } // Rewrap `db`, and pass control to the user. decorate(LintDiagnosticBuilder::new(db)); -- cgit 1.4.1-3-g733a5