about summary refs log tree commit diff
path: root/src/libsyntax_ext
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2018-05-28 13:33:28 +0100
committervarkor <github@varkor.com>2018-06-20 12:22:46 +0100
commitaed530a457dd937fa633dfe52cf07811196d3173 (patch)
treed7848036bf766e1153e965028d8c4c5c8ecb5940 /src/libsyntax_ext
parenta5328bc17b8d18083478554b3381d55183647f15 (diff)
downloadrust-aed530a457dd937fa633dfe52cf07811196d3173.tar.gz
rust-aed530a457dd937fa633dfe52cf07811196d3173.zip
Lift bounds into GenericParam
Diffstat (limited to 'src/libsyntax_ext')
-rw-r--r--src/libsyntax_ext/deriving/generic/mod.rs15
-rw-r--r--src/libsyntax_ext/deriving/generic/ty.rs7
2 files changed, 10 insertions, 12 deletions
diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs
index 1024d445cdb..a7d8156f4a0 100644
--- a/src/libsyntax_ext/deriving/generic/mod.rs
+++ b/src/libsyntax_ext/deriving/generic/mod.rs
@@ -551,22 +551,21 @@ impl<'a> TraitDef<'a> {
         // Create the generic parameters
         params.extend(generics.params.iter().map(|param| match param.kind {
             GenericParamKind::Lifetime { .. } => param.clone(),
-            GenericParamKind::Type { bounds: ref ty_bounds, .. } => {
+            GenericParamKind::Type { .. } => {
                 // I don't think this can be moved out of the loop, since
-                // a TyParamBound requires an ast id
+                // a ParamBound requires an ast id
                 let mut bounds: Vec<_> =
                     // extra restrictions on the generics parameters to the
                     // type being derived upon
                     self.additional_bounds.iter().map(|p| {
-                        cx.typarambound(p.to_path(cx, self.span,
-                                                    type_ident, generics))
+                        cx.ty_param_bound(p.to_path(cx, self.span, type_ident, generics))
                     }).collect();
 
                 // require the current trait
-                bounds.push(cx.typarambound(trait_path.clone()));
+                bounds.push(cx.ty_param_bound(trait_path.clone()));
 
                 // also add in any bounds from the declaration
-                for declared_bound in ty_bounds {
+                for declared_bound in &param.bounds {
                     bounds.push((*declared_bound).clone());
                 }
 
@@ -635,12 +634,12 @@ impl<'a> TraitDef<'a> {
                         let mut bounds: Vec<_> = self.additional_bounds
                             .iter()
                             .map(|p| {
-                                cx.typarambound(p.to_path(cx, self.span, type_ident, generics))
+                                cx.ty_param_bound(p.to_path(cx, self.span, type_ident, generics))
                             })
                             .collect();
 
                         // require the current trait
-                        bounds.push(cx.typarambound(trait_path.clone()));
+                        bounds.push(cx.ty_param_bound(trait_path.clone()));
 
                         let predicate = ast::WhereBoundPredicate {
                             span: self.span,
diff --git a/src/libsyntax_ext/deriving/generic/ty.rs b/src/libsyntax_ext/deriving/generic/ty.rs
index 127ed62b8c5..327a35d39b3 100644
--- a/src/libsyntax_ext/deriving/generic/ty.rs
+++ b/src/libsyntax_ext/deriving/generic/ty.rs
@@ -219,7 +219,7 @@ fn mk_ty_param(cx: &ExtCtxt,
     let bounds = bounds.iter()
         .map(|b| {
             let path = b.to_path(cx, span, self_ident, self_generics);
-            cx.typarambound(path)
+            cx.ty_param_bound(path)
         })
         .collect();
     cx.typaram(span, cx.ident_of(name), attrs.to_owned(), bounds, None)
@@ -261,9 +261,8 @@ impl<'a> LifetimeBounds<'a> {
             .iter()
             .map(|&(lt, ref bounds)| {
                 let bounds = bounds.iter()
-                    .map(|b| cx.lifetime(span, Ident::from_str(b)))
-                    .collect();
-                cx.lifetime_def(span, Ident::from_str(lt), vec![], bounds)
+                    .map(|b| ast::ParamBound::Outlives(cx.lifetime(span, Ident::from_str(b))));
+                cx.lifetime_def(span, Ident::from_str(lt), vec![], bounds.collect())
             })
             .chain(self.bounds
                 .iter()