1
Fork 0

Support all variants of WherePredicate

Adds support for all variants of ast::WherePredicate in clean/mod.rs. Fixes #20048, but will need modification when EqualityPredicates are fully implemented in #20041.
This commit is contained in:
Jared Roesch 2014-12-23 01:08:00 -08:00
parent 62fb41c32b
commit 6948a2df31
2 changed files with 36 additions and 9 deletions

View file

@ -128,8 +128,26 @@ impl<'a> fmt::Show for WhereClause<'a> {
if i > 0 {
try!(f.write(", ".as_bytes()));
}
let bounds = pred.bounds.as_slice();
try!(write!(f, "{}: {}", pred.ty, TyParamBounds(bounds)));
match pred {
&clean::WherePredicate::BoundPredicate {ref ty, ref bounds } => {
let bounds = bounds.as_slice();
try!(write!(f, "{}: {}", ty, TyParamBounds(bounds)));
},
&clean::WherePredicate::RegionPredicate { ref lifetime,
ref bounds } => {
try!(write!(f, "{}: ", lifetime));
for (i, lifetime) in bounds.iter().enumerate() {
if i > 0 {
try!(f.write(" + ".as_bytes()));
}
try!(write!(f, "{}", lifetime));
}
},
&clean::WherePredicate::EqPredicate => {
unimplemented!()
}
}
}
Ok(())
}