move sugg to derive session diagnostic
This commit is contained in:
parent
5e94b5faf1
commit
4d219d0666
3 changed files with 18 additions and 9 deletions
|
@ -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) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue