@@ -200,7 +200,7 @@ impl<'a> Parser<'a> {
200200 pub ( super ) fn expected_ident_found ( & self ) -> DiagnosticBuilder < ' a > {
201201 let mut err = self . struct_span_err (
202202 self . token . span ,
203- & format ! ( "expected identifier, found {}" , self . this_token_descr ( ) ) ,
203+ & format ! ( "expected identifier, found {}" , super :: token_descr ( & self . token ) ) ,
204204 ) ;
205205 let valid_follow = & [
206206 TokenKind :: Eq ,
@@ -225,7 +225,7 @@ impl<'a> Parser<'a> {
225225 ) ;
226226 }
227227 }
228- if let Some ( token_descr) = self . token_descr ( ) {
228+ if let Some ( token_descr) = super :: token_descr_opt ( & self . token ) {
229229 err. span_label ( self . token . span , format ! ( "expected identifier, found {}" , token_descr) ) ;
230230 } else {
231231 err. span_label ( self . token . span , "expected identifier" ) ;
@@ -272,7 +272,7 @@ impl<'a> Parser<'a> {
272272 expected. sort_by_cached_key ( |x| x. to_string ( ) ) ;
273273 expected. dedup ( ) ;
274274 let expect = tokens_to_string ( & expected[ ..] ) ;
275- let actual = self . this_token_descr ( ) ;
275+ let actual = super :: token_descr ( & self . token ) ;
276276 let ( msg_exp, ( label_sp, label_exp) ) = if expected. len ( ) > 1 {
277277 let short_expect = if expected. len ( ) > 6 {
278278 format ! ( "{} possible tokens" , expected. len( ) )
@@ -815,7 +815,7 @@ impl<'a> Parser<'a> {
815815 t : & TokenKind ,
816816 ) -> PResult < ' a , bool /* recovered */ > {
817817 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 ) ;
819819 let ( prev_sp, sp) = match ( & self . token . kind , self . subparser_name ) {
820820 // Point at the end of the macro call when reaching end of macro arguments.
821821 ( token:: Eof , Some ( _) ) => {
@@ -862,7 +862,7 @@ impl<'a> Parser<'a> {
862862 return Ok ( ( ) ) ;
863863 }
864864 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 ) ) ;
866866 let appl = Applicability :: MachineApplicable ;
867867 if self . token . span == DUMMY_SP || self . prev_span == DUMMY_SP {
868868 // Likely inside a macro, can't provide meaninful suggestions.
@@ -1270,7 +1270,7 @@ impl<'a> Parser<'a> {
12701270 }
12711271
12721272 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 ) ;
12741274 let mut err = self . fatal ( & format ! ( "expected `;` or `{{`, found {}" , token_str) ) ;
12751275 err. span_label ( self . token . span , "expected `;` or `{`" ) ;
12761276 Err ( err)
@@ -1447,7 +1447,7 @@ impl<'a> Parser<'a> {
14471447 }
14481448 _ => (
14491449 self . token . span ,
1450- format ! ( "expected expression, found {}" , self . this_token_descr ( ) , ) ,
1450+ format ! ( "expected expression, found {}" , super :: token_descr ( & self . token ) , ) ,
14511451 ) ,
14521452 } ;
14531453 let mut err = self . struct_span_err ( span, & msg) ;
0 commit comments