@@ -13,7 +13,7 @@ use crate::errors::{
1313 IncorrectUseOfAwait , ParenthesesInForHead , ParenthesesInForHeadSugg ,
1414 PatternMethodParamWithoutBody , QuestionMarkInType , QuestionMarkInTypeSugg , SelfParamNotFirst ,
1515 StructLiteralBodyWithoutPath , StructLiteralBodyWithoutPathSugg , StructLiteralNeedingParens ,
16- StructLiteralNeedingParensSugg , SuggEscapeIdentifier , SuggRemoveComma ,
16+ StructLiteralNeedingParensSugg , SuggAddMissingLetStmt , SuggEscapeIdentifier , SuggRemoveComma ,
1717 UnexpectedConstInGenericParam , UnexpectedConstParamDeclaration ,
1818 UnexpectedConstParamDeclarationSugg , UnmatchedAngleBrackets , UseEqInstead ,
1919} ;
@@ -32,8 +32,8 @@ use rustc_ast::{
3232use rustc_ast_pretty:: pprust;
3333use rustc_data_structures:: fx:: FxHashSet ;
3434use rustc_errors:: {
35- pluralize, Applicability , Diagnostic , DiagnosticBuilder , DiagnosticMessage , ErrorGuaranteed ,
36- FatalError , Handler , IntoDiagnostic , MultiSpan , PResult ,
35+ pluralize, AddToDiagnostic , Applicability , Diagnostic , DiagnosticBuilder , DiagnosticMessage ,
36+ ErrorGuaranteed , FatalError , Handler , IntoDiagnostic , MultiSpan , PResult ,
3737} ;
3838use rustc_session:: errors:: ExprParenthesesNeeded ;
3939use rustc_span:: source_map:: Spanned ;
@@ -1019,12 +1019,8 @@ impl<'a> Parser<'a> {
10191019 match self . parse_ty ( ) {
10201020 Ok ( _) => {
10211021 if self . token == token:: Eq {
1022- err. span_suggestion_verbose (
1023- prev_span,
1024- "you might have meant to introduce a new binding" ,
1025- "let " . to_string ( ) ,
1026- Applicability :: MaybeIncorrect ,
1027- ) ;
1022+ let sugg = SuggAddMissingLetStmt { span : prev_span } ;
1023+ sugg. add_to_diagnostic ( err) ;
10281024 }
10291025 }
10301026 Err ( e) => {
0 commit comments