11use crate :: ast;
2- use crate :: ast:: NodeId ;
32use crate :: ext:: mbe:: macro_parser;
43use crate :: ext:: mbe:: { TokenTree , KleeneOp , KleeneToken , SequenceRepetition , Delimited } ;
5- use crate :: feature_gate:: Features ;
64use crate :: parse:: token:: { self , Token } ;
75use crate :: parse:: ParseSess ;
86use crate :: print:: pprust;
97use crate :: symbol:: kw;
108use crate :: tokenstream;
119
12- use syntax_pos:: { edition :: Edition , Span } ;
10+ use syntax_pos:: Span ;
1311
1412use rustc_data_structures:: sync:: Lrc ;
15- use std:: iter:: Peekable ;
1613
1714/// Takes a `tokenstream::TokenStream` and returns a `Vec<self::TokenTree>`. Specifically, this
1815/// takes a generic `TokenStream`, such as is used in the rest of the compiler, and returns a
@@ -39,17 +36,13 @@ pub(super) fn parse(
3936 input : tokenstream:: TokenStream ,
4037 expect_matchers : bool ,
4138 sess : & ParseSess ,
42- features : & Features ,
43- attrs : & [ ast:: Attribute ] ,
44- edition : Edition ,
45- macro_node_id : NodeId ,
4639) -> Vec < TokenTree > {
4740 // Will contain the final collection of `self::TokenTree`
4841 let mut result = Vec :: new ( ) ;
4942
5043 // For each token tree in `input`, parse the token into a `self::TokenTree`, consuming
5144 // additional trees if need be.
52- let mut trees = input. trees ( ) . peekable ( ) ;
45+ let mut trees = input. trees ( ) ;
5346 while let Some ( tree) = trees. next ( ) {
5447 // Given the parsed tree, if there is a metavar and we are expecting matchers, actually
5548 // parse out the matcher (i.e., in `$id:ident` this would parse the `:` and `ident`).
@@ -58,10 +51,6 @@ pub(super) fn parse(
5851 & mut trees,
5952 expect_matchers,
6053 sess,
61- features,
62- attrs,
63- edition,
64- macro_node_id,
6554 ) ;
6655 match tree {
6756 TokenTree :: MetaVar ( start_sp, ident) if expect_matchers => {
@@ -109,13 +98,9 @@ pub(super) fn parse(
10998/// unstable features or not.
11099fn parse_tree (
111100 tree : tokenstream:: TokenTree ,
112- trees : & mut Peekable < impl Iterator < Item = tokenstream:: TokenTree > > ,
101+ trees : & mut impl Iterator < Item = tokenstream:: TokenTree > ,
113102 expect_matchers : bool ,
114103 sess : & ParseSess ,
115- features : & Features ,
116- attrs : & [ ast:: Attribute ] ,
117- edition : Edition ,
118- macro_node_id : NodeId ,
119104) -> TokenTree {
120105 // Depending on what `tree` is, we could be parsing different parts of a macro
121106 match tree {
@@ -135,10 +120,6 @@ fn parse_tree(
135120 tts. into ( ) ,
136121 expect_matchers,
137122 sess,
138- features,
139- attrs,
140- edition,
141- macro_node_id,
142123 ) ;
143124 // Get the Kleene operator and optional separator
144125 let ( separator, kleene) = parse_sep_and_kleene_op ( trees, span. entire ( ) , sess) ;
@@ -192,10 +173,6 @@ fn parse_tree(
192173 tts. into ( ) ,
193174 expect_matchers,
194175 sess,
195- features,
196- attrs,
197- edition,
198- macro_node_id,
199176 ) ,
200177 } ) ,
201178 ) ,
@@ -244,7 +221,7 @@ fn parse_kleene_op(
244221/// operator and separator, then a tuple with `(separator, KleeneOp)` is returned. Otherwise, an
245222/// error with the appropriate span is emitted to `sess` and a dummy value is returned.
246223fn parse_sep_and_kleene_op (
247- input : & mut Peekable < impl Iterator < Item = tokenstream:: TokenTree > > ,
224+ input : & mut impl Iterator < Item = tokenstream:: TokenTree > ,
248225 span : Span ,
249226 sess : & ParseSess ,
250227) -> ( Option < Token > , KleeneToken ) {
0 commit comments