diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 9a46444d823..347e735fadf 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -908,11 +908,11 @@ fn lower_impl_item(&mut self, i: &AssocItem) -> &'hir hir::ImplItem<'hir> { |this| match ty { None => { let ty = this.arena.alloc(this.ty(i.span, hir::TyKind::Err)); - hir::ImplItemKind::TyAlias(ty) + hir::ImplItemKind::Type(ty) } Some(ty) => { let ty = this.lower_ty(ty, &ImplTraitContext::TypeAliasesOpaqueTy); - hir::ImplItemKind::TyAlias(ty) + hir::ImplItemKind::Type(ty) } }, ) diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 922ce738dbb..098f9d51549 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -2315,7 +2315,7 @@ pub enum ImplItemKind<'hir> { /// An associated function implementation with the given signature and body. Fn(FnSig<'hir>, BodyId), /// An associated type. - TyAlias(&'hir Ty<'hir>), + Type(&'hir Ty<'hir>), } // The name of the associated type for `Fn` return types. diff --git a/compiler/rustc_hir/src/intravisit.rs b/compiler/rustc_hir/src/intravisit.rs index 8777a54ba09..f3bde099b13 100644 --- a/compiler/rustc_hir/src/intravisit.rs +++ b/compiler/rustc_hir/src/intravisit.rs @@ -979,7 +979,7 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt impl_item.hir_id(), ); } - ImplItemKind::TyAlias(ref ty) => { + ImplItemKind::Type(ref ty) => { visitor.visit_id(impl_item.hir_id()); visitor.visit_ty(ty); } diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index fea02d2356c..c92d8dfb602 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -1062,7 +1062,7 @@ fn check_impl_items_against_trait<'tcx>( opt_trait_span, ); } - hir::ImplItemKind::TyAlias(impl_ty) => { + hir::ImplItemKind::Type(impl_ty) => { let opt_trait_span = tcx.hir().span_if_local(ty_trait_item.def_id); compare_ty_impl( tcx, diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index 441eac03b50..0bd45bb1c91 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -837,7 +837,7 @@ fn check_impl_item(tcx: TyCtxt<'_>, impl_item: &hir::ImplItem<'_>) { let (method_sig, span) = match impl_item.kind { hir::ImplItemKind::Fn(ref sig, _) => (Some(sig), impl_item.span), // Constrain binding and overflow error spans to `` in `type foo = `. - hir::ImplItemKind::TyAlias(ty) if ty.span != DUMMY_SP => (None, ty.span), + hir::ImplItemKind::Type(ty) if ty.span != DUMMY_SP => (None, ty.span), _ => (None, impl_item.span), }; diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index ab4b861b6cb..6976c5a0edb 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -738,7 +738,7 @@ fn convert_impl_item(tcx: TyCtxt<'_>, impl_item_id: hir::ImplItemId) { hir::ImplItemKind::Fn(..) => { tcx.ensure().fn_sig(def_id); } - hir::ImplItemKind::TyAlias(_) => { + hir::ImplItemKind::Type(_) => { // Account for `type T = _;` let mut visitor = HirPlaceholderCollector::default(); visitor.visit_impl_item(impl_item); diff --git a/compiler/rustc_hir_analysis/src/collect/generics_of.rs b/compiler/rustc_hir_analysis/src/collect/generics_of.rs index 7ffacbecf5f..707fd6c7527 100644 --- a/compiler/rustc_hir_analysis/src/collect/generics_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/generics_of.rs @@ -213,7 +213,7 @@ enum Defaults { Node::TraitItem(item) if matches!(item.kind, TraitItemKind::Type(..)) => { (None, Defaults::Deny) } - Node::ImplItem(item) if matches!(item.kind, ImplItemKind::TyAlias(..)) => { + Node::ImplItem(item) if matches!(item.kind, ImplItemKind::Type(..)) => { (None, Defaults::Deny) } diff --git a/compiler/rustc_hir_analysis/src/collect/type_of.rs b/compiler/rustc_hir_analysis/src/collect/type_of.rs index 5972f6b8800..1b7ed60929d 100644 --- a/compiler/rustc_hir_analysis/src/collect/type_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/type_of.rs @@ -284,7 +284,7 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> { icx.to_ty(ty) } } - ImplItemKind::TyAlias(ty) => { + ImplItemKind::Type(ty) => { if tcx.impl_trait_ref(tcx.hir().get_parent_item(hir_id)).is_none() { check_feature_inherent_assoc_ty(tcx, item.span); } diff --git a/compiler/rustc_hir_analysis/src/hir_wf_check.rs b/compiler/rustc_hir_analysis/src/hir_wf_check.rs index 53f636d19b4..b0fdfcf38a6 100644 --- a/compiler/rustc_hir_analysis/src/hir_wf_check.rs +++ b/compiler/rustc_hir_analysis/src/hir_wf_check.rs @@ -117,7 +117,7 @@ fn visit_ty(&mut self, ty: &'tcx hir::Ty<'tcx>) { let ty = match loc { WellFormedLoc::Ty(_) => match hir.get(hir_id) { hir::Node::ImplItem(item) => match item.kind { - hir::ImplItemKind::TyAlias(ty) => Some(ty), + hir::ImplItemKind::Type(ty) => Some(ty), hir::ImplItemKind::Const(ty, _) => Some(ty), ref item => bug!("Unexpected ImplItem {:?}", item), }, diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index 35a58296e37..729139adc2d 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -887,7 +887,7 @@ pub fn print_impl_item(&mut self, ii: &hir::ImplItem<'_>) { self.end(); // need to close a box self.ann.nested(self, Nested::Body(body)); } - hir::ImplItemKind::TyAlias(ty) => { + hir::ImplItemKind::Type(ty) => { self.print_associated_type(ii.ident, ii.generics, None, Some(ty)); } } diff --git a/compiler/rustc_incremental/src/persist/dirty_clean.rs b/compiler/rustc_incremental/src/persist/dirty_clean.rs index 09163e4f25f..9c19f16a496 100644 --- a/compiler/rustc_incremental/src/persist/dirty_clean.rs +++ b/compiler/rustc_incremental/src/persist/dirty_clean.rs @@ -302,7 +302,7 @@ fn auto_labels(&mut self, item_id: LocalDefId, attr: &Attribute) -> (&'static st HirNode::ImplItem(item) => match item.kind { ImplItemKind::Fn(..) => ("Node::ImplItem", LABELS_FN_IN_IMPL), ImplItemKind::Const(..) => ("NodeImplConst", LABELS_CONST_IN_IMPL), - ImplItemKind::TyAlias(..) => ("NodeImplType", LABELS_CONST_IN_IMPL), + ImplItemKind::Type(..) => ("NodeImplType", LABELS_CONST_IN_IMPL), }, _ => self.tcx.sess.span_fatal( attr.span, diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index dd6b85c3950..ddeeaa9618e 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -2598,7 +2598,7 @@ enum SubOrigin<'hir> { for h in self.tcx.hir().parent_iter(param.hir_id) { break 'origin match h.1 { Node::ImplItem(hir::ImplItem { - kind: hir::ImplItemKind::TyAlias(..), + kind: hir::ImplItemKind::Type(..), generics, .. }) diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs index b78c3f85596..302f12a6f7d 100644 --- a/compiler/rustc_middle/src/hir/map/mod.rs +++ b/compiler/rustc_middle/src/hir/map/mod.rs @@ -241,7 +241,7 @@ pub(super) fn opt_def_kind(self, local_def_id: LocalDefId) -> Option { Node::ImplItem(item) => match item.kind { ImplItemKind::Const(..) => DefKind::AssocConst, ImplItemKind::Fn(..) => DefKind::AssocFn, - ImplItemKind::TyAlias(..) => DefKind::AssocTy, + ImplItemKind::Type(..) => DefKind::AssocTy, }, Node::Variant(_) => DefKind::Variant, Node::Ctor(variant_data) => { @@ -1244,7 +1244,7 @@ fn hir_id_to_string(map: Map<'_>, id: HirId) -> String { format!("assoc const {} in {}{}", ii.ident, path_str(), id_str) } ImplItemKind::Fn(..) => format!("method {} in {}{}", ii.ident, path_str(), id_str), - ImplItemKind::TyAlias(_) => { + ImplItemKind::Type(_) => { format!("assoc type {} in {}{}", ii.ident, path_str(), id_str) } }, diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 87433538512..5455d063c13 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -49,7 +49,7 @@ pub(crate) fn target_from_impl_item<'tcx>( Target::Method(MethodKind::Inherent) } } - hir::ImplItemKind::TyAlias(..) => Target::AssocTy, + hir::ImplItemKind::Type(..) => Target::AssocTy, } } diff --git a/compiler/rustc_passes/src/hir_stats.rs b/compiler/rustc_passes/src/hir_stats.rs index 0be2fc05344..b413d78b38d 100644 --- a/compiler/rustc_passes/src/hir_stats.rs +++ b/compiler/rustc_passes/src/hir_stats.rs @@ -391,7 +391,7 @@ fn visit_trait_item_ref(&mut self, ti: &'v hir::TraitItemRef) { fn visit_impl_item(&mut self, ii: &'v hir::ImplItem<'v>) { record_variants!( (self, ii, ii.kind, Id::Node(ii.hir_id()), hir, ImplItem, ImplItemKind), - [Const, Fn, TyAlias] + [Const, Fn, Type] ); hir_visit::walk_impl_item(self, ii) } diff --git a/compiler/rustc_passes/src/reachable.rs b/compiler/rustc_passes/src/reachable.rs index 16055641aca..0f2879c1eff 100644 --- a/compiler/rustc_passes/src/reachable.rs +++ b/compiler/rustc_passes/src/reachable.rs @@ -155,7 +155,7 @@ fn def_id_represents_local_inlined_item(&self, def_id: DefId) -> bool { let impl_did = self.tcx.hir().get_parent_item(hir_id); method_might_be_inlined(self.tcx, impl_item, impl_did.def_id) } - hir::ImplItemKind::TyAlias(_) => false, + hir::ImplItemKind::Type(_) => false, }, Some(_) => false, None => false, // This will happen for default methods. @@ -271,7 +271,7 @@ fn propagate_node(&mut self, node: &Node<'tcx>, search_item: LocalDefId) { self.visit_nested_body(body) } } - hir::ImplItemKind::TyAlias(_) => {} + hir::ImplItemKind::Type(_) => {} }, Node::Expr(&hir::Expr { kind: hir::ExprKind::Closure(&hir::Closure { body, .. }), diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs index 841e3ebb2a1..0983c3148f2 100644 --- a/compiler/rustc_privacy/src/lib.rs +++ b/compiler/rustc_privacy/src/lib.rs @@ -1574,7 +1574,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) { hir::ImplItemKind::Const(..) | hir::ImplItemKind::Fn(..) => { self.access_levels.is_reachable(impl_item_ref.id.def_id.def_id) } - hir::ImplItemKind::TyAlias(_) => false, + hir::ImplItemKind::Type(_) => false, } }); @@ -1596,7 +1596,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) { { intravisit::walk_impl_item(self, impl_item) } - hir::ImplItemKind::TyAlias(..) => { + hir::ImplItemKind::Type(..) => { intravisit::walk_impl_item(self, impl_item) } _ => {} @@ -1622,7 +1622,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) { // Those in 3. are warned with this call. for impl_item_ref in impl_.items { let impl_item = self.tcx.hir().impl_item(impl_item_ref.id); - if let hir::ImplItemKind::TyAlias(ty) = impl_item.kind { + if let hir::ImplItemKind::Type(ty) = impl_item.kind { self.visit_ty(ty); } } diff --git a/compiler/rustc_resolve/src/late/lifetimes.rs b/compiler/rustc_resolve/src/late/lifetimes.rs index 0c29ff364dc..8fa6160d436 100644 --- a/compiler/rustc_resolve/src/late/lifetimes.rs +++ b/compiler/rustc_resolve/src/late/lifetimes.rs @@ -898,7 +898,7 @@ fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem<'tcx>) { Fn(..) => self.visit_early_late(impl_item.hir_id(), &impl_item.generics, |this| { intravisit::walk_impl_item(this, impl_item) }), - TyAlias(ref ty) => { + Type(ref ty) => { let generics = &impl_item.generics; let lifetimes: FxIndexMap = generics .params diff --git a/compiler/rustc_save_analysis/src/dump_visitor.rs b/compiler/rustc_save_analysis/src/dump_visitor.rs index ecb09f0c4b7..23d06d8e516 100644 --- a/compiler/rustc_save_analysis/src/dump_visitor.rs +++ b/compiler/rustc_save_analysis/src/dump_visitor.rs @@ -1069,7 +1069,7 @@ fn process_impl_item(&mut self, impl_item: &'tcx hir::ImplItem<'tcx>, impl_id: D impl_item.span, ); } - hir::ImplItemKind::TyAlias(ref ty) => { + hir::ImplItemKind::Type(ref ty) => { // FIXME: uses of the assoc type should ideally point to this // 'def' and the name here should be a ref to the def in the // trait. diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index 22289657b81..490b0e86322 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -1659,7 +1659,7 @@ fn report_projection_error( .. }) | hir::Node::ImplItem(hir::ImplItem { - kind: hir::ImplItemKind::TyAlias(ty), + kind: hir::ImplItemKind::Type(ty), .. }), ) => Some((ty.span, format!("type mismatch resolving `{}`", predicate))), diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs index b1fae164d85..635cdde0e8e 100644 --- a/compiler/rustc_trait_selection/src/traits/wf.rs +++ b/compiler/rustc_trait_selection/src/traits/wf.rs @@ -224,7 +224,7 @@ fn extend_cause_with_original_assoc_item_obligation<'tcx>( }; let fix_span = |impl_item_ref: &hir::ImplItemRef| match tcx.hir().impl_item(impl_item_ref.id).kind { - hir::ImplItemKind::Const(ty, _) | hir::ImplItemKind::TyAlias(ty) => ty.span, + hir::ImplItemKind::Const(ty, _) | hir::ImplItemKind::Type(ty) => ty.span, _ => impl_item_ref.span, }; diff --git a/compiler/rustc_ty_utils/src/ty.rs b/compiler/rustc_ty_utils/src/ty.rs index f7db39dfec3..30efbf66175 100644 --- a/compiler/rustc_ty_utils/src/ty.rs +++ b/compiler/rustc_ty_utils/src/ty.rs @@ -161,7 +161,7 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> { }) => hir::Constness::Const, hir::Node::ImplItem(hir::ImplItem { - kind: hir::ImplItemKind::TyAlias(..) | hir::ImplItemKind::Fn(..), + kind: hir::ImplItemKind::Type(..) | hir::ImplItemKind::Fn(..), .. }) => { let parent_hir_id = tcx.hir().get_parent_node(hir_id); diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 7893429f26f..432d318907f 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -410,7 +410,7 @@ pub(crate) fn build_impl( let assoc_kind = match item.kind { hir::ImplItemKind::Const(..) => ty::AssocKind::Const, hir::ImplItemKind::Fn(..) => ty::AssocKind::Fn, - hir::ImplItemKind::TyAlias(..) => ty::AssocKind::Type, + hir::ImplItemKind::Type(..) => ty::AssocKind::Type, }; let trait_item = tcx .associated_items(associated_trait.def_id) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 279e762d597..38823d83a98 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1094,7 +1094,7 @@ pub(crate) fn clean_impl_item<'tcx>( let defaultness = cx.tcx.impl_defaultness(impl_.def_id); MethodItem(m, Some(defaultness)) } - hir::ImplItemKind::TyAlias(hir_ty) => { + hir::ImplItemKind::Type(hir_ty) => { let type_ = clean_ty(hir_ty, cx); let generics = clean_generics(impl_.generics, cx); let item_type = clean_middle_ty(hir_ty_to_ty(cx.tcx, hir_ty), cx, None); diff --git a/src/tools/clippy/clippy_lints/src/missing_inline.rs b/src/tools/clippy/clippy_lints/src/missing_inline.rs index 655df5419ac..01c87f058ad 100644 --- a/src/tools/clippy/clippy_lints/src/missing_inline.rs +++ b/src/tools/clippy/clippy_lints/src/missing_inline.rs @@ -148,7 +148,7 @@ fn check_impl_item(&mut self, cx: &LateContext<'tcx>, impl_item: &'tcx hir::Impl let desc = match impl_item.kind { hir::ImplItemKind::Fn(..) => "a method", - hir::ImplItemKind::Const(..) | hir::ImplItemKind::TyAlias(_) => return, + hir::ImplItemKind::Const(..) | hir::ImplItemKind::Type(_) => return, }; let assoc_item = cx.tcx.associated_item(impl_item.def_id); diff --git a/src/tools/clippy/clippy_lints/src/types/mod.rs b/src/tools/clippy/clippy_lints/src/types/mod.rs index 79c31efb9fc..a06d1fffd8b 100644 --- a/src/tools/clippy/clippy_lints/src/types/mod.rs +++ b/src/tools/clippy/clippy_lints/src/types/mod.rs @@ -374,7 +374,7 @@ fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx ImplItem<'_>) // Methods are covered by check_fn. // Type aliases are ignored because oftentimes it's impossible to // make type alias declaration in trait simpler, see #1013 - ImplItemKind::Fn(..) | ImplItemKind::TyAlias(..) => (), + ImplItemKind::Fn(..) | ImplItemKind::Type(..) => (), } } diff --git a/src/tools/clippy/clippy_utils/src/check_proc_macro.rs b/src/tools/clippy/clippy_utils/src/check_proc_macro.rs index 7a8d4e8068e..c6bf98b7b8b 100644 --- a/src/tools/clippy/clippy_utils/src/check_proc_macro.rs +++ b/src/tools/clippy/clippy_utils/src/check_proc_macro.rs @@ -220,7 +220,7 @@ fn trait_item_search_pat(item: &TraitItem<'_>) -> (Pat, Pat) { fn impl_item_search_pat(item: &ImplItem<'_>) -> (Pat, Pat) { let (start_pat, end_pat) = match &item.kind { ImplItemKind::Const(..) => (Pat::Str("const"), Pat::Str(";")), - ImplItemKind::TyAlias(..) => (Pat::Str("type"), Pat::Str(";")), + ImplItemKind::Type(..) => (Pat::Str("type"), Pat::Str(";")), ImplItemKind::Fn(sig, ..) => (fn_header_search_pat(sig.header), Pat::Str("")), }; if item.vis_span.is_empty() {