@@ -14,7 +14,7 @@ use syntax_pos::{Span, DUMMY_SP};
14
14
use errors:: { Handler , DiagnosticBuilder } ;
15
15
use ext:: tt:: macro_parser:: { NamedMatch , MatchedSeq , MatchedNonterminal } ;
16
16
use parse:: token:: { DocComment , MatchNt , SubstNt } ;
17
- use parse:: token:: { Token , Interpolated , NtIdent , NtTT , SpecialMacroVar } ;
17
+ use parse:: token:: { Token , Interpolated , NtIdent , NtTT } ;
18
18
use parse:: token;
19
19
use parse:: lexer:: TokenAndSpan ;
20
20
use tokenstream:: { self , TokenTree } ;
@@ -39,10 +39,7 @@ pub struct TtReader<'a> {
39
39
stack : Vec < TtFrame > ,
40
40
/* for MBE-style macro transcription */
41
41
interpolations : HashMap < Ident , Rc < NamedMatch > > ,
42
- imported_from : Option < Ident > ,
43
42
44
- // Some => return imported_from as the next token
45
- crate_name_next : Option < Span > ,
46
43
repeat_idx : Vec < usize > ,
47
44
repeat_len : Vec < usize > ,
48
45
/* cached: */
@@ -59,10 +56,9 @@ pub struct TtReader<'a> {
59
56
/// (and should) be None.
60
57
pub fn new_tt_reader ( sp_diag : & Handler ,
61
58
interp : Option < HashMap < Ident , Rc < NamedMatch > > > ,
62
- imported_from : Option < Ident > ,
63
59
src : Vec < tokenstream:: TokenTree > )
64
60
-> TtReader {
65
- new_tt_reader_with_doc_flag ( sp_diag, interp, imported_from , src, false )
61
+ new_tt_reader_with_doc_flag ( sp_diag, interp, src, false )
66
62
}
67
63
68
64
/// The extra `desugar_doc_comments` flag enables reading doc comments
@@ -73,7 +69,6 @@ pub fn new_tt_reader(sp_diag: &Handler,
73
69
/// (and should) be None.
74
70
pub fn new_tt_reader_with_doc_flag ( sp_diag : & Handler ,
75
71
interp : Option < HashMap < Ident , Rc < NamedMatch > > > ,
76
- imported_from : Option < Ident > ,
77
72
src : Vec < tokenstream:: TokenTree > ,
78
73
desugar_doc_comments : bool )
79
74
-> TtReader {
@@ -93,8 +88,6 @@ pub fn new_tt_reader_with_doc_flag(sp_diag: &Handler,
93
88
None => HashMap :: new ( ) ,
94
89
Some ( x) => x,
95
90
} ,
96
- imported_from : imported_from,
97
- crate_name_next : None ,
98
91
repeat_idx : Vec :: new ( ) ,
99
92
repeat_len : Vec :: new ( ) ,
100
93
desugar_doc_comments : desugar_doc_comments,
@@ -189,14 +182,6 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
189
182
sp : r. cur_span . clone ( ) ,
190
183
} ;
191
184
loop {
192
- match r. crate_name_next . take ( ) {
193
- None => ( ) ,
194
- Some ( sp) => {
195
- r. cur_span = sp;
196
- r. cur_tok = token:: Ident ( r. imported_from . unwrap ( ) ) ;
197
- return ret_val;
198
- } ,
199
- }
200
185
let should_pop = match r. stack . last ( ) {
201
186
None => {
202
187
assert_eq ! ( ret_val. tok, token:: Eof ) ;
@@ -346,18 +331,6 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
346
331
sep : None
347
332
} ) ;
348
333
}
349
- TokenTree :: Token ( sp, token:: SpecialVarNt ( SpecialMacroVar :: CrateMacroVar ) ) => {
350
- r. stack . last_mut ( ) . unwrap ( ) . idx += 1 ;
351
-
352
- if r. imported_from . is_some ( ) {
353
- r. cur_span = sp;
354
- r. cur_tok = token:: ModSep ;
355
- r. crate_name_next = Some ( sp) ;
356
- return ret_val;
357
- }
358
-
359
- // otherwise emit nothing and proceed to the next token
360
- }
361
334
TokenTree :: Token ( sp, tok) => {
362
335
r. cur_span = sp;
363
336
r. cur_tok = tok;
0 commit comments