File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 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> {
12771277 "at least one type parameter bound \
12781278 must be specified") ;
12791279 }
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 {
12811288 let poly_trait_ref = PolyTraitRef {
12821289 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 } ,
12841291 span : lhs. span ,
12851292 } ;
12861293 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