@@ -238,7 +238,7 @@ fn maybe_append(mut lhs: Vec<Attribute>, rhs: Option<Vec<Attribute>>)
238
238
}
239
239
240
240
#[ derive( PartialEq ) ]
241
- enum LastTokenKind {
241
+ enum PrevTokenKind {
242
242
DocComment ,
243
243
Comma ,
244
244
Interpolated ,
@@ -258,7 +258,7 @@ pub struct Parser<'a> {
258
258
pub prev_span : Span ,
259
259
pub cfg : CrateConfig ,
260
260
/// the previous token kind
261
- last_token_kind : LastTokenKind ,
261
+ prev_token_kind : PrevTokenKind ,
262
262
pub buffer : [ TokenAndSpan ; 4 ] ,
263
263
pub buffer_start : isize ,
264
264
pub buffer_end : isize ,
@@ -369,7 +369,7 @@ impl<'a> Parser<'a> {
369
369
token : tok0. tok ,
370
370
span : span,
371
371
prev_span : span,
372
- last_token_kind : LastTokenKind :: Other ,
372
+ prev_token_kind : PrevTokenKind :: Other ,
373
373
buffer : [
374
374
placeholder. clone ( ) ,
375
375
placeholder. clone ( ) ,
@@ -504,7 +504,7 @@ impl<'a> Parser<'a> {
504
504
expr : PResult < ' a , P < Expr > > )
505
505
-> PResult < ' a , ( Span , P < Expr > ) > {
506
506
expr. map ( |e| {
507
- if self . last_token_kind == LastTokenKind :: Interpolated {
507
+ if self . prev_token_kind == PrevTokenKind :: Interpolated {
508
508
( self . prev_span , e)
509
509
} else {
510
510
( e. span , e)
@@ -524,7 +524,7 @@ impl<'a> Parser<'a> {
524
524
self . bug ( "ident interpolation not converted to real token" ) ;
525
525
}
526
526
_ => {
527
- Err ( if self . last_token_kind == LastTokenKind :: DocComment {
527
+ Err ( if self . prev_token_kind == PrevTokenKind :: DocComment {
528
528
self . span_fatal_help ( self . prev_span ,
529
529
"found a documentation comment that doesn't document anything" ,
530
530
"doc comments must come before what they document, maybe a comment was \
@@ -922,20 +922,20 @@ impl<'a> Parser<'a> {
922
922
923
923
/// Advance the parser by one token
924
924
pub fn bump ( & mut self ) {
925
- if self . last_token_kind == LastTokenKind :: Eof {
925
+ if self . prev_token_kind == PrevTokenKind :: Eof {
926
926
// Bumping after EOF is a bad sign, usually an infinite loop.
927
927
self . bug ( "attempted to bump the parser past EOF (may be stuck in a loop)" ) ;
928
928
}
929
929
930
930
self . prev_span = self . span ;
931
931
932
932
// Record last token kind for possible error recovery.
933
- self . last_token_kind = match self . token {
934
- token:: DocComment ( ..) => LastTokenKind :: DocComment ,
935
- token:: Comma => LastTokenKind :: Comma ,
936
- token:: Interpolated ( ..) => LastTokenKind :: Interpolated ,
937
- token:: Eof => LastTokenKind :: Eof ,
938
- _ => LastTokenKind :: Other ,
933
+ self . prev_token_kind = match self . token {
934
+ token:: DocComment ( ..) => PrevTokenKind :: DocComment ,
935
+ token:: Comma => PrevTokenKind :: Comma ,
936
+ token:: Interpolated ( ..) => PrevTokenKind :: Interpolated ,
937
+ token:: Eof => PrevTokenKind :: Eof ,
938
+ _ => PrevTokenKind :: Other ,
939
939
} ;
940
940
941
941
let next = if self . buffer_start == self . buffer_end {
@@ -976,8 +976,8 @@ impl<'a> Parser<'a> {
976
976
self . prev_span = mk_sp ( self . span . lo , lo) ;
977
977
// It would be incorrect to record the kind of the current token, but
978
978
// fortunately for tokens currently using `bump_with`, the
979
- // last_token_kind will be of no use anyway.
980
- self . last_token_kind = LastTokenKind :: Other ;
979
+ // prev_token_kind will be of no use anyway.
980
+ self . prev_token_kind = PrevTokenKind :: Other ;
981
981
self . span = mk_sp ( lo, hi) ;
982
982
self . token = next;
983
983
self . expected_tokens . clear ( ) ;
@@ -2950,7 +2950,7 @@ impl<'a> Parser<'a> {
2950
2950
self . expected_tokens . push ( TokenType :: Operator ) ;
2951
2951
while let Some ( op) = AssocOp :: from_token ( & self . token ) {
2952
2952
2953
- let lhs_span = if self . last_token_kind == LastTokenKind :: Interpolated {
2953
+ let lhs_span = if self . prev_token_kind == PrevTokenKind :: Interpolated {
2954
2954
self . prev_span
2955
2955
} else {
2956
2956
lhs. span
@@ -4019,7 +4019,7 @@ impl<'a> Parser<'a> {
4019
4019
None => {
4020
4020
let unused_attrs = |attrs : & [ _ ] , s : & mut Self | {
4021
4021
if attrs. len ( ) > 0 {
4022
- if s. last_token_kind == LastTokenKind :: DocComment {
4022
+ if s. prev_token_kind == PrevTokenKind :: DocComment {
4023
4023
s. span_err_help ( s. prev_span ,
4024
4024
"found a documentation comment that doesn't document anything" ,
4025
4025
"doc comments must come before what they document, maybe a \
@@ -4338,7 +4338,7 @@ impl<'a> Parser<'a> {
4338
4338
4339
4339
let missing_comma = !lifetimes. is_empty ( ) &&
4340
4340
!self . token . is_like_gt ( ) &&
4341
- self . last_token_kind != LastTokenKind :: Comma ;
4341
+ self . prev_token_kind != PrevTokenKind :: Comma ;
4342
4342
4343
4343
if missing_comma {
4344
4344
0 commit comments