@@ -1269,7 +1269,7 @@ impl<'a> Parser<'a> {
12691269 . collect ( ) ,
12701270 } ,
12711271 }
1272- . into_diagnostic ( & self . sess . span_diagnostic ) ;
1272+ . into_diagnostic ( self . diagnostic ( ) ) ;
12731273 replacement_err. emit ( ) ;
12741274
12751275 let old_err = mem:: replace ( err, replacement_err) ;
@@ -1691,7 +1691,7 @@ impl<'a> Parser<'a> {
16911691 err : impl FnOnce ( & Self ) -> DiagnosticBuilder < ' a , ErrorGuaranteed > ,
16921692 ) -> L {
16931693 if let Some ( mut diag) =
1694- self . sess . span_diagnostic . steal_diagnostic ( lifetime. span , StashKey :: LifetimeIsChar )
1694+ self . diagnostic ( ) . steal_diagnostic ( lifetime. span , StashKey :: LifetimeIsChar )
16951695 {
16961696 diag. span_suggestion_verbose (
16971697 lifetime. span . shrink_to_hi ( ) ,
@@ -1882,7 +1882,7 @@ impl<'a> Parser<'a> {
18821882
18831883 let Some ( ( ident, false ) ) = self . token . ident ( ) else {
18841884 let err = errors:: ExpectedBuiltinIdent { span : self . token . span }
1885- . into_diagnostic ( & self . sess . span_diagnostic ) ;
1885+ . into_diagnostic ( self . diagnostic ( ) ) ;
18861886 return Err ( err) ;
18871887 } ;
18881888 self . sess . gated_spans . gate ( sym:: builtin_syntax, ident. span ) ;
@@ -1893,7 +1893,7 @@ impl<'a> Parser<'a> {
18931893 Ok ( res)
18941894 } else {
18951895 let err = errors:: UnknownBuiltinConstruct { span : lo. to ( ident. span ) , name : ident. name }
1896- . into_diagnostic ( & self . sess . span_diagnostic ) ;
1896+ . into_diagnostic ( self . diagnostic ( ) ) ;
18971897 return Err ( err) ;
18981898 } ;
18991899 self . expect ( & TokenKind :: CloseDelim ( Delimiter :: Parenthesis ) ) ?;
@@ -1957,7 +1957,7 @@ impl<'a> Parser<'a> {
19571957 && matches ! ( e. kind, ExprKind :: Err )
19581958 {
19591959 let mut err = errors:: InvalidInterpolatedExpression { span : self . token . span }
1960- . into_diagnostic ( & self . sess . span_diagnostic ) ;
1960+ . into_diagnostic ( self . diagnostic ( ) ) ;
19611961 err. downgrade_to_delayed_bug ( ) ;
19621962 return Err ( err) ;
19631963 }
@@ -2169,7 +2169,7 @@ impl<'a> Parser<'a> {
21692169 return Err ( errors:: MissingSemicolonBeforeArray {
21702170 open_delim : open_delim_span,
21712171 semicolon : prev_span. shrink_to_hi ( ) ,
2172- } . into_diagnostic ( & self . sess . span_diagnostic ) ) ;
2172+ } . into_diagnostic ( self . diagnostic ( ) ) ) ;
21732173 }
21742174 Ok ( _) => ( ) ,
21752175 Err ( err) => err. cancel ( ) ,
@@ -2309,7 +2309,7 @@ impl<'a> Parser<'a> {
23092309 if self . check_keyword ( kw:: Async ) {
23102310 let move_async_span = self . token . span . with_lo ( self . prev_token . span . data ( ) . lo ) ;
23112311 Err ( errors:: AsyncMoveOrderIncorrect { span : move_async_span }
2312- . into_diagnostic ( & self . sess . span_diagnostic ) )
2312+ . into_diagnostic ( self . diagnostic ( ) ) )
23132313 } else {
23142314 Ok ( CaptureBy :: Value { move_kw : move_kw_span } )
23152315 }
@@ -2499,7 +2499,7 @@ impl<'a> Parser<'a> {
24992499 } ;
25002500 if self . prev_token . kind == token:: BinOp ( token:: Or ) {
25012501 // This was part of a closure, the that part of the parser recover.
2502- return Err ( err. into_diagnostic ( & self . sess . span_diagnostic ) ) ;
2502+ return Err ( err. into_diagnostic ( self . diagnostic ( ) ) ) ;
25032503 } else {
25042504 Some ( self . sess . emit_err ( err) )
25052505 }
@@ -3148,7 +3148,7 @@ impl<'a> Parser<'a> {
31483148 let ( attrs, body) = self . parse_inner_attrs_and_block ( ) ?;
31493149 if self . eat_keyword ( kw:: Catch ) {
31503150 Err ( errors:: CatchAfterTry { span : self . prev_token . span }
3151- . into_diagnostic ( & self . sess . span_diagnostic ) )
3151+ . into_diagnostic ( self . diagnostic ( ) ) )
31523152 } else {
31533153 let span = span_lo. to ( body. span ) ;
31543154 self . sess . gated_spans . gate ( sym:: try_blocks, span) ;
0 commit comments