diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-06-14 12:56:49 +0000 |
|---|---|---|
| committer | lrh2000 <lrh2000@pku.edu.cn> | 2021-06-26 23:11:04 +0800 |
| commit | d837c00d1008c2ab13bf80117b81f5e482fc9edb (patch) | |
| tree | f17ee6f36f349b76ad8b54e360812a392604b01d /compiler/rustc_lint/src/context.rs | |
| parent | 40fb2e97053e2655016688264ff19160741c1dbb (diff) | |
| download | rust-d837c00d1008c2ab13bf80117b81f5e482fc9edb.tar.gz rust-d837c00d1008c2ab13bf80117b81f5e482fc9edb.zip | |
Add migration lint for reserved prefixes.
Diffstat (limited to 'compiler/rustc_lint/src/context.rs')
| -rw-r--r-- | compiler/rustc_lint/src/context.rs | 9 |
1 files changed, 9 insertions, 0 deletions
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)); |
