Skip to content

Commit 81b9d0b

Browse files
authored
Rollup merge of #102868 - compiler-errors:rename-assoc-tyalias-to-ty, r=TaKO8Ki
Rename `AssocItemKind::TyAlias` to `AssocItemKind::Type` Thanks `@camsteffen` for catching this in ast too, cc #102829 (comment)
2 parents 5a09b72 + d3bd6be commit 81b9d0b

File tree

18 files changed

+37
-37
lines changed

18 files changed

+37
-37
lines changed

compiler/rustc_ast/src/ast.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2953,7 +2953,7 @@ pub enum AssocItemKind {
29532953
/// An associated function.
29542954
Fn(Box<Fn>),
29552955
/// An associated type.
2956-
TyAlias(Box<TyAlias>),
2956+
Type(Box<TyAlias>),
29572957
/// A macro expanding to associated items.
29582958
MacCall(P<MacCall>),
29592959
}
@@ -2963,7 +2963,7 @@ impl AssocItemKind {
29632963
match *self {
29642964
Self::Const(defaultness, ..)
29652965
| Self::Fn(box Fn { defaultness, .. })
2966-
| Self::TyAlias(box TyAlias { defaultness, .. }) => defaultness,
2966+
| Self::Type(box TyAlias { defaultness, .. }) => defaultness,
29672967
Self::MacCall(..) => Defaultness::Final,
29682968
}
29692969
}
@@ -2974,7 +2974,7 @@ impl From<AssocItemKind> for ItemKind {
29742974
match assoc_item_kind {
29752975
AssocItemKind::Const(a, b, c) => ItemKind::Const(a, b, c),
29762976
AssocItemKind::Fn(fn_kind) => ItemKind::Fn(fn_kind),
2977-
AssocItemKind::TyAlias(ty_alias_kind) => ItemKind::TyAlias(ty_alias_kind),
2977+
AssocItemKind::Type(ty_alias_kind) => ItemKind::TyAlias(ty_alias_kind),
29782978
AssocItemKind::MacCall(a) => ItemKind::MacCall(a),
29792979
}
29802980
}
@@ -2987,7 +2987,7 @@ impl TryFrom<ItemKind> for AssocItemKind {
29872987
Ok(match item_kind {
29882988
ItemKind::Const(a, b, c) => AssocItemKind::Const(a, b, c),
29892989
ItemKind::Fn(fn_kind) => AssocItemKind::Fn(fn_kind),
2990-
ItemKind::TyAlias(ty_alias_kind) => AssocItemKind::TyAlias(ty_alias_kind),
2990+
ItemKind::TyAlias(ty_kind) => AssocItemKind::Type(ty_kind),
29912991
ItemKind::MacCall(a) => AssocItemKind::MacCall(a),
29922992
_ => return Err(item_kind),
29932993
})

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ pub fn noop_flat_map_assoc_item<T: MutVisitor>(
11061106
visit_fn_sig(sig, visitor);
11071107
visit_opt(body, |body| visitor.visit_block(body));
11081108
}
1109-
AssocItemKind::TyAlias(box TyAlias {
1109+
AssocItemKind::Type(box TyAlias {
11101110
defaultness,
11111111
generics,
11121112
where_clauses,

compiler/rustc_ast/src/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ pub fn walk_assoc_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a AssocItem,
683683
let kind = FnKind::Fn(FnCtxt::Assoc(ctxt), ident, sig, vis, generics, body.as_deref());
684684
visitor.visit_fn(kind, span, id);
685685
}
686-
AssocItemKind::TyAlias(box TyAlias { generics, bounds, ty, .. }) => {
686+
AssocItemKind::Type(box TyAlias { generics, bounds, ty, .. }) => {
687687
visitor.visit_generics(generics);
688688
walk_list!(visitor, visit_param_bound, bounds, BoundKind::Bound);
689689
walk_list!(visitor, visit_ty, ty);

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
804804
);
805805
(generics, hir::TraitItemKind::Fn(sig, hir::TraitFn::Provided(body_id)), true)
806806
}
807-
AssocItemKind::TyAlias(box TyAlias {
807+
AssocItemKind::Type(box TyAlias {
808808
ref generics,
809809
where_clauses,
810810
ref bounds,
@@ -850,7 +850,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
850850
fn lower_trait_item_ref(&mut self, i: &AssocItem) -> hir::TraitItemRef {
851851
let kind = match &i.kind {
852852
AssocItemKind::Const(..) => hir::AssocItemKind::Const,
853-
AssocItemKind::TyAlias(..) => hir::AssocItemKind::Type,
853+
AssocItemKind::Type(..) => hir::AssocItemKind::Type,
854854
AssocItemKind::Fn(box Fn { sig, .. }) => {
855855
hir::AssocItemKind::Fn { has_self: sig.decl.has_self() }
856856
}
@@ -898,7 +898,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
898898

899899
(generics, hir::ImplItemKind::Fn(sig, body_id))
900900
}
901-
AssocItemKind::TyAlias(box TyAlias { generics, where_clauses, ty, .. }) => {
901+
AssocItemKind::Type(box TyAlias { generics, where_clauses, ty, .. }) => {
902902
let mut generics = generics.clone();
903903
add_ty_alias_where_clause(&mut generics, *where_clauses, false);
904904
self.lower_generics(
@@ -941,7 +941,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
941941
span: self.lower_span(i.span),
942942
kind: match &i.kind {
943943
AssocItemKind::Const(..) => hir::AssocItemKind::Const,
944-
AssocItemKind::TyAlias(..) => hir::AssocItemKind::Type,
944+
AssocItemKind::Type(..) => hir::AssocItemKind::Type,
945945
AssocItemKind::Fn(box Fn { sig, .. }) => {
946946
hir::AssocItemKind::Fn { has_self: sig.decl.has_self() }
947947
}

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,7 +1556,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
15561556
});
15571557
}
15581558
}
1559-
AssocItemKind::TyAlias(box TyAlias {
1559+
AssocItemKind::Type(box TyAlias {
15601560
generics,
15611561
where_clauses,
15621562
where_predicates_split,
@@ -1595,7 +1595,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
15951595
}
15961596

15971597
match item.kind {
1598-
AssocItemKind::TyAlias(box TyAlias { ref generics, ref bounds, ref ty, .. })
1598+
AssocItemKind::Type(box TyAlias { ref generics, ref bounds, ref ty, .. })
15991599
if ctxt == AssocCtxt::Trait =>
16001600
{
16011601
self.visit_vis(&item.vis);

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
517517
fn visit_assoc_item(&mut self, i: &'a ast::AssocItem, ctxt: AssocCtxt) {
518518
let is_fn = match i.kind {
519519
ast::AssocItemKind::Fn(_) => true,
520-
ast::AssocItemKind::TyAlias(box ast::TyAlias { ref ty, .. }) => {
520+
ast::AssocItemKind::Type(box ast::TyAlias { ref ty, .. }) => {
521521
if let (Some(_), AssocCtxt::Trait) = (ty, ctxt) {
522522
gate_feature_post!(
523523
&self,

compiler/rustc_ast_pretty/src/pprust/state/item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ impl<'a> State<'a> {
516516
ast::AssocItemKind::Const(def, ty, body) => {
517517
self.print_item_const(ident, None, ty, body.as_deref(), vis, *def);
518518
}
519-
ast::AssocItemKind::TyAlias(box ast::TyAlias {
519+
ast::AssocItemKind::Type(box ast::TyAlias {
520520
defaultness,
521521
generics,
522522
where_clauses,

compiler/rustc_builtin_macros/src/deriving/generic/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ impl<'a> TraitDef<'a> {
566566
tokens: None,
567567
},
568568
attrs: ast::AttrVec::new(),
569-
kind: ast::AssocItemKind::TyAlias(Box::new(ast::TyAlias {
569+
kind: ast::AssocItemKind::Type(Box::new(ast::TyAlias {
570570
defaultness: ast::Defaultness::Final,
571571
generics: Generics::default(),
572572
where_clauses: (

compiler/rustc_lint/src/nonstandard_style.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl EarlyLintPass for NonCamelCaseTypes {
187187
}
188188

189189
fn check_trait_item(&mut self, cx: &EarlyContext<'_>, it: &ast::AssocItem) {
190-
if let ast::AssocItemKind::TyAlias(..) = it.kind {
190+
if let ast::AssocItemKind::Type(..) = it.kind {
191191
self.check_case(cx, "associated type", &it.ident);
192192
}
193193
}

compiler/rustc_passes/src/hir_stats.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
620620
fn visit_assoc_item(&mut self, i: &'v ast::AssocItem, ctxt: ast_visit::AssocCtxt) {
621621
record_variants!(
622622
(self, i, i.kind, Id::None, ast, AssocItem, AssocItemKind),
623-
[Const, Fn, TyAlias, MacCall]
623+
[Const, Fn, Type, MacCall]
624624
);
625625
ast_visit::walk_assoc_item(self, i, ctxt);
626626
}

0 commit comments

Comments
 (0)