about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-11-18 19:11:43 +0000
committerbors <bors@rust-lang.org>2014-11-18 19:11:43 +0000
commitc8d6e3b2c2a780eff92299da5d1c02e081617088 (patch)
tree019ec1d05e20c8eba60f305b4c79cc942c1f85d3 /src/libsyntax/parse/parser.rs
parent09e2ad13d0aa01143bcb20dece3ff6c5a7e34ea3 (diff)
parent6866bf32343ce784a256cd0b9c7686a560fd8aa6 (diff)
downloadrust-c8d6e3b2c2a780eff92299da5d1c02e081617088.tar.gz
rust-c8d6e3b2c2a780eff92299da5d1c02e081617088.zip
auto merge of #18993 : nikomatsakis/rust/hrtb-5, r=pcwalton
Enough said.

Fixes #18639.

r? @pcwalton (or someone else?)

This is a [breaking-change]. In particular, several feature gates related to unboxed closures were consolidated into one (`overloaded_calls`, `unboxed_closure_sugar` => `unboxed_closures`). Otherwise, I think everything that worked before should still work. File a bug and cc @nikomatsakis if you find otherwise. :)
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 98479d65cbb..40c4ac9f8c0 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1023,10 +1023,21 @@ impl<'a> Parser<'a> {
             self.parse_ty_bare_fn_or_ty_closure(lifetime_defs)
         } else if self.token == token::ModSep ||
                   self.token.is_ident() ||
-                  self.token.is_path() {
+                  self.token.is_path()
+        {
             let trait_ref = self.parse_trait_ref();
-            TyPolyTraitRef(P(PolyTraitRef { bound_lifetimes: lifetime_defs,
-                                            trait_ref: trait_ref }))
+            let poly_trait_ref = ast::PolyTraitRef { bound_lifetimes: lifetime_defs,
+                                                     trait_ref: trait_ref };
+            let other_bounds = if self.eat(&token::BinOp(token::Plus)) {
+                self.parse_ty_param_bounds()
+            } else {
+                OwnedSlice::empty()
+            };
+            let all_bounds =
+                Some(TraitTyParamBound(poly_trait_ref)).into_iter()
+                .chain(other_bounds.into_vec().into_iter())
+                .collect();
+            ast::TyPolyTraitRef(all_bounds)
         } else {
             self.parse_ty_closure(lifetime_defs)
         }