@@ -101,8 +101,6 @@ pub struct Parser<'a> {
101
101
/// Use this if you need to check for `token::Ident` or `token::Lifetime` specifically,
102
102
/// this also includes edition checks for edition-specific keyword identifiers.
103
103
pub normalized_prev_token : Token ,
104
- /// FIXME: Remove in favor of the equivalent `prev_token.span`.
105
- pub prev_span : Span ,
106
104
restrictions : Restrictions ,
107
105
/// Used to determine the path to externally loaded source files.
108
106
pub ( super ) directory : Directory ,
@@ -377,7 +375,6 @@ impl<'a> Parser<'a> {
377
375
normalized_token : Token :: dummy ( ) ,
378
376
prev_token : Token :: dummy ( ) ,
379
377
normalized_prev_token : Token :: dummy ( ) ,
380
- prev_span : DUMMY_SP ,
381
378
restrictions : Restrictions :: empty ( ) ,
382
379
recurse_into_file_modules,
383
380
directory : Directory {
@@ -848,9 +845,6 @@ impl<'a> Parser<'a> {
848
845
self . normalized_prev_token = self . normalized_token . take ( ) ;
849
846
self . set_token ( next_token) ;
850
847
851
- // Update fields derived from the previous token.
852
- self . prev_span = self . prev_token . span ;
853
-
854
848
// Diagnostics.
855
849
self . expected_tokens . clear ( ) ;
856
850
}
@@ -897,12 +891,20 @@ impl<'a> Parser<'a> {
897
891
898
892
/// Parses unsafety: `unsafe` or nothing.
899
893
fn parse_unsafety ( & mut self ) -> Unsafe {
900
- if self . eat_keyword ( kw:: Unsafe ) { Unsafe :: Yes ( self . prev_span ) } else { Unsafe :: No }
894
+ if self . eat_keyword ( kw:: Unsafe ) {
895
+ Unsafe :: Yes ( self . normalized_prev_token . span )
896
+ } else {
897
+ Unsafe :: No
898
+ }
901
899
}
902
900
903
901
/// Parses constness: `const` or nothing.
904
902
fn parse_constness ( & mut self ) -> Const {
905
- if self . eat_keyword ( kw:: Const ) { Const :: Yes ( self . prev_span ) } else { Const :: No }
903
+ if self . eat_keyword ( kw:: Const ) {
904
+ Const :: Yes ( self . normalized_prev_token . span )
905
+ } else {
906
+ Const :: No
907
+ }
906
908
}
907
909
908
910
/// Parses mutability (`mut` or nothing).
0 commit comments