Rename ty_param_bound to generic_bound
This commit is contained in:
parent
4343c20819
commit
7a829273bf
2 changed files with 17 additions and 17 deletions
|
@ -1037,7 +1037,7 @@ impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||||
self.access_levels.is_public(trait_id)
|
self.access_levels.is_public(trait_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_ty_param_bound(&mut self, bound: &hir::GenericBound) {
|
fn check_generic_bound(&mut self, bound: &hir::GenericBound) {
|
||||||
if let hir::GenericBound::Trait(ref trait_ref, _) = *bound {
|
if let hir::GenericBound::Trait(ref trait_ref, _) = *bound {
|
||||||
if self.path_is_private_type(&trait_ref.trait_ref.path) {
|
if self.path_is_private_type(&trait_ref.trait_ref.path) {
|
||||||
self.old_error_set.insert(trait_ref.trait_ref.ref_id);
|
self.old_error_set.insert(trait_ref.trait_ref.ref_id);
|
||||||
|
@ -1100,7 +1100,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
for bound in bounds.iter() {
|
for bound in bounds.iter() {
|
||||||
self.check_ty_param_bound(bound)
|
self.check_generic_bound(bound)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1271,7 +1271,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||||
GenericParamKind::Lifetime { .. } => {}
|
GenericParamKind::Lifetime { .. } => {}
|
||||||
GenericParamKind::Type { .. } => {
|
GenericParamKind::Type { .. } => {
|
||||||
for bound in ¶m.bounds {
|
for bound in ¶m.bounds {
|
||||||
self.check_ty_param_bound(bound);
|
self.check_generic_bound(bound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1279,7 +1279,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||||
match predicate {
|
match predicate {
|
||||||
&hir::WherePredicate::BoundPredicate(ref bound_pred) => {
|
&hir::WherePredicate::BoundPredicate(ref bound_pred) => {
|
||||||
for bound in bound_pred.bounds.iter() {
|
for bound in bound_pred.bounds.iter() {
|
||||||
self.check_ty_param_bound(bound)
|
self.check_generic_bound(bound)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&hir::WherePredicate::RegionPredicate(_) => {}
|
&hir::WherePredicate::RegionPredicate(_) => {}
|
||||||
|
|
|
@ -1509,7 +1509,7 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
} else if self.eat_keyword(keywords::Impl) {
|
} else if self.eat_keyword(keywords::Impl) {
|
||||||
// Always parse bounds greedily for better error recovery.
|
// Always parse bounds greedily for better error recovery.
|
||||||
let bounds = self.parse_ty_param_bounds()?;
|
let bounds = self.parse_generic_bounds()?;
|
||||||
impl_dyn_multi = bounds.len() > 1 || self.prev_token_kind == PrevTokenKind::Plus;
|
impl_dyn_multi = bounds.len() > 1 || self.prev_token_kind == PrevTokenKind::Plus;
|
||||||
TyKind::ImplTrait(bounds)
|
TyKind::ImplTrait(bounds)
|
||||||
} else if self.check_keyword(keywords::Dyn) &&
|
} else if self.check_keyword(keywords::Dyn) &&
|
||||||
|
@ -1517,13 +1517,13 @@ impl<'a> Parser<'a> {
|
||||||
!can_continue_type_after_non_fn_ident(t)) {
|
!can_continue_type_after_non_fn_ident(t)) {
|
||||||
self.bump(); // `dyn`
|
self.bump(); // `dyn`
|
||||||
// Always parse bounds greedily for better error recovery.
|
// Always parse bounds greedily for better error recovery.
|
||||||
let bounds = self.parse_ty_param_bounds()?;
|
let bounds = self.parse_generic_bounds()?;
|
||||||
impl_dyn_multi = bounds.len() > 1 || self.prev_token_kind == PrevTokenKind::Plus;
|
impl_dyn_multi = bounds.len() > 1 || self.prev_token_kind == PrevTokenKind::Plus;
|
||||||
TyKind::TraitObject(bounds, TraitObjectSyntax::Dyn)
|
TyKind::TraitObject(bounds, TraitObjectSyntax::Dyn)
|
||||||
} else if self.check(&token::Question) ||
|
} else if self.check(&token::Question) ||
|
||||||
self.check_lifetime() && self.look_ahead(1, |t| t.is_like_plus()) {
|
self.check_lifetime() && self.look_ahead(1, |t| t.is_like_plus()) {
|
||||||
// Bound list (trait object type)
|
// Bound list (trait object type)
|
||||||
TyKind::TraitObject(self.parse_ty_param_bounds_common(allow_plus)?,
|
TyKind::TraitObject(self.parse_generic_bounds_common(allow_plus)?,
|
||||||
TraitObjectSyntax::None)
|
TraitObjectSyntax::None)
|
||||||
} else if self.eat_lt() {
|
} else if self.eat_lt() {
|
||||||
// Qualified path
|
// Qualified path
|
||||||
|
@ -1569,7 +1569,7 @@ impl<'a> Parser<'a> {
|
||||||
let mut bounds = vec![GenericBound::Trait(poly_trait_ref, TraitBoundModifier::None)];
|
let mut bounds = vec![GenericBound::Trait(poly_trait_ref, TraitBoundModifier::None)];
|
||||||
if parse_plus {
|
if parse_plus {
|
||||||
self.eat_plus(); // `+`, or `+=` gets split and `+` is discarded
|
self.eat_plus(); // `+`, or `+=` gets split and `+` is discarded
|
||||||
bounds.append(&mut self.parse_ty_param_bounds()?);
|
bounds.append(&mut self.parse_generic_bounds()?);
|
||||||
}
|
}
|
||||||
Ok(TyKind::TraitObject(bounds, TraitObjectSyntax::None))
|
Ok(TyKind::TraitObject(bounds, TraitObjectSyntax::None))
|
||||||
}
|
}
|
||||||
|
@ -1594,7 +1594,7 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.bump(); // `+`
|
self.bump(); // `+`
|
||||||
let bounds = self.parse_ty_param_bounds()?;
|
let bounds = self.parse_generic_bounds()?;
|
||||||
let sum_span = ty.span.to(self.prev_span);
|
let sum_span = ty.span.to(self.prev_span);
|
||||||
|
|
||||||
let mut err = struct_span_err!(self.sess.span_diagnostic, sum_span, E0178,
|
let mut err = struct_span_err!(self.sess.span_diagnostic, sum_span, E0178,
|
||||||
|
@ -4735,7 +4735,7 @@ impl<'a> Parser<'a> {
|
||||||
// LT_BOUND = LIFETIME (e.g. `'a`)
|
// LT_BOUND = LIFETIME (e.g. `'a`)
|
||||||
// TY_BOUND = TY_BOUND_NOPAREN | (TY_BOUND_NOPAREN)
|
// TY_BOUND = TY_BOUND_NOPAREN | (TY_BOUND_NOPAREN)
|
||||||
// TY_BOUND_NOPAREN = [?] [for<LT_PARAM_DEFS>] SIMPLE_PATH (e.g. `?for<'a: 'b> m::Trait<'a>`)
|
// TY_BOUND_NOPAREN = [?] [for<LT_PARAM_DEFS>] SIMPLE_PATH (e.g. `?for<'a: 'b> m::Trait<'a>`)
|
||||||
fn parse_ty_param_bounds_common(&mut self, allow_plus: bool) -> PResult<'a, GenericBounds> {
|
fn parse_generic_bounds_common(&mut self, allow_plus: bool) -> PResult<'a, GenericBounds> {
|
||||||
let mut bounds = Vec::new();
|
let mut bounds = Vec::new();
|
||||||
loop {
|
loop {
|
||||||
// This needs to be syncronized with `Token::can_begin_bound`.
|
// This needs to be syncronized with `Token::can_begin_bound`.
|
||||||
|
@ -4784,8 +4784,8 @@ impl<'a> Parser<'a> {
|
||||||
return Ok(bounds);
|
return Ok(bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_ty_param_bounds(&mut self) -> PResult<'a, GenericBounds> {
|
fn parse_generic_bounds(&mut self) -> PResult<'a, GenericBounds> {
|
||||||
self.parse_ty_param_bounds_common(true)
|
self.parse_generic_bounds_common(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse bounds of a lifetime parameter `BOUND + BOUND + BOUND`, possibly with trailing `+`.
|
// Parse bounds of a lifetime parameter `BOUND + BOUND + BOUND`, possibly with trailing `+`.
|
||||||
|
@ -4810,7 +4810,7 @@ impl<'a> Parser<'a> {
|
||||||
|
|
||||||
// Parse optional colon and param bounds.
|
// Parse optional colon and param bounds.
|
||||||
let bounds = if self.eat(&token::Colon) {
|
let bounds = if self.eat(&token::Colon) {
|
||||||
self.parse_ty_param_bounds()?
|
self.parse_generic_bounds()?
|
||||||
} else {
|
} else {
|
||||||
Vec::new()
|
Vec::new()
|
||||||
};
|
};
|
||||||
|
@ -4841,7 +4841,7 @@ impl<'a> Parser<'a> {
|
||||||
|
|
||||||
// Parse optional colon and param bounds.
|
// Parse optional colon and param bounds.
|
||||||
let bounds = if self.eat(&token::Colon) {
|
let bounds = if self.eat(&token::Colon) {
|
||||||
self.parse_ty_param_bounds()?
|
self.parse_generic_bounds()?
|
||||||
} else {
|
} else {
|
||||||
Vec::new()
|
Vec::new()
|
||||||
};
|
};
|
||||||
|
@ -5036,7 +5036,7 @@ impl<'a> Parser<'a> {
|
||||||
// or with mandatory equality sign and the second type.
|
// or with mandatory equality sign and the second type.
|
||||||
let ty = self.parse_ty()?;
|
let ty = self.parse_ty()?;
|
||||||
if self.eat(&token::Colon) {
|
if self.eat(&token::Colon) {
|
||||||
let bounds = self.parse_ty_param_bounds()?;
|
let bounds = self.parse_generic_bounds()?;
|
||||||
where_clause.predicates.push(ast::WherePredicate::BoundPredicate(
|
where_clause.predicates.push(ast::WherePredicate::BoundPredicate(
|
||||||
ast::WhereBoundPredicate {
|
ast::WhereBoundPredicate {
|
||||||
span: lo.to(self.prev_span),
|
span: lo.to(self.prev_span),
|
||||||
|
@ -5536,14 +5536,14 @@ impl<'a> Parser<'a> {
|
||||||
|
|
||||||
// Parse optional colon and supertrait bounds.
|
// Parse optional colon and supertrait bounds.
|
||||||
let bounds = if self.eat(&token::Colon) {
|
let bounds = if self.eat(&token::Colon) {
|
||||||
self.parse_ty_param_bounds()?
|
self.parse_generic_bounds()?
|
||||||
} else {
|
} else {
|
||||||
Vec::new()
|
Vec::new()
|
||||||
};
|
};
|
||||||
|
|
||||||
if self.eat(&token::Eq) {
|
if self.eat(&token::Eq) {
|
||||||
// it's a trait alias
|
// it's a trait alias
|
||||||
let bounds = self.parse_ty_param_bounds()?;
|
let bounds = self.parse_generic_bounds()?;
|
||||||
tps.where_clause = self.parse_where_clause()?;
|
tps.where_clause = self.parse_where_clause()?;
|
||||||
self.expect(&token::Semi)?;
|
self.expect(&token::Semi)?;
|
||||||
if unsafety != Unsafety::Normal {
|
if unsafety != Unsafety::Normal {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue