Skip to content

Commit f1fd063

Browse files
authored
Rollup merge of rust-lang#60955 - agnxy:rename-assoc, r=oli-obk,Centril
Rename "Associated*" to "Assoc*" This change is for rust-lang#60163. r? @oli-obk
2 parents f492693 + 0b7d4fa commit f1fd063

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+349
-349
lines changed

src/librustc/hir/def.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ pub enum DefKind {
6161
TyAlias,
6262
ForeignTy,
6363
TraitAlias,
64-
AssociatedTy,
64+
AssocTy,
6565
/// `existential type Foo: Bar;`
66-
AssociatedExistential,
66+
AssocExistential,
6767
TyParam,
6868

6969
// Value namespace
@@ -74,7 +74,7 @@ pub enum DefKind {
7474
/// Refers to the struct or enum variant's constructor.
7575
Ctor(CtorOf, CtorKind),
7676
Method,
77-
AssociatedConst,
77+
AssocConst,
7878

7979
// Macro namespace
8080
Macro(MacroKind),
@@ -99,14 +99,14 @@ impl DefKind {
9999
DefKind::Existential => "existential type",
100100
DefKind::TyAlias => "type alias",
101101
DefKind::TraitAlias => "trait alias",
102-
DefKind::AssociatedTy => "associated type",
103-
DefKind::AssociatedExistential => "associated existential type",
102+
DefKind::AssocTy => "associated type",
103+
DefKind::AssocExistential => "associated existential type",
104104
DefKind::Union => "union",
105105
DefKind::Trait => "trait",
106106
DefKind::ForeignTy => "foreign type",
107107
DefKind::Method => "method",
108108
DefKind::Const => "constant",
109-
DefKind::AssociatedConst => "associated constant",
109+
DefKind::AssocConst => "associated constant",
110110
DefKind::TyParam => "type parameter",
111111
DefKind::ConstParam => "const parameter",
112112
DefKind::Macro(macro_kind) => macro_kind.descr(),
@@ -116,9 +116,9 @@ impl DefKind {
116116
/// An English article for the def.
117117
pub fn article(&self) -> &'static str {
118118
match *self {
119-
DefKind::AssociatedTy
120-
| DefKind::AssociatedConst
121-
| DefKind::AssociatedExistential
119+
DefKind::AssocTy
120+
| DefKind::AssocConst
121+
| DefKind::AssocExistential
122122
| DefKind::Enum
123123
| DefKind::Existential => "an",
124124
DefKind::Macro(macro_kind) => macro_kind.article(),

src/librustc/hir/intravisit.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ pub trait Visitor<'v> : Sized {
370370
fn visit_vis(&mut self, vis: &'v Visibility) {
371371
walk_vis(self, vis)
372372
}
373-
fn visit_associated_item_kind(&mut self, kind: &'v AssociatedItemKind) {
373+
fn visit_associated_item_kind(&mut self, kind: &'v AssocItemKind) {
374374
walk_associated_item_kind(self, kind);
375375
}
376376
fn visit_defaultness(&mut self, defaultness: &'v Defaultness) {
@@ -1120,7 +1120,7 @@ pub fn walk_vis<'v, V: Visitor<'v>>(visitor: &mut V, vis: &'v Visibility) {
11201120
}
11211121
}
11221122

1123-
pub fn walk_associated_item_kind<'v, V: Visitor<'v>>(_: &mut V, _: &'v AssociatedItemKind) {
1123+
pub fn walk_associated_item_kind<'v, V: Visitor<'v>>(_: &mut V, _: &'v AssocItemKind) {
11241124
// No visitable content here: this fn exists so you can call it if
11251125
// the right thing to do, should content be added in the future,
11261126
// would be to walk it.

src/librustc/hir/lowering.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -1862,7 +1862,7 @@ impl<'a> LoweringContext<'a> {
18621862
index: this.def_key(def_id).parent.expect("missing parent"),
18631863
};
18641864
let type_def_id = match partial_res.base_res() {
1865-
Res::Def(DefKind::AssociatedTy, def_id) if i + 2 == proj_start => {
1865+
Res::Def(DefKind::AssocTy, def_id) if i + 2 == proj_start => {
18661866
Some(parent_def_id(self, def_id))
18671867
}
18681868
Res::Def(DefKind::Variant, def_id) if i + 1 == proj_start => {
@@ -1884,8 +1884,8 @@ impl<'a> LoweringContext<'a> {
18841884
if i + 1 == proj_start => ParenthesizedGenericArgs::Ok,
18851885
// `a::b::Trait(Args)::TraitItem`
18861886
Res::Def(DefKind::Method, _)
1887-
| Res::Def(DefKind::AssociatedConst, _)
1888-
| Res::Def(DefKind::AssociatedTy, _)
1887+
| Res::Def(DefKind::AssocConst, _)
1888+
| Res::Def(DefKind::AssocTy, _)
18891889
if i + 2 == proj_start =>
18901890
{
18911891
ParenthesizedGenericArgs::Ok
@@ -3591,13 +3591,13 @@ impl<'a> LoweringContext<'a> {
35913591
fn lower_trait_item_ref(&mut self, i: &TraitItem) -> hir::TraitItemRef {
35923592
let (kind, has_default) = match i.node {
35933593
TraitItemKind::Const(_, ref default) => {
3594-
(hir::AssociatedItemKind::Const, default.is_some())
3594+
(hir::AssocItemKind::Const, default.is_some())
35953595
}
35963596
TraitItemKind::Type(_, ref default) => {
3597-
(hir::AssociatedItemKind::Type, default.is_some())
3597+
(hir::AssocItemKind::Type, default.is_some())
35983598
}
35993599
TraitItemKind::Method(ref sig, ref default) => (
3600-
hir::AssociatedItemKind::Method {
3600+
hir::AssocItemKind::Method {
36013601
has_self: sig.decl.has_self(),
36023602
},
36033603
default.is_some(),
@@ -3697,10 +3697,10 @@ impl<'a> LoweringContext<'a> {
36973697
vis: self.lower_visibility(&i.vis, Some(i.id)),
36983698
defaultness: self.lower_defaultness(i.defaultness, true /* [1] */),
36993699
kind: match i.node {
3700-
ImplItemKind::Const(..) => hir::AssociatedItemKind::Const,
3701-
ImplItemKind::Type(..) => hir::AssociatedItemKind::Type,
3702-
ImplItemKind::Existential(..) => hir::AssociatedItemKind::Existential,
3703-
ImplItemKind::Method(ref sig, _) => hir::AssociatedItemKind::Method {
3700+
ImplItemKind::Const(..) => hir::AssocItemKind::Const,
3701+
ImplItemKind::Type(..) => hir::AssocItemKind::Type,
3702+
ImplItemKind::Existential(..) => hir::AssocItemKind::Existential,
3703+
ImplItemKind::Method(ref sig, _) => hir::AssocItemKind::Method {
37043704
has_self: sig.decl.has_self(),
37053705
},
37063706
ImplItemKind::Macro(..) => unimplemented!(),

src/librustc/hir/map/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -337,17 +337,17 @@ impl<'hir> Map<'hir> {
337337
}
338338
Node::TraitItem(item) => {
339339
match item.node {
340-
TraitItemKind::Const(..) => DefKind::AssociatedConst,
340+
TraitItemKind::Const(..) => DefKind::AssocConst,
341341
TraitItemKind::Method(..) => DefKind::Method,
342-
TraitItemKind::Type(..) => DefKind::AssociatedTy,
342+
TraitItemKind::Type(..) => DefKind::AssocTy,
343343
}
344344
}
345345
Node::ImplItem(item) => {
346346
match item.node {
347-
ImplItemKind::Const(..) => DefKind::AssociatedConst,
347+
ImplItemKind::Const(..) => DefKind::AssocConst,
348348
ImplItemKind::Method(..) => DefKind::Method,
349-
ImplItemKind::Type(..) => DefKind::AssociatedTy,
350-
ImplItemKind::Existential(..) => DefKind::AssociatedExistential,
349+
ImplItemKind::Type(..) => DefKind::AssocTy,
350+
ImplItemKind::Existential(..) => DefKind::AssocExistential,
351351
}
352352
}
353353
Node::Variant(_) => DefKind::Variant,

src/librustc/hir/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2422,7 +2422,7 @@ pub struct TraitItemRef {
24222422
pub id: TraitItemId,
24232423
#[stable_hasher(project(name))]
24242424
pub ident: Ident,
2425-
pub kind: AssociatedItemKind,
2425+
pub kind: AssocItemKind,
24262426
pub span: Span,
24272427
pub defaultness: Defaultness,
24282428
}
@@ -2438,14 +2438,14 @@ pub struct ImplItemRef {
24382438
pub id: ImplItemId,
24392439
#[stable_hasher(project(name))]
24402440
pub ident: Ident,
2441-
pub kind: AssociatedItemKind,
2441+
pub kind: AssocItemKind,
24422442
pub span: Span,
24432443
pub vis: Visibility,
24442444
pub defaultness: Defaultness,
24452445
}
24462446

24472447
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, HashStable)]
2448-
pub enum AssociatedItemKind {
2448+
pub enum AssocItemKind {
24492449
Const,
24502450
Method { has_self: bool },
24512451
Type,

src/librustc/middle/dead.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
7272
fn handle_res(&mut self, res: Res) {
7373
match res {
7474
Res::Def(DefKind::Const, _)
75-
| Res::Def(DefKind::AssociatedConst, _)
75+
| Res::Def(DefKind::AssocConst, _)
7676
| Res::Def(DefKind::TyAlias, _) => {
7777
self.check_def_id(res.def_id());
7878
}

src/librustc/middle/expr_use_visitor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
909909
| Res::Def(DefKind::Ctor(..), _)
910910
| Res::Def(DefKind::Union, _)
911911
| Res::Def(DefKind::TyAlias, _)
912-
| Res::Def(DefKind::AssociatedTy, _)
912+
| Res::Def(DefKind::AssocTy, _)
913913
| Res::SelfTy(..) => {
914914
debug!("struct cmt_pat={:?} pat={:?}", cmt_pat, pat);
915915
delegate.matched_pat(pat, &cmt_pat, match_mode);

src/librustc/middle/mem_categorization.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
703703
Res::Def(DefKind::Ctor(..), _)
704704
| Res::Def(DefKind::Const, _)
705705
| Res::Def(DefKind::ConstParam, _)
706-
| Res::Def(DefKind::AssociatedConst, _)
706+
| Res::Def(DefKind::AssocConst, _)
707707
| Res::Def(DefKind::Fn, _)
708708
| Res::Def(DefKind::Method, _)
709709
| Res::SelfCtor(..) => {

src/librustc/middle/reachable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ReachableContext<'a, 'tcx> {
118118
// If this path leads to a constant, then we need to
119119
// recurse into the constant to continue finding
120120
// items that are reachable.
121-
Res::Def(DefKind::Const, _) | Res::Def(DefKind::AssociatedConst, _) => {
121+
Res::Def(DefKind::Const, _) | Res::Def(DefKind::AssocConst, _) => {
122122
self.worklist.push(hir_id);
123123
}
124124

src/librustc/middle/resolve_lifetime.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1924,7 +1924,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
19241924
}
19251925
};
19261926
let type_def_id = match res {
1927-
Res::Def(DefKind::AssociatedTy, def_id)
1927+
Res::Def(DefKind::AssocTy, def_id)
19281928
if depth == 1 => Some(parent_def_id(self, def_id)),
19291929
Res::Def(DefKind::Variant, def_id)
19301930
if depth == 0 => Some(parent_def_id(self, def_id)),
@@ -2112,7 +2112,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
21122112
};
21132113

21142114
let has_self = match assoc_item_kind {
2115-
Some(hir::AssociatedItemKind::Method { has_self }) => has_self,
2115+
Some(hir::AssocItemKind::Method { has_self }) => has_self,
21162116
_ => false,
21172117
};
21182118

src/librustc/middle/stability.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
527527
// Check if `def_id` is a trait method.
528528
match self.def_kind(def_id) {
529529
Some(DefKind::Method) |
530-
Some(DefKind::AssociatedTy) |
531-
Some(DefKind::AssociatedConst) => {
530+
Some(DefKind::AssocTy) |
531+
Some(DefKind::AssocConst) => {
532532
if let ty::TraitContainer(trait_def_id) = self.associated_item(def_id).container {
533533
// Trait methods do not declare visibility (even
534534
// for visibility info in cstore). Use containing

src/librustc/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ rustc_queries! {
265265
query associated_item_def_ids(_: DefId) -> &'tcx [DefId] {}
266266

267267
/// Maps from a trait item to the trait item "descriptor".
268-
query associated_item(_: DefId) -> ty::AssociatedItem {}
268+
query associated_item(_: DefId) -> ty::AssocItem {}
269269

270270
query impl_trait_ref(_: DefId) -> Option<ty::TraitRef<'tcx>> {}
271271
query impl_polarity(_: DefId) -> hir::ImplPolarity {}

src/librustc/traits/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ fn vtable_methods<'a, 'tcx>(
993993
tcx.arena.alloc_from_iter(
994994
supertraits(tcx, trait_ref).flat_map(move |trait_ref| {
995995
let trait_methods = tcx.associated_items(trait_ref.def_id())
996-
.filter(|item| item.kind == ty::AssociatedKind::Method);
996+
.filter(|item| item.kind == ty::AssocKind::Method);
997997

998998
// Now list each method's DefId and InternalSubsts (for within its trait).
999999
// If the method can never be called from this object, produce None.

src/librustc/traits/object_safety.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub enum ObjectSafetyViolation {
3535
Method(ast::Name, MethodViolationCode),
3636

3737
/// Associated const.
38-
AssociatedConst(ast::Name),
38+
AssocConst(ast::Name),
3939
}
4040

4141
impl ObjectSafetyViolation {
@@ -58,7 +58,7 @@ impl ObjectSafetyViolation {
5858
format!("method `{}` has generic type parameters", name).into(),
5959
ObjectSafetyViolation::Method(name, MethodViolationCode::UndispatchableReceiver) =>
6060
format!("method `{}`'s receiver cannot be dispatched on", name).into(),
61-
ObjectSafetyViolation::AssociatedConst(name) =>
61+
ObjectSafetyViolation::AssocConst(name) =>
6262
format!("the trait cannot contain associated consts like `{}`", name).into(),
6363
}
6464
}
@@ -119,7 +119,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
119119
{
120120
// Check methods for violations.
121121
let mut violations: Vec<_> = self.associated_items(trait_def_id)
122-
.filter(|item| item.kind == ty::AssociatedKind::Method)
122+
.filter(|item| item.kind == ty::AssocKind::Method)
123123
.filter_map(|item|
124124
self.object_safety_violation_for_method(trait_def_id, &item)
125125
.map(|code| ObjectSafetyViolation::Method(item.ident.name, code))
@@ -151,8 +151,8 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
151151
}
152152

153153
violations.extend(self.associated_items(trait_def_id)
154-
.filter(|item| item.kind == ty::AssociatedKind::Const)
155-
.map(|item| ObjectSafetyViolation::AssociatedConst(item.ident.name)));
154+
.filter(|item| item.kind == ty::AssocKind::Const)
155+
.map(|item| ObjectSafetyViolation::AssocConst(item.ident.name)));
156156

157157
debug!("object_safety_violations_for_trait(trait_def_id={:?}) = {:?}",
158158
trait_def_id,
@@ -251,7 +251,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
251251
/// Returns `Some(_)` if this method makes the containing trait not object safe.
252252
fn object_safety_violation_for_method(self,
253253
trait_def_id: DefId,
254-
method: &ty::AssociatedItem)
254+
method: &ty::AssocItem)
255255
-> Option<MethodViolationCode>
256256
{
257257
debug!("object_safety_violation_for_method({:?}, {:?})", trait_def_id, method);
@@ -270,7 +270,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
270270
/// otherwise ensure that they cannot be used when `Self=Trait`.
271271
pub fn is_vtable_safe_method(self,
272272
trait_def_id: DefId,
273-
method: &ty::AssociatedItem)
273+
method: &ty::AssocItem)
274274
-> bool
275275
{
276276
debug!("is_vtable_safe_method({:?}, {:?})", trait_def_id, method);
@@ -291,7 +291,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
291291
/// `Self:Sized`.
292292
fn virtual_call_violation_for_method(self,
293293
trait_def_id: DefId,
294-
method: &ty::AssociatedItem)
294+
method: &ty::AssocItem)
295295
-> Option<MethodViolationCode>
296296
{
297297
// The method's first parameter must be named `self`
@@ -439,7 +439,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
439439
self.associated_items(super_trait_ref.def_id())
440440
.map(move |item| (super_trait_ref, item))
441441
})
442-
.filter(|(_, item)| item.kind == ty::AssociatedKind::Type)
442+
.filter(|(_, item)| item.kind == ty::AssocKind::Type)
443443
.collect::<Vec<_>>();
444444

445445
// existential predicates need to be in a specific order
@@ -520,7 +520,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
520520
#[allow(dead_code)]
521521
fn receiver_is_dispatchable(
522522
self,
523-
method: &ty::AssociatedItem,
523+
method: &ty::AssocItem,
524524
receiver_ty: Ty<'tcx>,
525525
) -> bool {
526526
debug!("receiver_is_dispatchable: method = {:?}, receiver_ty = {:?}", method, receiver_ty);

0 commit comments

Comments
 (0)