From: varkor Date: Sat, 16 Jun 2018 10:14:07 +0000 (+0100) Subject: Rename ty_param_bound to generic_bound X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=7a829273bf67999838cb14e6ff9ce6fd3a14a5e7;p=rust.git Rename ty_param_bound to generic_bound --- diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 3b865e6ce0f..de087049267 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -1037,7 +1037,7 @@ fn trait_is_public(&self, trait_id: ast::NodeId) -> bool { 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 self.path_is_private_type(&trait_ref.trait_ref.path) { self.old_error_set.insert(trait_ref.trait_ref.ref_id); @@ -1100,7 +1100,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) { } for bound in bounds.iter() { - self.check_ty_param_bound(bound) + self.check_generic_bound(bound) } } @@ -1271,7 +1271,7 @@ fn visit_generics(&mut self, generics: &'tcx hir::Generics) { GenericParamKind::Lifetime { .. } => {} GenericParamKind::Type { .. } => { for bound in ¶m.bounds { - self.check_ty_param_bound(bound); + self.check_generic_bound(bound); } } }); @@ -1279,7 +1279,7 @@ fn visit_generics(&mut self, generics: &'tcx hir::Generics) { match predicate { &hir::WherePredicate::BoundPredicate(ref bound_pred) => { for bound in bound_pred.bounds.iter() { - self.check_ty_param_bound(bound) + self.check_generic_bound(bound) } } &hir::WherePredicate::RegionPredicate(_) => {} diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 675849c8a5c..2bb8fff4037 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1509,7 +1509,7 @@ fn parse_ty_common(&mut self, allow_plus: bool, allow_qpath_recovery: bool) } } else if self.eat_keyword(keywords::Impl) { // 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; TyKind::ImplTrait(bounds) } else if self.check_keyword(keywords::Dyn) && @@ -1517,13 +1517,13 @@ fn parse_ty_common(&mut self, allow_plus: bool, allow_qpath_recovery: bool) !can_continue_type_after_non_fn_ident(t)) { self.bump(); // `dyn` // 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; TyKind::TraitObject(bounds, TraitObjectSyntax::Dyn) } else if self.check(&token::Question) || self.check_lifetime() && self.look_ahead(1, |t| t.is_like_plus()) { // 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) } else if self.eat_lt() { // Qualified path @@ -1569,7 +1569,7 @@ fn parse_remaining_bounds(&mut self, generic_params: Vec, path: as let mut bounds = vec![GenericBound::Trait(poly_trait_ref, TraitBoundModifier::None)]; if parse_plus { 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)) } @@ -1594,7 +1594,7 @@ fn maybe_recover_from_bad_type_plus(&mut self, allow_plus: bool, ty: &Ty) -> PRe } 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 mut err = struct_span_err!(self.sess.span_diagnostic, sum_span, E0178, @@ -4735,7 +4735,7 @@ fn err_dotdotdot_syntax(&self, span: Span) { // LT_BOUND = LIFETIME (e.g. `'a`) // TY_BOUND = TY_BOUND_NOPAREN | (TY_BOUND_NOPAREN) // TY_BOUND_NOPAREN = [?] [for] 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(); loop { // This needs to be syncronized with `Token::can_begin_bound`. @@ -4784,8 +4784,8 @@ fn parse_ty_param_bounds_common(&mut self, allow_plus: bool) -> PResult<'a, Gene return Ok(bounds); } - fn parse_ty_param_bounds(&mut self) -> PResult<'a, GenericBounds> { - self.parse_ty_param_bounds_common(true) + fn parse_generic_bounds(&mut self) -> PResult<'a, GenericBounds> { + self.parse_generic_bounds_common(true) } // Parse bounds of a lifetime parameter `BOUND + BOUND + BOUND`, possibly with trailing `+`. @@ -4810,7 +4810,7 @@ fn parse_ty_param(&mut self, // Parse optional colon and param bounds. let bounds = if self.eat(&token::Colon) { - self.parse_ty_param_bounds()? + self.parse_generic_bounds()? } else { Vec::new() }; @@ -4841,7 +4841,7 @@ fn parse_trait_item_assoc_ty(&mut self) // Parse optional colon and param bounds. let bounds = if self.eat(&token::Colon) { - self.parse_ty_param_bounds()? + self.parse_generic_bounds()? } else { Vec::new() }; @@ -5036,7 +5036,7 @@ fn parse_where_clause(&mut self) -> PResult<'a, WhereClause> { // or with mandatory equality sign and the second type. let ty = self.parse_ty()?; 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( ast::WhereBoundPredicate { span: lo.to(self.prev_span), @@ -5536,14 +5536,14 @@ fn parse_item_trait(&mut self, is_auto: IsAuto, unsafety: Unsafety) -> PResult<' // Parse optional colon and supertrait bounds. let bounds = if self.eat(&token::Colon) { - self.parse_ty_param_bounds()? + self.parse_generic_bounds()? } else { Vec::new() }; if self.eat(&token::Eq) { // 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()?; self.expect(&token::Semi)?; if unsafety != Unsafety::Normal {