Skip to content

Commit d3f8a0b

Browse files
committed
Auto merge of rust-lang#63213 - varkor:itemkind-tyalias, r=Centril
Rename `ItemKind::Ty` to `ItemKind::TyAlias` The current name is not entirely clear without context and `TyAlias` is consistent with `ItemKind::TraitAlias`.
2 parents f01b9f8 + fd819d0 commit d3f8a0b

File tree

36 files changed

+90
-89
lines changed

36 files changed

+90
-89
lines changed

src/librustc/hir/check_attr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub(crate) enum Target {
2626
Mod,
2727
ForeignMod,
2828
GlobalAsm,
29-
Ty,
29+
TyAlias,
3030
OpaqueTy,
3131
Enum,
3232
Struct,
@@ -50,7 +50,7 @@ impl Display for Target {
5050
Target::Mod => "module",
5151
Target::ForeignMod => "foreign module",
5252
Target::GlobalAsm => "global asm",
53-
Target::Ty => "type alias",
53+
Target::TyAlias => "type alias",
5454
Target::OpaqueTy => "opaque type",
5555
Target::Enum => "enum",
5656
Target::Struct => "struct",
@@ -75,7 +75,7 @@ impl Target {
7575
hir::ItemKind::Mod(..) => Target::Mod,
7676
hir::ItemKind::ForeignMod(..) => Target::ForeignMod,
7777
hir::ItemKind::GlobalAsm(..) => Target::GlobalAsm,
78-
hir::ItemKind::Ty(..) => Target::Ty,
78+
hir::ItemKind::TyAlias(..) => Target::TyAlias,
7979
hir::ItemKind::OpaqueTy(..) => Target::OpaqueTy,
8080
hir::ItemKind::Enum(..) => Target::Enum,
8181
hir::ItemKind::Struct(..) => Target::Struct,

src/librustc/hir/intravisit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
500500
ItemKind::GlobalAsm(_) => {
501501
visitor.visit_id(item.hir_id);
502502
}
503-
ItemKind::Ty(ref ty, ref generics) => {
503+
ItemKind::TyAlias(ref ty, ref generics) => {
504504
visitor.visit_id(item.hir_id);
505505
visitor.visit_ty(ty);
506506
visitor.visit_generics(generics)
@@ -926,7 +926,7 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
926926
impl_item.span,
927927
impl_item.hir_id);
928928
}
929-
ImplItemKind::Type(ref ty) => {
929+
ImplItemKind::TyAlias(ref ty) => {
930930
visitor.visit_id(impl_item.hir_id);
931931
visitor.visit_ty(ty);
932932
}

src/librustc/hir/lowering.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ impl<'a> LoweringContext<'a> {
486486
ItemKind::Struct(_, ref generics)
487487
| ItemKind::Union(_, ref generics)
488488
| ItemKind::Enum(_, ref generics)
489-
| ItemKind::Ty(_, ref generics)
489+
| ItemKind::TyAlias(_, ref generics)
490490
| ItemKind::OpaqueTy(_, ref generics)
491491
| ItemKind::Trait(_, _, ref generics, ..) => {
492492
let def_id = self.lctx.resolver.definitions().local_def_id(item.id);
@@ -3440,7 +3440,7 @@ impl<'a> LoweringContext<'a> {
34403440
ItemKind::Mod(ref m) => hir::ItemKind::Mod(self.lower_mod(m)),
34413441
ItemKind::ForeignMod(ref nm) => hir::ItemKind::ForeignMod(self.lower_foreign_mod(nm)),
34423442
ItemKind::GlobalAsm(ref ga) => hir::ItemKind::GlobalAsm(self.lower_global_asm(ga)),
3443-
ItemKind::Ty(ref t, ref generics) => hir::ItemKind::Ty(
3443+
ItemKind::TyAlias(ref t, ref generics) => hir::ItemKind::TyAlias(
34443444
self.lower_ty(t, ImplTraitContext::disallowed()),
34453445
self.lower_generics(generics, ImplTraitContext::disallowed()),
34463446
),
@@ -3914,9 +3914,9 @@ impl<'a> LoweringContext<'a> {
39143914

39153915
(generics, hir::ImplItemKind::Method(sig, body_id))
39163916
}
3917-
ImplItemKind::Type(ref ty) => (
3917+
ImplItemKind::TyAlias(ref ty) => (
39183918
self.lower_generics(&i.generics, ImplTraitContext::disallowed()),
3919-
hir::ImplItemKind::Type(self.lower_ty(ty, ImplTraitContext::disallowed())),
3919+
hir::ImplItemKind::TyAlias(self.lower_ty(ty, ImplTraitContext::disallowed())),
39203920
),
39213921
ImplItemKind::OpaqueTy(ref bounds) => (
39223922
self.lower_generics(&i.generics, ImplTraitContext::disallowed()),
@@ -3950,7 +3950,7 @@ impl<'a> LoweringContext<'a> {
39503950
defaultness: self.lower_defaultness(i.defaultness, true /* [1] */),
39513951
kind: match i.node {
39523952
ImplItemKind::Const(..) => hir::AssocItemKind::Const,
3953-
ImplItemKind::Type(..) => hir::AssocItemKind::Type,
3953+
ImplItemKind::TyAlias(..) => hir::AssocItemKind::Type,
39543954
ImplItemKind::OpaqueTy(..) => hir::AssocItemKind::OpaqueTy,
39553955
ImplItemKind::Method(ref sig, _) => hir::AssocItemKind::Method {
39563956
has_self: sig.decl.has_self(),

src/librustc/hir/map/def_collector.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
9393
ItemKind::Mod(..) | ItemKind::Trait(..) | ItemKind::TraitAlias(..) |
9494
ItemKind::Enum(..) | ItemKind::Struct(..) | ItemKind::Union(..) |
9595
ItemKind::OpaqueTy(..) | ItemKind::ExternCrate(..) | ItemKind::ForeignMod(..) |
96-
ItemKind::Ty(..) => DefPathData::TypeNs(i.ident.as_interned_str()),
96+
ItemKind::TyAlias(..) => DefPathData::TypeNs(i.ident.as_interned_str()),
9797
ItemKind::Fn(
9898
ref decl,
9999
ref header,
@@ -222,7 +222,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
222222
}
223223
ImplItemKind::Method(..) | ImplItemKind::Const(..) =>
224224
DefPathData::ValueNs(ii.ident.as_interned_str()),
225-
ImplItemKind::Type(..) |
225+
ImplItemKind::TyAlias(..) |
226226
ImplItemKind::OpaqueTy(..) => {
227227
DefPathData::TypeNs(ii.ident.as_interned_str())
228228
},

src/librustc/hir/map/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ impl<'hir> Map<'hir> {
302302
ItemKind::Fn(..) => DefKind::Fn,
303303
ItemKind::Mod(..) => DefKind::Mod,
304304
ItemKind::OpaqueTy(..) => DefKind::OpaqueTy,
305-
ItemKind::Ty(..) => DefKind::TyAlias,
305+
ItemKind::TyAlias(..) => DefKind::TyAlias,
306306
ItemKind::Enum(..) => DefKind::Enum,
307307
ItemKind::Struct(..) => DefKind::Struct,
308308
ItemKind::Union(..) => DefKind::Union,
@@ -333,7 +333,7 @@ impl<'hir> Map<'hir> {
333333
match item.node {
334334
ImplItemKind::Const(..) => DefKind::AssocConst,
335335
ImplItemKind::Method(..) => DefKind::Method,
336-
ImplItemKind::Type(..) => DefKind::AssocTy,
336+
ImplItemKind::TyAlias(..) => DefKind::AssocTy,
337337
ImplItemKind::OpaqueTy(..) => DefKind::AssocOpaqueTy,
338338
}
339339
}
@@ -576,7 +576,7 @@ impl<'hir> Map<'hir> {
576576
Node::Item(ref item) => {
577577
match item.node {
578578
ItemKind::Fn(_, _, ref generics, _) |
579-
ItemKind::Ty(_, ref generics) |
579+
ItemKind::TyAlias(_, ref generics) |
580580
ItemKind::Enum(_, ref generics) |
581581
ItemKind::Struct(_, ref generics) |
582582
ItemKind::Union(_, ref generics) |
@@ -1269,7 +1269,7 @@ fn hir_id_to_string(map: &Map<'_>, id: HirId, include_id: bool) -> String {
12691269
ItemKind::Mod(..) => "mod",
12701270
ItemKind::ForeignMod(..) => "foreign mod",
12711271
ItemKind::GlobalAsm(..) => "global asm",
1272-
ItemKind::Ty(..) => "ty",
1272+
ItemKind::TyAlias(..) => "ty",
12731273
ItemKind::OpaqueTy(..) => "opaque type",
12741274
ItemKind::Enum(..) => "enum",
12751275
ItemKind::Struct(..) => "struct",
@@ -1291,7 +1291,7 @@ fn hir_id_to_string(map: &Map<'_>, id: HirId, include_id: bool) -> String {
12911291
ImplItemKind::Method(..) => {
12921292
format!("method {} in {}{}", ii.ident, path_str(), id_str)
12931293
}
1294-
ImplItemKind::Type(_) => {
1294+
ImplItemKind::TyAlias(_) => {
12951295
format!("assoc type {} in {}{}", ii.ident, path_str(), id_str)
12961296
}
12971297
ImplItemKind::OpaqueTy(_) => {

src/librustc/hir/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1837,7 +1837,7 @@ pub enum ImplItemKind {
18371837
/// A method implementation with the given signature and body.
18381838
Method(MethodSig, BodyId),
18391839
/// An associated type.
1840-
Type(P<Ty>),
1840+
TyAlias(P<Ty>),
18411841
/// An associated `type = impl Trait`.
18421842
OpaqueTy(GenericBounds),
18431843
}
@@ -2420,7 +2420,7 @@ pub enum ItemKind {
24202420
/// Module-level inline assembly (from global_asm!)
24212421
GlobalAsm(P<GlobalAsm>),
24222422
/// A type alias, e.g., `type Foo = Bar<u8>`
2423-
Ty(P<Ty>, Generics),
2423+
TyAlias(P<Ty>, Generics),
24242424
/// An opaque `impl Trait` type alias, e.g., `type Foo = impl Bar;`
24252425
OpaqueTy(OpaqueTy),
24262426
/// An enum definition, e.g., `enum Foo<A, B> {C<A>, D<B>}`
@@ -2455,7 +2455,7 @@ impl ItemKind {
24552455
ItemKind::Mod(..) => "module",
24562456
ItemKind::ForeignMod(..) => "foreign module",
24572457
ItemKind::GlobalAsm(..) => "global asm",
2458-
ItemKind::Ty(..) => "type alias",
2458+
ItemKind::TyAlias(..) => "type alias",
24592459
ItemKind::OpaqueTy(..) => "opaque type",
24602460
ItemKind::Enum(..) => "enum",
24612461
ItemKind::Struct(..) => "struct",
@@ -2478,7 +2478,7 @@ impl ItemKind {
24782478
pub fn generics(&self) -> Option<&Generics> {
24792479
Some(match *self {
24802480
ItemKind::Fn(_, _, ref generics, _) |
2481-
ItemKind::Ty(_, ref generics) |
2481+
ItemKind::TyAlias(_, ref generics) |
24822482
ItemKind::OpaqueTy(OpaqueTy { ref generics, impl_trait_fn: None, .. }) |
24832483
ItemKind::Enum(_, ref generics) |
24842484
ItemKind::Struct(_, ref generics) |

src/librustc/hir/print.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ impl<'a> State<'a> {
570570
self.s.word(ga.asm.as_str().to_string());
571571
self.end()
572572
}
573-
hir::ItemKind::Ty(ref ty, ref generics) => {
573+
hir::ItemKind::TyAlias(ref ty, ref generics) => {
574574
self.print_item_type(item, &generics, |state| {
575575
state.word_space("=");
576576
state.print_type(&ty);
@@ -908,7 +908,7 @@ impl<'a> State<'a> {
908908
self.end(); // need to close a box
909909
self.ann.nested(self, Nested::Body(body));
910910
}
911-
hir::ImplItemKind::Type(ref ty) => {
911+
hir::ImplItemKind::TyAlias(ref ty) => {
912912
self.print_associated_type(ii.ident, None, Some(ty));
913913
}
914914
hir::ImplItemKind::OpaqueTy(ref bounds) => {

src/librustc/infer/error_reporting/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ impl<'tcx> TyCtxt<'tcx> {
270270
hir::ImplItemKind::Method(..) => "method body",
271271
hir::ImplItemKind::Const(..)
272272
| hir::ImplItemKind::OpaqueTy(..)
273-
| hir::ImplItemKind::Type(..) => "associated item",
273+
| hir::ImplItemKind::TyAlias(..) => "associated item",
274274
}
275275
}
276276

src/librustc/middle/dead.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ impl DeadVisitor<'tcx> {
480480
hir::ItemKind::Static(..)
481481
| hir::ItemKind::Const(..)
482482
| hir::ItemKind::Fn(..)
483-
| hir::ItemKind::Ty(..)
483+
| hir::ItemKind::TyAlias(..)
484484
| hir::ItemKind::Enum(..)
485485
| hir::ItemKind::Struct(..)
486486
| hir::ItemKind::Union(..) => true,
@@ -640,7 +640,7 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> {
640640
self.visit_nested_body(body_id)
641641
}
642642
hir::ImplItemKind::OpaqueTy(..) |
643-
hir::ImplItemKind::Type(..) => {}
643+
hir::ImplItemKind::TyAlias(..) => {}
644644
}
645645
}
646646

src/librustc/middle/reachable.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
189189
}
190190
}
191191
hir::ImplItemKind::OpaqueTy(..) |
192-
hir::ImplItemKind::Type(_) => false,
192+
hir::ImplItemKind::TyAlias(_) => false,
193193
}
194194
}
195195
Some(_) => false,
@@ -264,7 +264,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
264264
hir::ItemKind::ExternCrate(_) |
265265
hir::ItemKind::Use(..) |
266266
hir::ItemKind::OpaqueTy(..) |
267-
hir::ItemKind::Ty(..) |
267+
hir::ItemKind::TyAlias(..) |
268268
hir::ItemKind::Static(..) |
269269
hir::ItemKind::Mod(..) |
270270
hir::ItemKind::ForeignMod(..) |
@@ -302,7 +302,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
302302
}
303303
}
304304
hir::ImplItemKind::OpaqueTy(..) |
305-
hir::ImplItemKind::Type(_) => {}
305+
hir::ImplItemKind::TyAlias(_) => {}
306306
}
307307
}
308308
Node::Expr(&hir::Expr { node: hir::ExprKind::Closure(.., body, _, _), .. }) => {

0 commit comments

Comments
 (0)