@@ -40,11 +40,11 @@ pub enum KlintAttribute {
4040
4141struct Cursor < ' a > {
4242 eof : TokenTree ,
43- cursor : tokenstream:: RefTokenTreeCursor < ' a > ,
43+ cursor : tokenstream:: TokenStreamIter < ' a > ,
4444}
4545
4646impl < ' a > Cursor < ' a > {
47- fn new ( cursor : tokenstream:: RefTokenTreeCursor < ' a > , end_span : Span ) -> Self {
47+ fn new ( cursor : tokenstream:: TokenStreamIter < ' a > , end_span : Span ) -> Self {
4848 let eof = TokenTree :: Token (
4949 token:: Token {
5050 kind : token:: TokenKind :: Eof ,
@@ -56,11 +56,11 @@ impl<'a> Cursor<'a> {
5656 }
5757
5858 fn is_eof ( & self ) -> bool {
59- self . cursor . look_ahead ( 0 ) . is_none ( )
59+ self . cursor . peek ( ) . is_none ( )
6060 }
6161
62- fn look_ahead ( & self , n : usize ) -> & TokenTree {
63- self . cursor . look_ahead ( n ) . unwrap_or ( & self . eof )
62+ fn peek ( & self ) -> & TokenTree {
63+ self . cursor . peek ( ) . unwrap_or ( & self . eof )
6464 }
6565
6666 fn next ( & mut self ) -> & TokenTree {
@@ -148,7 +148,7 @@ impl<'tcx> AttrParser<'tcx> {
148148 let need_eq = need_eq ( name) ?;
149149
150150 // Check and skip `=`.
151- let eq = cursor. look_ahead ( 0 ) ;
151+ let eq = cursor. peek ( ) ;
152152 let is_eq = matches ! (
153153 eq,
154154 TokenTree :: Token (
@@ -187,7 +187,7 @@ impl<'tcx> AttrParser<'tcx> {
187187 } ;
188188
189189 let negative = if matches ! (
190- cursor. look_ahead ( 0 ) ,
190+ cursor. peek ( ) ,
191191 TokenTree :: Token (
192192 token:: Token {
193193 kind: token:: TokenKind :: BinOp ( token:: BinOpToken :: Minus ) ,
@@ -234,10 +234,10 @@ impl<'tcx> AttrParser<'tcx> {
234234 } )
235235 } ;
236236
237- let start_span = cursor. look_ahead ( 0 ) . span ( ) ;
237+ let start_span = cursor. peek ( ) . span ( ) ;
238238 let mut start = 0 ;
239239 if !matches ! (
240- cursor. look_ahead ( 0 ) ,
240+ cursor. peek ( ) ,
241241 TokenTree :: Token (
242242 token:: Token {
243243 kind: token:: TokenKind :: DotDot | token:: TokenKind :: DotDotEq ,
@@ -266,7 +266,7 @@ impl<'tcx> AttrParser<'tcx> {
266266 start = v;
267267 }
268268
269- let inclusive = match cursor. look_ahead ( 0 ) {
269+ let inclusive = match cursor. peek ( ) {
270270 TokenTree :: Token (
271271 token:: Token {
272272 kind : token:: TokenKind :: DotDot ,
@@ -288,7 +288,7 @@ impl<'tcx> AttrParser<'tcx> {
288288 if let Some ( inclusive) = inclusive {
289289 cursor. next ( ) ;
290290
291- let skip_hi = match cursor. look_ahead ( 0 ) {
291+ let skip_hi = match cursor. peek ( ) {
292292 TokenTree :: Token (
293293 token:: Token {
294294 kind : token:: TokenKind :: Comma | token:: TokenKind :: Eof ,
@@ -355,7 +355,7 @@ impl<'tcx> AttrParser<'tcx> {
355355 } ) ?;
356356 } ;
357357
358- self . parse_comma_delimited ( Cursor :: new ( tts. trees ( ) , delim_span. close ) , |cursor| {
358+ self . parse_comma_delimited ( Cursor :: new ( tts. iter ( ) , delim_span. close ) , |cursor| {
359359 self . parse_eq_delimited (
360360 cursor,
361361 |name| {
0 commit comments