File tree 3 files changed +35
-2
lines changed
compiler/rustc_parse/src/parser
3 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -694,8 +694,9 @@ impl<'a> Parser<'a> {
694
694
// `where`, so stop if it's it.
695
695
// We also continue if we find types (not traits), again for error recovery.
696
696
while self . can_begin_bound ( )
697
- || self . token . can_begin_type ( )
698
- || ( self . token . is_reserved_ident ( ) && !self . token . is_keyword ( kw:: Where ) )
697
+ || ( self . may_recover ( )
698
+ && ( self . token . can_begin_type ( )
699
+ || ( self . token . is_reserved_ident ( ) && !self . token . is_keyword ( kw:: Where ) ) ) )
699
700
{
700
701
if self . token . is_keyword ( kw:: Dyn ) {
701
702
// Account for `&dyn Trait + dyn Other`.
Original file line number Diff line number Diff line change
1
+ // check-pass
2
+
3
+ // edition:2021
4
+ // for the `impl` + keyword test
5
+
6
+ macro_rules! impl_primitive {
7
+ ( $ty: ty) => {
8
+ compile_error!( "whoops" ) ;
9
+ } ;
10
+ ( impl async ) => { } ;
11
+ }
12
+
13
+ impl_primitive ! ( impl async ) ;
14
+
15
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ // check-pass
2
+
3
+ macro_rules! impl_primitive {
4
+ ( $ty: ty) => { impl_primitive!( impl $ty) ; } ;
5
+ ( impl $ty: ty) => { fn a( _: $ty) { } }
6
+ }
7
+
8
+ impl_primitive ! { u8 }
9
+
10
+ macro_rules! test {
11
+ ( $ty: ty) => { compile_error!( "oh no" ) ; } ;
12
+ ( impl & ) => { } ;
13
+ }
14
+
15
+ test ! ( impl & ) ;
16
+
17
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments