@@ -6,7 +6,8 @@ use super::{
66use crate :: errors:: {
77 AmbiguousPlus , BadQPathStage2 , BadTypePlus , BadTypePlusSub , ExpectedIdentifier , ExpectedSemi ,
88 ExpectedSemiSugg , InInTypo , IncorrectAwait , IncorrectSemicolon , IncorrectUseOfAwait ,
9- SuggEscapeToUseAsIdentifier , SuggRemoveComma , UseEqInstead ,
9+ StructLiteralBodyWithoutPath , StructLiteralBodyWithoutPathSugg , SuggEscapeToUseAsIdentifier ,
10+ SuggRemoveComma , UseEqInstead ,
1011} ;
1112
1213use crate :: lexer:: UnmatchedBrace ;
@@ -21,10 +22,10 @@ use rustc_ast::{
2122} ;
2223use rustc_ast_pretty:: pprust;
2324use rustc_data_structures:: fx:: FxHashSet ;
25+ use rustc_errors:: { pluralize, struct_span_err, Diagnostic , ErrorGuaranteed , IntoDiagnostic } ;
2426use rustc_errors:: {
25- fluent , Applicability , DiagnosticBuilder , DiagnosticMessage , Handler , MultiSpan , PResult ,
27+ Applicability , DiagnosticBuilder , DiagnosticMessage , Handler , MultiSpan , PResult ,
2628} ;
27- use rustc_errors:: { pluralize, struct_span_err, Diagnostic , ErrorGuaranteed , IntoDiagnostic } ;
2829use rustc_span:: source_map:: Spanned ;
2930use rustc_span:: symbol:: { kw, sym, Ident } ;
3031use rustc_span:: { Span , SpanSnippetError , DUMMY_SP } ;
@@ -645,19 +646,13 @@ impl<'a> Parser<'a> {
645646 // field: value,
646647 // } }
647648 err. delay_as_bug ( ) ;
648- self . struct_span_err (
649- expr. span ,
650- fluent:: parser:: struct_literal_body_without_path,
651- )
652- . multipart_suggestion (
653- fluent:: parser:: suggestion,
654- vec ! [
655- ( expr. span. shrink_to_lo( ) , "{ SomeStruct " . to_string( ) ) ,
656- ( expr. span. shrink_to_hi( ) , " }" . to_string( ) ) ,
657- ] ,
658- Applicability :: MaybeIncorrect ,
659- )
660- . emit ( ) ;
649+ self . sess . emit_err ( StructLiteralBodyWithoutPath {
650+ span : expr. span ,
651+ sugg : StructLiteralBodyWithoutPathSugg {
652+ before : expr. span . shrink_to_lo ( ) ,
653+ after : expr. span . shrink_to_hi ( ) ,
654+ } ,
655+ } ) ;
661656 self . restore_snapshot ( snapshot) ;
662657 let mut tail = self . mk_block (
663658 vec ! [ self . mk_stmt_err( expr. span) ] ,
0 commit comments