From 120ce12016005e73dfe01a67aa34c02f0eb432e2 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Wed, 29 May 2019 00:35:14 +0300 Subject: [PATCH] Rename `TraitOrImpl` to `Assoc` and `trait_or_impl` to `assoc`. --- src/librustc_privacy/lib.rs | 25 +++++++++++++++++++------ src/librustc_resolve/lib.rs | 12 ++++++------ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 68930533a28..a08c028390b 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -1703,8 +1703,13 @@ fn check(&self, item_id: hir::HirId, required_visibility: ty::Visibility) } } - fn check_trait_or_impl_item(&self, hir_id: hir::HirId, assoc_item_kind: AssocItemKind, - defaultness: hir::Defaultness, vis: ty::Visibility) { + fn check_assoc_item( + &self, + hir_id: hir::HirId, + assoc_item_kind: AssocItemKind, + defaultness: hir::Defaultness, + vis: ty::Visibility, + ) { let mut check = self.check(hir_id, vis); let (check_ty, is_assoc_ty) = match assoc_item_kind { @@ -1754,8 +1759,12 @@ fn visit_item(&mut self, item: &'tcx hir::Item) { self.check(item.hir_id, item_visibility).generics().predicates(); for trait_item_ref in trait_item_refs { - self.check_trait_or_impl_item(trait_item_ref.id.hir_id, trait_item_ref.kind, - trait_item_ref.defaultness, item_visibility); + self.check_assoc_item( + trait_item_ref.id.hir_id, + trait_item_ref.kind, + trait_item_ref.defaultness, + item_visibility, + ); } } hir::ItemKind::TraitAlias(..) => { @@ -1803,8 +1812,12 @@ fn visit_item(&mut self, item: &'tcx hir::Item) { } else { impl_vis }; - self.check_trait_or_impl_item(impl_item_ref.id.hir_id, impl_item_ref.kind, - impl_item_ref.defaultness, impl_item_vis); + self.check_assoc_item( + impl_item_ref.id.hir_id, + impl_item_ref.kind, + impl_item_ref.defaultness, + impl_item_vis, + ); } } } diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index c05b69ab44f..9b7b44025c1 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -860,7 +860,7 @@ fn visit_fn(&mut self, FnKind::ItemFn(_, ref header, ..) => (FnItemRibKind, &header.asyncness.node), FnKind::Method(_, ref sig, _, _) => - (TraitOrImplItemRibKind, &sig.header.asyncness.node), + (AssocItemRibKind, &sig.header.asyncness.node), FnKind::Closure(_) => // Async closures aren't resolved through `visit_fn`-- they're // processed separately @@ -1033,7 +1033,7 @@ enum RibKind<'a> { /// methods or associated types. Allow references to ty params that impl or trait /// binds. Disallow any other upvars (including other ty params that are /// upvars). - TraitOrImplItemRibKind, + AssocItemRibKind, /// We passed through a function definition. Disallow upvars. /// Permit only those const parameters that are specified in the function's generics. @@ -2612,7 +2612,7 @@ fn resolve_item(&mut self, item: &Item) { for trait_item in trait_items { let generic_params = HasGenericParams(&trait_item.generics, - TraitOrImplItemRibKind); + AssocItemRibKind); this.with_generic_param_rib(generic_params, |this| { match trait_item.node { TraitItemKind::Const(ref ty, ref default) => { @@ -2899,7 +2899,7 @@ fn resolve_implementation(&mut self, // We also need a new scope for the impl item type parameters. let generic_params = HasGenericParams(&impl_item.generics, - TraitOrImplItemRibKind); + AssocItemRibKind); this.with_generic_param_rib(generic_params, |this| { use self::ResolutionError::*; match impl_item.node { @@ -4074,7 +4074,7 @@ fn adjust_local_res(&mut self, seen.insert(node_id, depth); } } - ItemRibKind | FnItemRibKind | TraitOrImplItemRibKind => { + ItemRibKind | FnItemRibKind | AssocItemRibKind => { // This was an attempt to access an upvar inside a // named function item. This is not allowed, so we // report an error. @@ -4103,7 +4103,7 @@ fn adjust_local_res(&mut self, Res::Def(DefKind::TyParam, _) | Res::SelfTy(..) => { for rib in ribs { match rib.kind { - NormalRibKind | TraitOrImplItemRibKind | ClosureRibKind(..) | + NormalRibKind | AssocItemRibKind | ClosureRibKind(..) | ModuleRibKind(..) | MacroDefinition(..) | ForwardTyParamBanRibKind | ConstantItemRibKind | TyParamAsConstParamTy => { // Nothing to do. Continue.