Use ParamBounds in WhereRegionPredicate

This commit is contained in:
varkor 2018-05-28 15:23:16 +01:00
parent aed530a457
commit 80dbe58efc
18 changed files with 92 additions and 109 deletions

View file

@ -1610,7 +1610,7 @@ impl<'a> Parser<'a> {
s.print_mutability(mut_ty.mutbl)?;
s.popen()?;
s.print_type(&mut_ty.ty)?;
s.print_bounds(" +", &bounds)?;
s.print_type_bounds(" +", &bounds)?;
s.pclose()
});
err.span_suggestion_with_applicability(
@ -4790,10 +4790,10 @@ impl<'a> Parser<'a> {
// Parse bounds of a lifetime parameter `BOUND + BOUND + BOUND`, possibly with trailing `+`.
// BOUND = LT_BOUND (e.g. `'a`)
fn parse_lt_param_bounds(&mut self) -> Vec<Lifetime> {
fn parse_lt_param_bounds(&mut self) -> ParamBounds {
let mut lifetimes = Vec::new();
while self.check_lifetime() {
lifetimes.push(self.expect_lifetime());
lifetimes.push(ast::ParamBound::Outlives(self.expect_lifetime()));
if !self.eat_plus() {
break
@ -4868,9 +4868,7 @@ impl<'a> Parser<'a> {
let lifetime = self.expect_lifetime();
// Parse lifetime parameter.
let bounds = if self.eat(&token::Colon) {
self.parse_lt_param_bounds().iter()
.map(|bound| ast::ParamBound::Outlives(*bound))
.collect()
self.parse_lt_param_bounds()
} else {
Vec::new()
};