File tree 2 files changed +24
-2
lines changed
2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -1277,10 +1277,17 @@ impl<'a> Parser<'a> {
1277
1277
"at least one type parameter bound \
1278
1278
must be specified") ;
1279
1279
}
1280
- if let TyKind :: Path ( None , ref path) = lhs. node {
1280
+
1281
+ let mut lhs = lhs. unwrap ( ) ;
1282
+ if let TyKind :: Paren ( ty) = lhs. node {
1283
+ // We have to accept the first bound in parens for backward compatibility.
1284
+ // Example: `(Bound) + Bound + Bound`
1285
+ lhs = ty. unwrap ( ) ;
1286
+ }
1287
+ if let TyKind :: Path ( None , path) = lhs. node {
1281
1288
let poly_trait_ref = PolyTraitRef {
1282
1289
bound_lifetimes : Vec :: new ( ) ,
1283
- trait_ref : TraitRef { path : path. clone ( ) , ref_id : lhs. id } ,
1290
+ trait_ref : TraitRef { path : path, ref_id : lhs. id } ,
1284
1291
span : lhs. span ,
1285
1292
} ;
1286
1293
let poly_trait_ref = TraitTyParamBound ( poly_trait_ref, TraitBoundModifier :: None ) ;
Original file line number Diff line number Diff line change
1
+ // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // compile-flags: -Z parse-only
12
+
13
+ type A = Box < ( Fn ( D :: Error ) -> E ) + ' static + Send + Sync > ; // OK
14
+
15
+ FAIL //~ ERROR
You can’t perform that action at this time.
0 commit comments