File tree Expand file tree Collapse file tree 2 files changed +28
-9
lines changed
compiler/rustc_parse/src/parser Expand file tree Collapse file tree 2 files changed +28
-9
lines changed Original file line number Diff line number Diff line change @@ -929,16 +929,20 @@ impl<'a> Parser<'a> {
929929 return looker ( & self . token ) ;
930930 }
931931
932- let frame = & self . token_cursor . frame ;
933- match frame. tree_cursor . look_ahead ( dist - 1 ) {
934- Some ( tree) => match tree {
935- TokenTree :: Token ( token) => looker ( token) ,
936- TokenTree :: Delimited ( dspan, delim, _) => {
937- looker ( & Token :: new ( token:: OpenDelim ( * delim) , dspan. open ) )
938- }
939- } ,
940- None => looker ( & Token :: new ( token:: CloseDelim ( frame. delim ) , frame. span . close ) ) ,
932+ let mut cursor = self . token_cursor . clone ( ) ;
933+ let mut i = 0 ;
934+ let mut token = Token :: dummy ( ) ;
935+ while i < dist {
936+ token = cursor. next ( ) . 0 ;
937+ if matches ! (
938+ token. kind,
939+ token:: OpenDelim ( token:: NoDelim ) | token:: CloseDelim ( token:: NoDelim )
940+ ) {
941+ continue ;
942+ }
943+ i += 1 ;
941944 }
945+ return looker ( & token) ;
942946 }
943947
944948 /// Returns whether any of the given keywords are `dist` tokens ahead of the current one.
Original file line number Diff line number Diff line change 1+ // check-pass
2+
3+ macro_rules! make_struct {
4+ ( $name: ident) => {
5+ #[ derive( Debug ) ]
6+ struct Foo {
7+ #[ cfg( not( FALSE ) ) ]
8+ field: fn ( $name: bool )
9+ }
10+ }
11+ }
12+
13+ make_struct ! ( param_name) ;
14+
15+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments