about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc/metadata/decoder.rs4
-rw-r--r--src/librustc/middle/astencode.rs3
-rw-r--r--src/librustc/middle/ty.rs17
-rw-r--r--src/librustc/middle/ty_fold.rs19
-rw-r--r--src/librustc_typeck/lib.rs1
5 files changed, 43 insertions, 1 deletions
diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs
index 23bd37486bc..79bfc46dca8 100644
--- a/src/librustc/metadata/decoder.rs
+++ b/src/librustc/metadata/decoder.rs
@@ -1437,7 +1437,9 @@ fn doc_generics<'tcx>(base_doc: rbml::Doc,
         true
     });
 
-    ty::Generics { types: types, regions: regions }
+    let predicates = subst::VecPerParamSpace::empty(); // TODO fix in later commit
+
+    ty::Generics { types: types, regions: regions, predicates: predicates }
 }
 
 pub fn is_associated_type(cdata: Cmd, id: ast::NodeId) -> bool {
diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs
index 8c2fbc078e2..319337bf48b 100644
--- a/src/librustc/middle/astencode.rs
+++ b/src/librustc/middle/astencode.rs
@@ -1554,6 +1554,9 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
                                 Ok(this.read_vec_per_param_space(
                                     |this| Decodable::decode(this).unwrap()))
                             }).unwrap(),
+
+                            predicates:
+                            subst::VecPerParamSpace::empty(), // TODO fix in later commit
                         })
                     })
                 }).unwrap(),
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index ee13fc5e346..ef8e3f3b2d7 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -1619,6 +1619,22 @@ pub struct RegionParameterDef {
 pub struct Generics<'tcx> {
     pub types: VecPerParamSpace<TypeParameterDef<'tcx>>,
     pub regions: VecPerParamSpace<RegionParameterDef>,
+    pub predicates: VecPerParamSpace<Predicate<'tcx>>,
+}
+
+#[deriving(Clone, Show)]
+pub enum Predicate<'tcx> {
+    /// where Foo : Bar
+    Trait(Rc<TraitRef<'tcx>>),
+
+    /// where Foo == Bar
+    Equate(Ty<'tcx>, Ty<'tcx>),
+
+    /// where 'a : 'b
+    RegionOutlives(Region, Region),
+
+    /// where T : 'a
+    TypeOutlives(Ty<'tcx>, Region),
 }
 
 impl<'tcx> Generics<'tcx> {
@@ -1626,6 +1642,7 @@ impl<'tcx> Generics<'tcx> {
         Generics {
             types: VecPerParamSpace::empty(),
             regions: VecPerParamSpace::empty(),
+            predicates: VecPerParamSpace::empty(),
         }
     }
 
diff --git a/src/librustc/middle/ty_fold.rs b/src/librustc/middle/ty_fold.rs
index 543d2bdd957..87467ba064a 100644
--- a/src/librustc/middle/ty_fold.rs
+++ b/src/librustc/middle/ty_fold.rs
@@ -399,6 +399,25 @@ impl<'tcx> TypeFoldable<'tcx> for ty::Generics<'tcx> {
         ty::Generics {
             types: self.types.fold_with(folder),
             regions: self.regions.fold_with(folder),
+            predicates: self.predicates.fold_with(folder),
+        }
+    }
+}
+
+impl<'tcx> TypeFoldable<'tcx> for ty::Predicate<'tcx> {
+    fn fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> ty::Predicate<'tcx> {
+        match *self {
+            ty::Predicate::Trait(ref a) =>
+                ty::Predicate::Trait(a.fold_with(folder)),
+            ty::Predicate::Equate(ref a, ref b) =>
+                ty::Predicate::Equate(a.fold_with(folder),
+                                        b.fold_with(folder)),
+            ty::Predicate::RegionOutlives(ref a, ref b) =>
+                ty::Predicate::RegionOutlives(a.fold_with(folder),
+                                                b.fold_with(folder)),
+            ty::Predicate::TypeOutlives(ref a, ref b) =>
+                ty::Predicate::TypeOutlives(a.fold_with(folder),
+                                              b.fold_with(folder)),
         }
     }
 }
diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs
index d29e5a9f430..41ed5b8ec36 100644
--- a/src/librustc_typeck/lib.rs
+++ b/src/librustc_typeck/lib.rs
@@ -163,6 +163,7 @@ fn no_params<'tcx>(t: Ty<'tcx>) -> ty::Polytype<'tcx> {
         generics: ty::Generics {
             types: VecPerParamSpace::empty(),
             regions: VecPerParamSpace::empty(),
+            predicates: VecPerParamSpace::empty(),
         },
         ty: t
     }