]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_lint/src/context.rs
Add migration lint for reserved prefixes.
[rust.git] / compiler / rustc_lint / src / context.rs
index 2dc04d57d1e66de4edd05e224ec152df106196a8..933f7e47c3e9d1b36c75235ad791843f7051fee3 100644 (file)
@@ -723,6 +723,15 @@ fn lookup_with_diagnostics(
                 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));