Rename ItemImplKind::Type
to ItemImplKind::TyAlias
This commit is contained in:
parent
8aa45c65d8
commit
63659ca9f6
@ -926,7 +926,7 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
|
||||
impl_item.span,
|
||||
impl_item.hir_id);
|
||||
}
|
||||
ImplItemKind::Type(ref ty) => {
|
||||
ImplItemKind::TyAlias(ref ty) => {
|
||||
visitor.visit_id(impl_item.hir_id);
|
||||
visitor.visit_ty(ty);
|
||||
}
|
||||
|
@ -3914,9 +3914,9 @@ impl<'a> LoweringContext<'a> {
|
||||
|
||||
(generics, hir::ImplItemKind::Method(sig, body_id))
|
||||
}
|
||||
ImplItemKind::Type(ref ty) => (
|
||||
ImplItemKind::TyAlias(ref ty) => (
|
||||
self.lower_generics(&i.generics, ImplTraitContext::disallowed()),
|
||||
hir::ImplItemKind::Type(self.lower_ty(ty, ImplTraitContext::disallowed())),
|
||||
hir::ImplItemKind::TyAlias(self.lower_ty(ty, ImplTraitContext::disallowed())),
|
||||
),
|
||||
ImplItemKind::OpaqueTy(ref bounds) => (
|
||||
self.lower_generics(&i.generics, ImplTraitContext::disallowed()),
|
||||
@ -3950,7 +3950,7 @@ impl<'a> LoweringContext<'a> {
|
||||
defaultness: self.lower_defaultness(i.defaultness, true /* [1] */),
|
||||
kind: match i.node {
|
||||
ImplItemKind::Const(..) => hir::AssocItemKind::Const,
|
||||
ImplItemKind::Type(..) => hir::AssocItemKind::Type,
|
||||
ImplItemKind::TyAlias(..) => hir::AssocItemKind::Type,
|
||||
ImplItemKind::OpaqueTy(..) => hir::AssocItemKind::OpaqueTy,
|
||||
ImplItemKind::Method(ref sig, _) => hir::AssocItemKind::Method {
|
||||
has_self: sig.decl.has_self(),
|
||||
|
@ -222,7 +222,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
|
||||
}
|
||||
ImplItemKind::Method(..) | ImplItemKind::Const(..) =>
|
||||
DefPathData::ValueNs(ii.ident.as_interned_str()),
|
||||
ImplItemKind::Type(..) |
|
||||
ImplItemKind::TyAlias(..) |
|
||||
ImplItemKind::OpaqueTy(..) => {
|
||||
DefPathData::TypeNs(ii.ident.as_interned_str())
|
||||
},
|
||||
|
@ -333,7 +333,7 @@ impl<'hir> Map<'hir> {
|
||||
match item.node {
|
||||
ImplItemKind::Const(..) => DefKind::AssocConst,
|
||||
ImplItemKind::Method(..) => DefKind::Method,
|
||||
ImplItemKind::Type(..) => DefKind::AssocTy,
|
||||
ImplItemKind::TyAlias(..) => DefKind::AssocTy,
|
||||
ImplItemKind::OpaqueTy(..) => DefKind::AssocOpaqueTy,
|
||||
}
|
||||
}
|
||||
@ -1291,7 +1291,7 @@ fn hir_id_to_string(map: &Map<'_>, id: HirId, include_id: bool) -> String {
|
||||
ImplItemKind::Method(..) => {
|
||||
format!("method {} in {}{}", ii.ident, path_str(), id_str)
|
||||
}
|
||||
ImplItemKind::Type(_) => {
|
||||
ImplItemKind::TyAlias(_) => {
|
||||
format!("assoc type {} in {}{}", ii.ident, path_str(), id_str)
|
||||
}
|
||||
ImplItemKind::OpaqueTy(_) => {
|
||||
|
@ -1837,7 +1837,7 @@ pub enum ImplItemKind {
|
||||
/// A method implementation with the given signature and body.
|
||||
Method(MethodSig, BodyId),
|
||||
/// An associated type.
|
||||
Type(P<Ty>),
|
||||
TyAlias(P<Ty>),
|
||||
/// An associated `type = impl Trait`.
|
||||
OpaqueTy(GenericBounds),
|
||||
}
|
||||
|
@ -908,7 +908,7 @@ impl<'a> State<'a> {
|
||||
self.end(); // need to close a box
|
||||
self.ann.nested(self, Nested::Body(body));
|
||||
}
|
||||
hir::ImplItemKind::Type(ref ty) => {
|
||||
hir::ImplItemKind::TyAlias(ref ty) => {
|
||||
self.print_associated_type(ii.ident, None, Some(ty));
|
||||
}
|
||||
hir::ImplItemKind::OpaqueTy(ref bounds) => {
|
||||
|
@ -270,7 +270,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
hir::ImplItemKind::Method(..) => "method body",
|
||||
hir::ImplItemKind::Const(..)
|
||||
| hir::ImplItemKind::OpaqueTy(..)
|
||||
| hir::ImplItemKind::Type(..) => "associated item",
|
||||
| hir::ImplItemKind::TyAlias(..) => "associated item",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -640,7 +640,7 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> {
|
||||
self.visit_nested_body(body_id)
|
||||
}
|
||||
hir::ImplItemKind::OpaqueTy(..) |
|
||||
hir::ImplItemKind::Type(..) => {}
|
||||
hir::ImplItemKind::TyAlias(..) => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
hir::ImplItemKind::OpaqueTy(..) |
|
||||
hir::ImplItemKind::Type(_) => false,
|
||||
hir::ImplItemKind::TyAlias(_) => false,
|
||||
}
|
||||
}
|
||||
Some(_) => false,
|
||||
@ -302,7 +302,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
hir::ImplItemKind::OpaqueTy(..) |
|
||||
hir::ImplItemKind::Type(_) => {}
|
||||
hir::ImplItemKind::TyAlias(_) => {}
|
||||
}
|
||||
}
|
||||
Node::Expr(&hir::Expr { node: hir::ExprKind::Closure(.., body, _, _), .. }) => {
|
||||
|
@ -828,7 +828,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||
|this| intravisit::walk_impl_item(this, impl_item),
|
||||
)
|
||||
}
|
||||
Type(ref ty) => {
|
||||
TyAlias(ref ty) => {
|
||||
let generics = &impl_item.generics;
|
||||
let mut index = self.next_early_index();
|
||||
let mut non_lifetime_count = 0;
|
||||
|
@ -405,7 +405,7 @@ impl DirtyCleanVisitor<'tcx> {
|
||||
match item.node {
|
||||
ImplItemKind::Method(..) => ("Node::ImplItem", LABELS_FN_IN_IMPL),
|
||||
ImplItemKind::Const(..) => ("NodeImplConst", LABELS_CONST_IN_IMPL),
|
||||
ImplItemKind::Type(..) => ("NodeImplType", LABELS_CONST_IN_IMPL),
|
||||
ImplItemKind::TyAlias(..) => ("NodeImplType", LABELS_CONST_IN_IMPL),
|
||||
ImplItemKind::OpaqueTy(..) => ("NodeImplType", LABELS_CONST_IN_IMPL),
|
||||
}
|
||||
},
|
||||
|
@ -460,7 +460,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
|
||||
let desc = match impl_item.node {
|
||||
hir::ImplItemKind::Const(..) => "an associated constant",
|
||||
hir::ImplItemKind::Method(..) => "a method",
|
||||
hir::ImplItemKind::Type(_) => "an associated type",
|
||||
hir::ImplItemKind::TyAlias(_) => "an associated type",
|
||||
hir::ImplItemKind::OpaqueTy(_) => "an associated `impl Trait` type",
|
||||
};
|
||||
self.check_missing_docs_attrs(cx,
|
||||
|
@ -980,7 +980,7 @@ impl EncodeContext<'tcx> {
|
||||
needs_inline || is_const_fn || always_encode_mir
|
||||
},
|
||||
hir::ImplItemKind::OpaqueTy(..) |
|
||||
hir::ImplItemKind::Type(..) => false,
|
||||
hir::ImplItemKind::TyAlias(..) => false,
|
||||
};
|
||||
|
||||
Entry {
|
||||
|
@ -1371,7 +1371,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||
impl_item_ref.id.hir_id)
|
||||
}
|
||||
hir::ImplItemKind::OpaqueTy(..) |
|
||||
hir::ImplItemKind::Type(_) => false,
|
||||
hir::ImplItemKind::TyAlias(_) => false,
|
||||
}
|
||||
});
|
||||
|
||||
@ -1397,7 +1397,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||
{
|
||||
intravisit::walk_impl_item(self, impl_item)
|
||||
}
|
||||
hir::ImplItemKind::Type(..) => {
|
||||
hir::ImplItemKind::TyAlias(..) => {
|
||||
intravisit::walk_impl_item(self, impl_item)
|
||||
}
|
||||
_ => {}
|
||||
@ -1423,7 +1423,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
|
||||
// Those in 3. are warned with this call.
|
||||
for impl_item_ref in impl_item_refs {
|
||||
let impl_item = self.tcx.hir().impl_item(impl_item_ref.id);
|
||||
if let hir::ImplItemKind::Type(ref ty) = impl_item.node {
|
||||
if let hir::ImplItemKind::TyAlias(ref ty) = impl_item.node {
|
||||
self.visit_ty(ty);
|
||||
}
|
||||
}
|
||||
|
@ -3079,7 +3079,7 @@ impl<'a> Resolver<'a> {
|
||||
|
||||
visit::walk_impl_item(this, impl_item);
|
||||
}
|
||||
ImplItemKind::Type(ref ty) => {
|
||||
ImplItemKind::TyAlias(ref ty) => {
|
||||
// If this is a trait impl, ensure the type
|
||||
// exists in trait
|
||||
this.check_trait_item(impl_item.ident,
|
||||
|
@ -1167,7 +1167,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> {
|
||||
impl_item.span,
|
||||
);
|
||||
}
|
||||
ast::ImplItemKind::Type(ref ty) => {
|
||||
ast::ImplItemKind::TyAlias(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.
|
||||
|
@ -1543,7 +1543,7 @@ fn check_specialization_validity<'tcx>(
|
||||
hir::ImplItemKind::Const(..) => ty::AssocKind::Const,
|
||||
hir::ImplItemKind::Method(..) => ty::AssocKind::Method,
|
||||
hir::ImplItemKind::OpaqueTy(..) => ty::AssocKind::OpaqueTy,
|
||||
hir::ImplItemKind::Type(_) => ty::AssocKind::Type
|
||||
hir::ImplItemKind::TyAlias(_) => ty::AssocKind::Type,
|
||||
};
|
||||
|
||||
let parent = ancestors.defs(tcx, trait_item.ident, kind, trait_def.def_id).nth(1)
|
||||
@ -1640,7 +1640,7 @@ fn check_impl_items_against_trait<'tcx>(
|
||||
}
|
||||
}
|
||||
hir::ImplItemKind::OpaqueTy(..) |
|
||||
hir::ImplItemKind::Type(_) => {
|
||||
hir::ImplItemKind::TyAlias(_) => {
|
||||
if ty_trait_item.kind == ty::AssocKind::Type {
|
||||
if ty_trait_item.defaultness.has_value() {
|
||||
overridden_associated_type = Some(impl_item);
|
||||
|
@ -1220,7 +1220,7 @@ pub fn checked_type_of(tcx: TyCtxt<'_>, def_id: DefId, fail: bool) -> Option<Ty<
|
||||
|
||||
find_opaque_ty_constraints(tcx, def_id)
|
||||
}
|
||||
ImplItemKind::Type(ref ty) => {
|
||||
ImplItemKind::TyAlias(ref ty) => {
|
||||
if tcx
|
||||
.impl_trait_ref(tcx.hir().get_parent_did(hir_id))
|
||||
.is_none()
|
||||
|
@ -189,7 +189,7 @@ fn enforce_impl_items_are_distinct(tcx: TyCtxt<'_>, impl_item_refs: &[hir::ImplI
|
||||
for impl_item_ref in impl_item_refs {
|
||||
let impl_item = tcx.hir().impl_item(impl_item_ref.id);
|
||||
let seen_items = match impl_item.node {
|
||||
hir::ImplItemKind::Type(_) => &mut seen_type_items,
|
||||
hir::ImplItemKind::TyAlias(_) => &mut seen_type_items,
|
||||
_ => &mut seen_value_items,
|
||||
};
|
||||
match seen_items.entry(impl_item.ident.modern()) {
|
||||
|
@ -23,7 +23,7 @@ impl<'a> From <&'a hir::ImplItemKind> for Namespace {
|
||||
fn from(impl_kind: &'a hir::ImplItemKind) -> Self {
|
||||
match *impl_kind {
|
||||
hir::ImplItemKind::OpaqueTy(..) |
|
||||
hir::ImplItemKind::Type(..) => Namespace::Type,
|
||||
hir::ImplItemKind::TyAlias(..) => Namespace::Type,
|
||||
hir::ImplItemKind::Const(..) |
|
||||
hir::ImplItemKind::Method(..) => Namespace::Value,
|
||||
}
|
||||
|
@ -2253,7 +2253,7 @@ impl Clean<Item> for hir::ImplItem {
|
||||
hir::ImplItemKind::Method(ref sig, body) => {
|
||||
MethodItem((sig, &self.generics, body, Some(self.defaultness)).clean(cx))
|
||||
}
|
||||
hir::ImplItemKind::Type(ref ty) => TypedefItem(Typedef {
|
||||
hir::ImplItemKind::TyAlias(ref ty) => TypedefItem(Typedef {
|
||||
type_: ty.clean(cx),
|
||||
generics: Generics::default(),
|
||||
}, true),
|
||||
|
@ -1508,7 +1508,7 @@ pub struct ImplItem {
|
||||
pub enum ImplItemKind {
|
||||
Const(P<Ty>, P<Expr>),
|
||||
Method(MethodSig, P<Block>),
|
||||
Type(P<Ty>),
|
||||
TyAlias(P<Ty>),
|
||||
OpaqueTy(GenericBounds),
|
||||
Macro(Mac),
|
||||
}
|
||||
|
@ -2254,7 +2254,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
||||
"`impl Trait` in type aliases is unstable"
|
||||
);
|
||||
}
|
||||
ast::ImplItemKind::Type(_) => {
|
||||
ast::ImplItemKind::TyAlias(_) => {
|
||||
if !ii.generics.params.is_empty() {
|
||||
gate_feature_post!(&self, generic_associated_types, ii.span,
|
||||
"generic associated types are unstable");
|
||||
|
@ -933,7 +933,7 @@ pub fn noop_flat_map_impl_item<T: MutVisitor>(mut item: ImplItem, visitor: &mut
|
||||
visit_method_sig(sig, visitor);
|
||||
visitor.visit_block(body);
|
||||
}
|
||||
ImplItemKind::Type(ty) => visitor.visit_ty(ty),
|
||||
ImplItemKind::TyAlias(ty) => visitor.visit_ty(ty),
|
||||
ImplItemKind::OpaqueTy(bounds) => visit_bounds(bounds, visitor),
|
||||
ImplItemKind::Macro(mac) => visitor.visit_mac(mac),
|
||||
}
|
||||
|
@ -5687,7 +5687,7 @@ impl<'a> Parser<'a> {
|
||||
let (name, node, generics) = if let Some(type_) = self.eat_type() {
|
||||
let (name, alias, generics) = type_?;
|
||||
let kind = match alias {
|
||||
AliasKind::Weak(typ) => ast::ImplItemKind::Type(typ),
|
||||
AliasKind::Weak(typ) => ast::ImplItemKind::TyAlias(typ),
|
||||
AliasKind::OpaqueTy(bounds) => ast::ImplItemKind::OpaqueTy(bounds),
|
||||
};
|
||||
(name, kind, generics)
|
||||
|
@ -1579,7 +1579,7 @@ impl<'a> State<'a> {
|
||||
self.nbsp();
|
||||
self.print_block_with_attrs(body, &ii.attrs);
|
||||
}
|
||||
ast::ImplItemKind::Type(ref ty) => {
|
||||
ast::ImplItemKind::TyAlias(ref ty) => {
|
||||
self.print_associated_type(ii.ident, None, Some(ty));
|
||||
}
|
||||
ast::ImplItemKind::OpaqueTy(ref bounds) => {
|
||||
|
@ -616,7 +616,7 @@ pub fn walk_impl_item<'a, V: Visitor<'a>>(visitor: &mut V, impl_item: &'a ImplIt
|
||||
visitor.visit_fn(FnKind::Method(impl_item.ident, sig, Some(&impl_item.vis), body),
|
||||
&sig.decl, impl_item.span, impl_item.id);
|
||||
}
|
||||
ImplItemKind::Type(ref ty) => {
|
||||
ImplItemKind::TyAlias(ref ty) => {
|
||||
visitor.visit_ty(ty);
|
||||
}
|
||||
ImplItemKind::OpaqueTy(ref bounds) => {
|
||||
|
@ -529,7 +529,8 @@ impl<'a> TraitDef<'a> {
|
||||
defaultness: ast::Defaultness::Final,
|
||||
attrs: Vec::new(),
|
||||
generics: Generics::default(),
|
||||
node: ast::ImplItemKind::Type(type_def.to_ty(cx, self.span, type_ident, generics)),
|
||||
node: ast::ImplItemKind::TyAlias(
|
||||
type_def.to_ty(cx, self.span, type_ident, generics)),
|
||||
tokens: None,
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user