@@ -1269,7 +1269,7 @@ impl<'a> Parser<'a> {
12691269 . collect ( ) ,
12701270 } ,
12711271 }
1272- . into_diagnostic ( self . diagnostic ( ) ) ;
1272+ . into_diagnostic ( self . dcx ( ) ) ;
12731273 replacement_err. emit ( ) ;
12741274
12751275 let old_err = mem:: replace ( err, replacement_err) ;
@@ -1693,8 +1693,7 @@ impl<'a> Parser<'a> {
16931693 mk_lit_char : impl FnOnce ( Symbol , Span ) -> L ,
16941694 err : impl FnOnce ( & Self ) -> DiagnosticBuilder < ' a , ErrorGuaranteed > ,
16951695 ) -> L {
1696- if let Some ( mut diag) =
1697- self . diagnostic ( ) . steal_diagnostic ( lifetime. span , StashKey :: LifetimeIsChar )
1696+ if let Some ( mut diag) = self . dcx ( ) . steal_diagnostic ( lifetime. span , StashKey :: LifetimeIsChar )
16981697 {
16991698 diag. span_suggestion_verbose (
17001699 lifetime. span . shrink_to_hi ( ) ,
@@ -1884,8 +1883,8 @@ impl<'a> Parser<'a> {
18841883 self . bump ( ) ; // `#`
18851884
18861885 let Some ( ( ident, false ) ) = self . token . ident ( ) else {
1887- let err = errors :: ExpectedBuiltinIdent { span : self . token . span }
1888- . into_diagnostic ( self . diagnostic ( ) ) ;
1886+ let err =
1887+ errors :: ExpectedBuiltinIdent { span : self . token . span } . into_diagnostic ( self . dcx ( ) ) ;
18891888 return Err ( err) ;
18901889 } ;
18911890 self . sess . gated_spans . gate ( sym:: builtin_syntax, ident. span ) ;
@@ -1896,7 +1895,7 @@ impl<'a> Parser<'a> {
18961895 Ok ( res)
18971896 } else {
18981897 let err = errors:: UnknownBuiltinConstruct { span : lo. to ( ident. span ) , name : ident. name }
1899- . into_diagnostic ( self . diagnostic ( ) ) ;
1898+ . into_diagnostic ( self . dcx ( ) ) ;
19001899 return Err ( err) ;
19011900 } ;
19021901 self . expect ( & TokenKind :: CloseDelim ( Delimiter :: Parenthesis ) ) ?;
@@ -1960,7 +1959,7 @@ impl<'a> Parser<'a> {
19601959 && matches ! ( e. kind, ExprKind :: Err )
19611960 {
19621961 let mut err = errors:: InvalidInterpolatedExpression { span : self . token . span }
1963- . into_diagnostic ( self . diagnostic ( ) ) ;
1962+ . into_diagnostic ( self . dcx ( ) ) ;
19641963 err. downgrade_to_delayed_bug ( ) ;
19651964 return Err ( err) ;
19661965 }
@@ -2172,7 +2171,7 @@ impl<'a> Parser<'a> {
21722171 return Err ( errors:: MissingSemicolonBeforeArray {
21732172 open_delim : open_delim_span,
21742173 semicolon : prev_span. shrink_to_hi ( ) ,
2175- } . into_diagnostic ( self . diagnostic ( ) ) ) ;
2174+ } . into_diagnostic ( self . dcx ( ) ) ) ;
21762175 }
21772176 Ok ( _) => ( ) ,
21782177 Err ( err) => err. cancel ( ) ,
@@ -2320,7 +2319,7 @@ impl<'a> Parser<'a> {
23202319 if self . check_keyword ( kw:: Async ) {
23212320 let move_async_span = self . token . span . with_lo ( self . prev_token . span . data ( ) . lo ) ;
23222321 Err ( errors:: AsyncMoveOrderIncorrect { span : move_async_span }
2323- . into_diagnostic ( self . diagnostic ( ) ) )
2322+ . into_diagnostic ( self . dcx ( ) ) )
23242323 } else {
23252324 Ok ( CaptureBy :: Value { move_kw : move_kw_span } )
23262325 }
@@ -2510,7 +2509,7 @@ impl<'a> Parser<'a> {
25102509 } ;
25112510 if self . prev_token . kind == token:: BinOp ( token:: Or ) {
25122511 // This was part of a closure, the that part of the parser recover.
2513- return Err ( err. into_diagnostic ( self . diagnostic ( ) ) ) ;
2512+ return Err ( err. into_diagnostic ( self . dcx ( ) ) ) ;
25142513 } else {
25152514 Some ( self . sess . emit_err ( err) )
25162515 }
@@ -3194,8 +3193,7 @@ impl<'a> Parser<'a> {
31943193 fn parse_try_block ( & mut self , span_lo : Span ) -> PResult < ' a , P < Expr > > {
31953194 let ( attrs, body) = self . parse_inner_attrs_and_block ( ) ?;
31963195 if self . eat_keyword ( kw:: Catch ) {
3197- Err ( errors:: CatchAfterTry { span : self . prev_token . span }
3198- . into_diagnostic ( self . diagnostic ( ) ) )
3196+ Err ( errors:: CatchAfterTry { span : self . prev_token . span } . into_diagnostic ( self . dcx ( ) ) )
31993197 } else {
32003198 let span = span_lo. to ( body. span ) ;
32013199 self . sess . gated_spans . gate ( sym:: try_blocks, span) ;
0 commit comments