@@ -1269,7 +1269,7 @@ impl<'a> Parser<'a> {
1269
1269
. collect ( ) ,
1270
1270
} ,
1271
1271
}
1272
- . into_diagnostic ( & self . sess . span_diagnostic ) ;
1272
+ . into_diagnostic ( self . diagnostic ( ) ) ;
1273
1273
replacement_err. emit ( ) ;
1274
1274
1275
1275
let old_err = mem:: replace ( err, replacement_err) ;
@@ -1691,7 +1691,7 @@ impl<'a> Parser<'a> {
1691
1691
err : impl FnOnce ( & Self ) -> DiagnosticBuilder < ' a , ErrorGuaranteed > ,
1692
1692
) -> L {
1693
1693
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 )
1695
1695
{
1696
1696
diag. span_suggestion_verbose (
1697
1697
lifetime. span . shrink_to_hi ( ) ,
@@ -1882,7 +1882,7 @@ impl<'a> Parser<'a> {
1882
1882
1883
1883
let Some ( ( ident, false ) ) = self . token . ident ( ) else {
1884
1884
let err = errors:: ExpectedBuiltinIdent { span : self . token . span }
1885
- . into_diagnostic ( & self . sess . span_diagnostic ) ;
1885
+ . into_diagnostic ( self . diagnostic ( ) ) ;
1886
1886
return Err ( err) ;
1887
1887
} ;
1888
1888
self . sess . gated_spans . gate ( sym:: builtin_syntax, ident. span ) ;
@@ -1893,7 +1893,7 @@ impl<'a> Parser<'a> {
1893
1893
Ok ( res)
1894
1894
} else {
1895
1895
let err = errors:: UnknownBuiltinConstruct { span : lo. to ( ident. span ) , name : ident. name }
1896
- . into_diagnostic ( & self . sess . span_diagnostic ) ;
1896
+ . into_diagnostic ( self . diagnostic ( ) ) ;
1897
1897
return Err ( err) ;
1898
1898
} ;
1899
1899
self . expect ( & TokenKind :: CloseDelim ( Delimiter :: Parenthesis ) ) ?;
@@ -1957,7 +1957,7 @@ impl<'a> Parser<'a> {
1957
1957
&& matches ! ( e. kind, ExprKind :: Err )
1958
1958
{
1959
1959
let mut err = errors:: InvalidInterpolatedExpression { span : self . token . span }
1960
- . into_diagnostic ( & self . sess . span_diagnostic ) ;
1960
+ . into_diagnostic ( self . diagnostic ( ) ) ;
1961
1961
err. downgrade_to_delayed_bug ( ) ;
1962
1962
return Err ( err) ;
1963
1963
}
@@ -2169,7 +2169,7 @@ impl<'a> Parser<'a> {
2169
2169
return Err ( errors:: MissingSemicolonBeforeArray {
2170
2170
open_delim : open_delim_span,
2171
2171
semicolon : prev_span. shrink_to_hi ( ) ,
2172
- } . into_diagnostic ( & self . sess . span_diagnostic ) ) ;
2172
+ } . into_diagnostic ( self . diagnostic ( ) ) ) ;
2173
2173
}
2174
2174
Ok ( _) => ( ) ,
2175
2175
Err ( err) => err. cancel ( ) ,
@@ -2309,7 +2309,7 @@ impl<'a> Parser<'a> {
2309
2309
if self . check_keyword ( kw:: Async ) {
2310
2310
let move_async_span = self . token . span . with_lo ( self . prev_token . span . data ( ) . lo ) ;
2311
2311
Err ( errors:: AsyncMoveOrderIncorrect { span : move_async_span }
2312
- . into_diagnostic ( & self . sess . span_diagnostic ) )
2312
+ . into_diagnostic ( self . diagnostic ( ) ) )
2313
2313
} else {
2314
2314
Ok ( CaptureBy :: Value { move_kw : move_kw_span } )
2315
2315
}
@@ -2499,7 +2499,7 @@ impl<'a> Parser<'a> {
2499
2499
} ;
2500
2500
if self . prev_token . kind == token:: BinOp ( token:: Or ) {
2501
2501
// 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 ( ) ) ) ;
2503
2503
} else {
2504
2504
Some ( self . sess . emit_err ( err) )
2505
2505
}
@@ -3148,7 +3148,7 @@ impl<'a> Parser<'a> {
3148
3148
let ( attrs, body) = self . parse_inner_attrs_and_block ( ) ?;
3149
3149
if self . eat_keyword ( kw:: Catch ) {
3150
3150
Err ( errors:: CatchAfterTry { span : self . prev_token . span }
3151
- . into_diagnostic ( & self . sess . span_diagnostic ) )
3151
+ . into_diagnostic ( self . diagnostic ( ) ) )
3152
3152
} else {
3153
3153
let span = span_lo. to ( body. span ) ;
3154
3154
self . sess . gated_spans . gate ( sym:: try_blocks, span) ;
0 commit comments