about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authoryukang <moorekang@gmail.com>2023-05-09 11:51:04 +0800
committeryukang <moorekang@gmail.com>2023-05-09 11:51:04 +0800
commit4d219d066626c49fdec3d8fa143a94c81150b633 (patch)
treeb228eeaabd2eaa1b55aa921b11dbd43b7f277779 /compiler/rustc_parse/src/parser
parent5e94b5faf1f0812207a9128e2754bd146210b16e (diff)
downloadrust-4d219d066626c49fdec3d8fa143a94c81150b633.tar.gz
rust-4d219d066626c49fdec3d8fa143a94c81150b633.zip
move sugg to derive session diagnostic
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/diagnostics.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs
index b0822fe7956..3002f23da75 100644
--- a/compiler/rustc_parse/src/parser/diagnostics.rs
+++ b/compiler/rustc_parse/src/parser/diagnostics.rs
@@ -13,7 +13,7 @@ use crate::errors::{
     IncorrectUseOfAwait, ParenthesesInForHead, ParenthesesInForHeadSugg,
     PatternMethodParamWithoutBody, QuestionMarkInType, QuestionMarkInTypeSugg, SelfParamNotFirst,
     StructLiteralBodyWithoutPath, StructLiteralBodyWithoutPathSugg, StructLiteralNeedingParens,
-    StructLiteralNeedingParensSugg, SuggEscapeIdentifier, SuggRemoveComma,
+    StructLiteralNeedingParensSugg, SuggAddMissingLetStmt, SuggEscapeIdentifier, SuggRemoveComma,
     UnexpectedConstInGenericParam, UnexpectedConstParamDeclaration,
     UnexpectedConstParamDeclarationSugg, UnmatchedAngleBrackets, UseEqInstead,
 };
@@ -32,8 +32,8 @@ use rustc_ast::{
 use rustc_ast_pretty::pprust;
 use rustc_data_structures::fx::FxHashSet;
 use rustc_errors::{
-    pluralize, Applicability, Diagnostic, DiagnosticBuilder, DiagnosticMessage, ErrorGuaranteed,
-    FatalError, Handler, IntoDiagnostic, MultiSpan, PResult,
+    pluralize, AddToDiagnostic, Applicability, Diagnostic, DiagnosticBuilder, DiagnosticMessage,
+    ErrorGuaranteed, FatalError, Handler, IntoDiagnostic, MultiSpan, PResult,
 };
 use rustc_session::errors::ExprParenthesesNeeded;
 use rustc_span::source_map::Spanned;
@@ -1019,12 +1019,8 @@ impl<'a> Parser<'a> {
             match self.parse_ty() {
                 Ok(_) => {
                     if self.token == token::Eq {
-                        err.span_suggestion_verbose(
-                            prev_span,
-                            "you might have meant to introduce a new binding",
-                            "let ".to_string(),
-                            Applicability::MaybeIncorrect,
-                        );
+                        let sugg = SuggAddMissingLetStmt { span: prev_span };
+                        sugg.add_to_diagnostic(err);
                     }
                 }
                 Err(e) => {