@@ -200,7 +200,7 @@ impl<'a> Parser<'a> {
200
200
pub ( super ) fn expected_ident_found ( & self ) -> DiagnosticBuilder < ' a > {
201
201
let mut err = self . struct_span_err (
202
202
self . token . span ,
203
- & format ! ( "expected identifier, found {}" , self . this_token_descr ( ) ) ,
203
+ & format ! ( "expected identifier, found {}" , super :: token_descr ( & self . token ) ) ,
204
204
) ;
205
205
let valid_follow = & [
206
206
TokenKind :: Eq ,
@@ -225,7 +225,7 @@ impl<'a> Parser<'a> {
225
225
) ;
226
226
}
227
227
}
228
- if let Some ( token_descr) = self . token_descr ( ) {
228
+ if let Some ( token_descr) = super :: token_descr_opt ( & self . token ) {
229
229
err. span_label ( self . token . span , format ! ( "expected identifier, found {}" , token_descr) ) ;
230
230
} else {
231
231
err. span_label ( self . token . span , "expected identifier" ) ;
@@ -272,7 +272,7 @@ impl<'a> Parser<'a> {
272
272
expected. sort_by_cached_key ( |x| x. to_string ( ) ) ;
273
273
expected. dedup ( ) ;
274
274
let expect = tokens_to_string ( & expected[ ..] ) ;
275
- let actual = self . this_token_descr ( ) ;
275
+ let actual = super :: token_descr ( & self . token ) ;
276
276
let ( msg_exp, ( label_sp, label_exp) ) = if expected. len ( ) > 1 {
277
277
let short_expect = if expected. len ( ) > 6 {
278
278
format ! ( "{} possible tokens" , expected. len( ) )
@@ -815,7 +815,7 @@ impl<'a> Parser<'a> {
815
815
t : & TokenKind ,
816
816
) -> PResult < ' a , bool /* recovered */ > {
817
817
let token_str = pprust:: token_kind_to_string ( t) ;
818
- let this_token_str = self . this_token_descr ( ) ;
818
+ let this_token_str = super :: token_descr ( & self . token ) ;
819
819
let ( prev_sp, sp) = match ( & self . token . kind , self . subparser_name ) {
820
820
// Point at the end of the macro call when reaching end of macro arguments.
821
821
( token:: Eof , Some ( _) ) => {
@@ -862,7 +862,7 @@ impl<'a> Parser<'a> {
862
862
return Ok ( ( ) ) ;
863
863
}
864
864
let sm = self . sess . source_map ( ) ;
865
- let msg = format ! ( "expected `;`, found `{}`" , self . this_token_descr ( ) ) ;
865
+ let msg = format ! ( "expected `;`, found `{}`" , super :: token_descr ( & self . token ) ) ;
866
866
let appl = Applicability :: MachineApplicable ;
867
867
if self . token . span == DUMMY_SP || self . prev_span == DUMMY_SP {
868
868
// Likely inside a macro, can't provide meaninful suggestions.
@@ -1270,7 +1270,7 @@ impl<'a> Parser<'a> {
1270
1270
}
1271
1271
1272
1272
pub ( super ) fn expected_semi_or_open_brace < T > ( & mut self ) -> PResult < ' a , T > {
1273
- let token_str = self . this_token_descr ( ) ;
1273
+ let token_str = super :: token_descr ( & self . token ) ;
1274
1274
let mut err = self . fatal ( & format ! ( "expected `;` or `{{`, found {}" , token_str) ) ;
1275
1275
err. span_label ( self . token . span , "expected `;` or `{`" ) ;
1276
1276
Err ( err)
@@ -1447,7 +1447,7 @@ impl<'a> Parser<'a> {
1447
1447
}
1448
1448
_ => (
1449
1449
self . token . span ,
1450
- format ! ( "expected expression, found {}" , self . this_token_descr ( ) , ) ,
1450
+ format ! ( "expected expression, found {}" , super :: token_descr ( & self . token ) , ) ,
1451
1451
) ,
1452
1452
} ;
1453
1453
let mut err = self . struct_span_err ( span, & msg) ;
0 commit comments