@@ -6,7 +6,8 @@ use super::{
6
6
use crate :: errors:: {
7
7
AmbiguousPlus , BadQPathStage2 , BadTypePlus , BadTypePlusSub , ExpectedIdentifier , ExpectedSemi ,
8
8
ExpectedSemiSugg , InInTypo , IncorrectAwait , IncorrectSemicolon , IncorrectUseOfAwait ,
9
- SuggEscapeToUseAsIdentifier , SuggRemoveComma , UseEqInstead ,
9
+ StructLiteralBodyWithoutPath , StructLiteralBodyWithoutPathSugg , SuggEscapeToUseAsIdentifier ,
10
+ SuggRemoveComma , UseEqInstead ,
10
11
} ;
11
12
12
13
use crate :: lexer:: UnmatchedBrace ;
@@ -21,10 +22,10 @@ use rustc_ast::{
21
22
} ;
22
23
use rustc_ast_pretty:: pprust;
23
24
use rustc_data_structures:: fx:: FxHashSet ;
25
+ use rustc_errors:: { pluralize, struct_span_err, Diagnostic , ErrorGuaranteed , IntoDiagnostic } ;
24
26
use rustc_errors:: {
25
- fluent , Applicability , DiagnosticBuilder , DiagnosticMessage , Handler , MultiSpan , PResult ,
27
+ Applicability , DiagnosticBuilder , DiagnosticMessage , Handler , MultiSpan , PResult ,
26
28
} ;
27
- use rustc_errors:: { pluralize, struct_span_err, Diagnostic , ErrorGuaranteed , IntoDiagnostic } ;
28
29
use rustc_span:: source_map:: Spanned ;
29
30
use rustc_span:: symbol:: { kw, sym, Ident } ;
30
31
use rustc_span:: { Span , SpanSnippetError , DUMMY_SP } ;
@@ -645,19 +646,13 @@ impl<'a> Parser<'a> {
645
646
// field: value,
646
647
// } }
647
648
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
+ } ) ;
661
656
self . restore_snapshot ( snapshot) ;
662
657
let mut tail = self . mk_block (
663
658
vec ! [ self . mk_stmt_err( expr. span) ] ,
0 commit comments