Skip to content

Commit 3013c0b

Browse files
authored
Rollup merge of rust-lang#61294 - eddyb:no-trait-nor-impl, r=varkor
Rename `TraitOrImpl` to `Assoc` and `trait_or_impl` to `assoc`.
2 parents 73530ff + 120ce12 commit 3013c0b

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

src/librustc_privacy/lib.rs

+19-6
Original file line numberDiff line numberDiff line change
@@ -1703,8 +1703,13 @@ impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> {
17031703
}
17041704
}
17051705

1706-
fn check_trait_or_impl_item(&self, hir_id: hir::HirId, assoc_item_kind: AssocItemKind,
1707-
defaultness: hir::Defaultness, vis: ty::Visibility) {
1706+
fn check_assoc_item(
1707+
&self,
1708+
hir_id: hir::HirId,
1709+
assoc_item_kind: AssocItemKind,
1710+
defaultness: hir::Defaultness,
1711+
vis: ty::Visibility,
1712+
) {
17081713
let mut check = self.check(hir_id, vis);
17091714

17101715
let (check_ty, is_assoc_ty) = match assoc_item_kind {
@@ -1754,8 +1759,12 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx>
17541759
self.check(item.hir_id, item_visibility).generics().predicates();
17551760

17561761
for trait_item_ref in trait_item_refs {
1757-
self.check_trait_or_impl_item(trait_item_ref.id.hir_id, trait_item_ref.kind,
1758-
trait_item_ref.defaultness, item_visibility);
1762+
self.check_assoc_item(
1763+
trait_item_ref.id.hir_id,
1764+
trait_item_ref.kind,
1765+
trait_item_ref.defaultness,
1766+
item_visibility,
1767+
);
17591768
}
17601769
}
17611770
hir::ItemKind::TraitAlias(..) => {
@@ -1803,8 +1812,12 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx>
18031812
} else {
18041813
impl_vis
18051814
};
1806-
self.check_trait_or_impl_item(impl_item_ref.id.hir_id, impl_item_ref.kind,
1807-
impl_item_ref.defaultness, impl_item_vis);
1815+
self.check_assoc_item(
1816+
impl_item_ref.id.hir_id,
1817+
impl_item_ref.kind,
1818+
impl_item_ref.defaultness,
1819+
impl_item_vis,
1820+
);
18081821
}
18091822
}
18101823
}

src/librustc_resolve/lib.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Resolver<'a> {
860860
FnKind::ItemFn(_, ref header, ..) =>
861861
(FnItemRibKind, &header.asyncness.node),
862862
FnKind::Method(_, ref sig, _, _) =>
863-
(TraitOrImplItemRibKind, &sig.header.asyncness.node),
863+
(AssocItemRibKind, &sig.header.asyncness.node),
864864
FnKind::Closure(_) =>
865865
// Async closures aren't resolved through `visit_fn`-- they're
866866
// processed separately
@@ -1033,7 +1033,7 @@ enum RibKind<'a> {
10331033
/// methods or associated types. Allow references to ty params that impl or trait
10341034
/// binds. Disallow any other upvars (including other ty params that are
10351035
/// upvars).
1036-
TraitOrImplItemRibKind,
1036+
AssocItemRibKind,
10371037

10381038
/// We passed through a function definition. Disallow upvars.
10391039
/// Permit only those const parameters that are specified in the function's generics.
@@ -2612,7 +2612,7 @@ impl<'a> Resolver<'a> {
26122612

26132613
for trait_item in trait_items {
26142614
let generic_params = HasGenericParams(&trait_item.generics,
2615-
TraitOrImplItemRibKind);
2615+
AssocItemRibKind);
26162616
this.with_generic_param_rib(generic_params, |this| {
26172617
match trait_item.node {
26182618
TraitItemKind::Const(ref ty, ref default) => {
@@ -2899,7 +2899,7 @@ impl<'a> Resolver<'a> {
28992899

29002900
// We also need a new scope for the impl item type parameters.
29012901
let generic_params = HasGenericParams(&impl_item.generics,
2902-
TraitOrImplItemRibKind);
2902+
AssocItemRibKind);
29032903
this.with_generic_param_rib(generic_params, |this| {
29042904
use self::ResolutionError::*;
29052905
match impl_item.node {
@@ -4074,7 +4074,7 @@ impl<'a> Resolver<'a> {
40744074
seen.insert(node_id, depth);
40754075
}
40764076
}
4077-
ItemRibKind | FnItemRibKind | TraitOrImplItemRibKind => {
4077+
ItemRibKind | FnItemRibKind | AssocItemRibKind => {
40784078
// This was an attempt to access an upvar inside a
40794079
// named function item. This is not allowed, so we
40804080
// report an error.
@@ -4103,7 +4103,7 @@ impl<'a> Resolver<'a> {
41034103
Res::Def(DefKind::TyParam, _) | Res::SelfTy(..) => {
41044104
for rib in ribs {
41054105
match rib.kind {
4106-
NormalRibKind | TraitOrImplItemRibKind | ClosureRibKind(..) |
4106+
NormalRibKind | AssocItemRibKind | ClosureRibKind(..) |
41074107
ModuleRibKind(..) | MacroDefinition(..) | ForwardTyParamBanRibKind |
41084108
ConstantItemRibKind | TyParamAsConstParamTy => {
41094109
// Nothing to do. Continue.

0 commit comments

Comments
 (0)