Introduce predicates but don't use them.
This commit is contained in:
parent
70be49d2c7
commit
9409bd9ff8
5 changed files with 43 additions and 1 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue