@@ -1268,7 +1268,7 @@ impl<'a> Parser<'a> {
1268
1268
. collect ( ) ,
1269
1269
} ,
1270
1270
}
1271
- . into_diagnostic ( & self . sess . span_diagnostic ) ;
1271
+ . into_diagnostic ( self . diagnostic ( ) ) ;
1272
1272
replacement_err. emit ( ) ;
1273
1273
1274
1274
let old_err = mem:: replace ( err, replacement_err) ;
@@ -1690,7 +1690,7 @@ impl<'a> Parser<'a> {
1690
1690
err : impl FnOnce ( & Self ) -> DiagnosticBuilder < ' a , ErrorGuaranteed > ,
1691
1691
) -> L {
1692
1692
if let Some ( mut diag) =
1693
- self . sess . span_diagnostic . steal_diagnostic ( lifetime. span , StashKey :: LifetimeIsChar )
1693
+ self . diagnostic ( ) . steal_diagnostic ( lifetime. span , StashKey :: LifetimeIsChar )
1694
1694
{
1695
1695
diag. span_suggestion_verbose (
1696
1696
lifetime. span . shrink_to_hi ( ) ,
@@ -1881,7 +1881,7 @@ impl<'a> Parser<'a> {
1881
1881
1882
1882
let Some ( ( ident, false ) ) = self . token . ident ( ) else {
1883
1883
let err = errors:: ExpectedBuiltinIdent { span : self . token . span }
1884
- . into_diagnostic ( & self . sess . span_diagnostic ) ;
1884
+ . into_diagnostic ( self . diagnostic ( ) ) ;
1885
1885
return Err ( err) ;
1886
1886
} ;
1887
1887
self . sess . gated_spans . gate ( sym:: builtin_syntax, ident. span ) ;
@@ -1892,7 +1892,7 @@ impl<'a> Parser<'a> {
1892
1892
Ok ( res)
1893
1893
} else {
1894
1894
let err = errors:: UnknownBuiltinConstruct { span : lo. to ( ident. span ) , name : ident. name }
1895
- . into_diagnostic ( & self . sess . span_diagnostic ) ;
1895
+ . into_diagnostic ( self . diagnostic ( ) ) ;
1896
1896
return Err ( err) ;
1897
1897
} ;
1898
1898
self . expect ( & TokenKind :: CloseDelim ( Delimiter :: Parenthesis ) ) ?;
@@ -1956,7 +1956,7 @@ impl<'a> Parser<'a> {
1956
1956
&& matches ! ( e. kind, ExprKind :: Err )
1957
1957
{
1958
1958
let mut err = errors:: InvalidInterpolatedExpression { span : self . token . span }
1959
- . into_diagnostic ( & self . sess . span_diagnostic ) ;
1959
+ . into_diagnostic ( self . diagnostic ( ) ) ;
1960
1960
err. downgrade_to_delayed_bug ( ) ;
1961
1961
return Err ( err) ;
1962
1962
}
@@ -2168,7 +2168,7 @@ impl<'a> Parser<'a> {
2168
2168
return Err ( errors:: MissingSemicolonBeforeArray {
2169
2169
open_delim : open_delim_span,
2170
2170
semicolon : prev_span. shrink_to_hi ( ) ,
2171
- } . into_diagnostic ( & self . sess . span_diagnostic ) ) ;
2171
+ } . into_diagnostic ( self . diagnostic ( ) ) ) ;
2172
2172
}
2173
2173
Ok ( _) => ( ) ,
2174
2174
Err ( err) => err. cancel ( ) ,
@@ -2308,7 +2308,7 @@ impl<'a> Parser<'a> {
2308
2308
if self . check_keyword ( kw:: Async ) {
2309
2309
let move_async_span = self . token . span . with_lo ( self . prev_token . span . data ( ) . lo ) ;
2310
2310
Err ( errors:: AsyncMoveOrderIncorrect { span : move_async_span }
2311
- . into_diagnostic ( & self . sess . span_diagnostic ) )
2311
+ . into_diagnostic ( self . diagnostic ( ) ) )
2312
2312
} else {
2313
2313
Ok ( CaptureBy :: Value { move_kw : move_kw_span } )
2314
2314
}
@@ -2496,7 +2496,7 @@ impl<'a> Parser<'a> {
2496
2496
} ;
2497
2497
if self . prev_token . kind == token:: BinOp ( token:: Or ) {
2498
2498
// This was part of a closure, the that part of the parser recover.
2499
- return Err ( err. into_diagnostic ( & self . sess . span_diagnostic ) ) ;
2499
+ return Err ( err. into_diagnostic ( self . diagnostic ( ) ) ) ;
2500
2500
} else {
2501
2501
Some ( self . sess . emit_err ( err) )
2502
2502
}
@@ -3056,7 +3056,7 @@ impl<'a> Parser<'a> {
3056
3056
let ( attrs, body) = self . parse_inner_attrs_and_block ( ) ?;
3057
3057
if self . eat_keyword ( kw:: Catch ) {
3058
3058
Err ( errors:: CatchAfterTry { span : self . prev_token . span }
3059
- . into_diagnostic ( & self . sess . span_diagnostic ) )
3059
+ . into_diagnostic ( self . diagnostic ( ) ) )
3060
3060
} else {
3061
3061
let span = span_lo. to ( body. span ) ;
3062
3062
self . sess . gated_spans . gate ( sym:: try_blocks, span) ;
0 commit comments