hir::ItemKind::Mod(..) => Target::Mod,
hir::ItemKind::ForeignMod(..) => Target::ForeignMod,
hir::ItemKind::GlobalAsm(..) => Target::GlobalAsm,
- hir::ItemKind::Ty(..) => Target::Ty,
+ hir::ItemKind::TyAlias(..) => Target::TyAlias,
hir::ItemKind::OpaqueTy(..) => Target::OpaqueTy,
hir::ItemKind::Enum(..) => Target::Enum,
hir::ItemKind::Struct(..) => Target::Struct,
ItemKind::GlobalAsm(_) => {
visitor.visit_id(item.hir_id);
}
- ItemKind::Ty(ref ty, ref generics) => {
+ ItemKind::TyAlias(ref ty, ref generics) => {
visitor.visit_id(item.hir_id);
visitor.visit_ty(ty);
visitor.visit_generics(generics)
ItemKind::Struct(_, ref generics)
| ItemKind::Union(_, ref generics)
| ItemKind::Enum(_, ref generics)
- | ItemKind::Ty(_, ref generics)
+ | ItemKind::TyAlias(_, ref generics)
| ItemKind::OpaqueTy(_, ref generics)
| ItemKind::Trait(_, _, ref generics, ..) => {
let def_id = self.lctx.resolver.definitions().local_def_id(item.id);
ItemKind::Mod(ref m) => hir::ItemKind::Mod(self.lower_mod(m)),
ItemKind::ForeignMod(ref nm) => hir::ItemKind::ForeignMod(self.lower_foreign_mod(nm)),
ItemKind::GlobalAsm(ref ga) => hir::ItemKind::GlobalAsm(self.lower_global_asm(ga)),
- ItemKind::Ty(ref t, ref generics) => hir::ItemKind::Ty(
+ ItemKind::TyAlias(ref t, ref generics) => hir::ItemKind::TyAlias(
self.lower_ty(t, ImplTraitContext::disallowed()),
self.lower_generics(generics, ImplTraitContext::disallowed()),
),
ItemKind::Mod(..) | ItemKind::Trait(..) | ItemKind::TraitAlias(..) |
ItemKind::Enum(..) | ItemKind::Struct(..) | ItemKind::Union(..) |
ItemKind::OpaqueTy(..) | ItemKind::ExternCrate(..) | ItemKind::ForeignMod(..) |
- ItemKind::Ty(..) => DefPathData::TypeNs(i.ident.as_interned_str()),
+ ItemKind::TyAlias(..) => DefPathData::TypeNs(i.ident.as_interned_str()),
ItemKind::Fn(
ref decl,
ref header,
ItemKind::Fn(..) => DefKind::Fn,
ItemKind::Mod(..) => DefKind::Mod,
ItemKind::OpaqueTy(..) => DefKind::OpaqueTy,
- ItemKind::Ty(..) => DefKind::TyAlias,
+ ItemKind::TyAlias(..) => DefKind::TyAlias,
ItemKind::Enum(..) => DefKind::Enum,
ItemKind::Struct(..) => DefKind::Struct,
ItemKind::Union(..) => DefKind::Union,
Node::Item(ref item) => {
match item.node {
ItemKind::Fn(_, _, ref generics, _) |
- ItemKind::Ty(_, ref generics) |
+ ItemKind::TyAlias(_, ref generics) |
ItemKind::Enum(_, ref generics) |
ItemKind::Struct(_, ref generics) |
ItemKind::Union(_, ref generics) |
ItemKind::Mod(..) => "mod",
ItemKind::ForeignMod(..) => "foreign mod",
ItemKind::GlobalAsm(..) => "global asm",
- ItemKind::Ty(..) => "ty",
+ ItemKind::TyAlias(..) => "ty",
ItemKind::OpaqueTy(..) => "opaque type",
ItemKind::Enum(..) => "enum",
ItemKind::Struct(..) => "struct",
/// Module-level inline assembly (from global_asm!)
GlobalAsm(P<GlobalAsm>),
/// A type alias, e.g., `type Foo = Bar<u8>`
- Ty(P<Ty>, Generics),
+ TyAlias(P<Ty>, Generics),
/// An opaque `impl Trait` type alias, e.g., `type Foo = impl Bar;`
OpaqueTy(OpaqueTy),
/// An enum definition, e.g., `enum Foo<A, B> {C<A>, D<B>}`
ItemKind::Mod(..) => "module",
ItemKind::ForeignMod(..) => "foreign module",
ItemKind::GlobalAsm(..) => "global asm",
- ItemKind::Ty(..) => "type alias",
+ ItemKind::TyAlias(..) => "type alias",
ItemKind::OpaqueTy(..) => "opaque type",
ItemKind::Enum(..) => "enum",
ItemKind::Struct(..) => "struct",
pub fn generics(&self) -> Option<&Generics> {
Some(match *self {
ItemKind::Fn(_, _, ref generics, _) |
- ItemKind::Ty(_, ref generics) |
+ ItemKind::TyAlias(_, ref generics) |
ItemKind::OpaqueTy(OpaqueTy { ref generics, impl_trait_fn: None, .. }) |
ItemKind::Enum(_, ref generics) |
ItemKind::Struct(_, ref generics) |
self.s.word(ga.asm.as_str().to_string());
self.end()
}
- hir::ItemKind::Ty(ref ty, ref generics) => {
+ hir::ItemKind::TyAlias(ref ty, ref generics) => {
self.print_item_type(item, &generics, |state| {
state.word_space("=");
state.print_type(&ty);
hir::ItemKind::Static(..)
| hir::ItemKind::Const(..)
| hir::ItemKind::Fn(..)
- | hir::ItemKind::Ty(..)
+ | hir::ItemKind::TyAlias(..)
| hir::ItemKind::Enum(..)
| hir::ItemKind::Struct(..)
| hir::ItemKind::Union(..) => true,
hir::ItemKind::ExternCrate(_) |
hir::ItemKind::Use(..) |
hir::ItemKind::OpaqueTy(..) |
- hir::ItemKind::Ty(..) |
+ hir::ItemKind::TyAlias(..) |
hir::ItemKind::Static(..) |
hir::ItemKind::Mod(..) |
hir::ItemKind::ForeignMod(..) |
// items. Doing anything on this node is irrelevant, as we currently don't need
// it.
}
- hir::ItemKind::Ty(_, ref generics)
+ hir::ItemKind::TyAlias(_, ref generics)
| hir::ItemKind::OpaqueTy(hir::OpaqueTy {
impl_trait_fn: None,
ref generics,
impl_trait_fn: None,
..
})
- | hir::ItemKind::Ty(_, ref generics)
+ | hir::ItemKind::TyAlias(_, ref generics)
| hir::ItemKind::Trait(_, _, ref generics, ..) => {
let result = object_lifetime_defaults_for_item(tcx, generics);
HirItem::GlobalAsm(..) => ("ItemGlobalAsm", LABELS_HIR_ONLY),
// A type alias, e.g., `type Foo = Bar<u8>`
- HirItem::Ty(..) => ("ItemTy", LABELS_HIR_ONLY),
+ HirItem::TyAlias(..) => ("ItemTy", LABELS_HIR_ONLY),
// An enum definition, e.g., `enum Foo<A, B> {C<A>, D<B>}`
HirItem::Enum(..) => ("ItemEnum", LABELS_ADT),
fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item) {
match it.node {
hir::ItemKind::Fn(..) |
- hir::ItemKind::Ty(..) |
+ hir::ItemKind::TyAlias(..) |
hir::ItemKind::Enum(..) |
hir::ItemKind::Struct(..) |
hir::ItemKind::Union(..) => {
}
"a trait"
}
- hir::ItemKind::Ty(..) => "a type alias",
+ hir::ItemKind::TyAlias(..) => "a type alias",
hir::ItemKind::Impl(.., Some(ref trait_ref), _, ref impl_item_refs) => {
// If the trait is private, add the impl items to `private_traits` so they don't get
// reported for missing docs.
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeAliasBounds {
fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item) {
let (ty, type_alias_generics) = match item.node {
- hir::ItemKind::Ty(ref ty, ref generics) => (&*ty, generics),
+ hir::ItemKind::TyAlias(ref ty, ref generics) => (&*ty, generics),
_ => return,
};
let mut suggested_changing_assoc_types = false;
}
match it.node {
- ast::ItemKind::Ty(..) |
+ ast::ItemKind::TyAlias(..) |
ast::ItemKind::Enum(..) |
ast::ItemKind::Struct(..) |
ast::ItemKind::Union(..) => self.check_case(cx, "type", &it.ident),
}
hir::ItemKind::ForeignMod(_) => EntryKind::ForeignMod,
hir::ItemKind::GlobalAsm(..) => EntryKind::GlobalAsm,
- hir::ItemKind::Ty(..) => EntryKind::Type,
+ hir::ItemKind::TyAlias(..) => EntryKind::Type,
hir::ItemKind::OpaqueTy(..) => EntryKind::OpaqueTy,
hir::ItemKind::Enum(..) => EntryKind::Enum(get_repr_options(tcx, def_id)),
hir::ItemKind::Struct(ref struct_def, _) => {
hir::ItemKind::Static(..) |
hir::ItemKind::Const(..) |
hir::ItemKind::Fn(..) |
- hir::ItemKind::Ty(..) |
+ hir::ItemKind::TyAlias(..) |
hir::ItemKind::OpaqueTy(..) |
hir::ItemKind::Enum(..) |
hir::ItemKind::Struct(..) |
hir::ItemKind::Static(..) |
hir::ItemKind::Const(..) |
hir::ItemKind::Fn(..) |
- hir::ItemKind::Ty(..) |
+ hir::ItemKind::TyAlias(..) |
hir::ItemKind::Enum(..) |
hir::ItemKind::Struct(..) |
hir::ItemKind::Union(..) |
hir::ItemKind::Static(..) |
hir::ItemKind::Const(..) |
hir::ItemKind::Fn(..) |
- hir::ItemKind::Ty(..) |
+ hir::ItemKind::TyAlias(..) |
hir::ItemKind::Enum(..) |
hir::ItemKind::Struct(..) |
hir::ItemKind::Union(..) |
hir::ItemKind::GlobalAsm(..) |
hir::ItemKind::ExternCrate(..) |
hir::ItemKind::Use(..) |
- hir::ItemKind::Ty(..) |
+ hir::ItemKind::TyAlias(..) |
hir::ItemKind::OpaqueTy(..) |
hir::ItemKind::TraitAlias(..) => {
// no sub-item recording needed in these cases
hir::ItemKind::ExternCrate(..) |
hir::ItemKind::Use(..) |
hir::ItemKind::ForeignMod(..) |
- hir::ItemKind::Ty(..) |
+ hir::ItemKind::TyAlias(..) |
hir::ItemKind::Trait(..) |
hir::ItemKind::TraitAlias(..) |
hir::ItemKind::OpaqueTy(..) |
fn visit_item(&mut self, item: &'tcx hir::Item) {
let item_def_id = self.tcx.hir().local_def_id(item.hir_id);
- if let ItemKind::Ty(..) = item.node {
+ if let ItemKind::TyAlias(..) = item.node {
for attr in self.tcx.get_attrs(item_def_id).iter() {
if attr.check_name(sym::rustc_layout) {
self.dump_layout_of(item_def_id, item, attr);
hir::ItemKind::Static(..) | hir::ItemKind::Struct(..) |
hir::ItemKind::Trait(..) | hir::ItemKind::TraitAlias(..) |
hir::ItemKind::OpaqueTy(..) |
- hir::ItemKind::Ty(..) | hir::ItemKind::Union(..) | hir::ItemKind::Use(..) => {
+ hir::ItemKind::TyAlias(..) | hir::ItemKind::Union(..) | hir::ItemKind::Use(..) => {
if item.vis.node.is_pub() { self.prev_level } else { None }
}
};
hir::ItemKind::Static(..) |
hir::ItemKind::Const(..) |
hir::ItemKind::GlobalAsm(..) |
- hir::ItemKind::Ty(..) |
+ hir::ItemKind::TyAlias(..) |
hir::ItemKind::Mod(..) |
hir::ItemKind::TraitAlias(..) |
hir::ItemKind::Fn(..) |
}
// Visit everything.
hir::ItemKind::Const(..) | hir::ItemKind::Static(..) |
- hir::ItemKind::Fn(..) | hir::ItemKind::Ty(..) => {
+ hir::ItemKind::Fn(..) | hir::ItemKind::TyAlias(..) => {
if item_level.is_some() {
self.reach(item.hir_id, item_level).generics().predicates().ty();
}
// `type ... = ...;` can contain private types, because
// we're introducing a new name.
- hir::ItemKind::Ty(..) => return,
+ hir::ItemKind::TyAlias(..) => return,
// Not at all public, so we don't care.
_ if !self.item_is_public(&item.hir_id, &item.vis) => {
hir::ItemKind::GlobalAsm(..) => {}
// Subitems of these items have inherited publicity.
hir::ItemKind::Const(..) | hir::ItemKind::Static(..) |
- hir::ItemKind::Fn(..) | hir::ItemKind::Ty(..) => {
+ hir::ItemKind::Fn(..) | hir::ItemKind::TyAlias(..) => {
self.check(item.hir_id, item_visibility).generics().predicates().ty();
}
hir::ItemKind::OpaqueTy(..) => {
}
// These items live in the type namespace.
- ItemKind::Ty(..) => {
+ ItemKind::TyAlias(..) => {
let res = Res::Def(DefKind::TyAlias, self.definitions.local_def_id(item.id));
self.define(parent, ident, TypeNS, (res, vis, sp, expansion));
}
debug!("(resolving item) resolving {} ({:?})", name, item.node);
match item.node {
- ItemKind::Ty(_, ref generics) |
+ ItemKind::TyAlias(_, ref generics) |
ItemKind::OpaqueTy(_, ref generics) |
ItemKind::Fn(_, _, ref generics, _) => {
self.with_generic_param_rib(
self.process_mod(item);
visit::walk_mod(self, m);
}
- Ty(ref ty, ref ty_params) => {
+ TyAlias(ref ty, ref ty_params) => {
let qualname = format!("::{}",
self.tcx.def_path_str(self.tcx.hir().local_def_id_from_node_id(item.id)));
let value = ty_to_string(&ty);
refs: vec![],
})
}
- ast::ItemKind::Ty(ref ty, ref generics) => {
+ ast::ItemKind::TyAlias(ref ty, ref generics) => {
let text = "type ".to_owned();
let mut sig = name_and_generics(text, offset, generics, self.id, self.ident, scx)?;
let substs = InternalSubsts::identity_for_item(tcx, def_id);
check_opaque(tcx, def_id, substs, it.span, &origin);
}
- hir::ItemKind::Ty(..) => {
+ hir::ItemKind::TyAlias(..) => {
let def_id = tcx.hir().local_def_id(it.hir_id);
let pty_ty = tcx.type_of(def_id);
let generics = tcx.generics_of(def_id);
match item.node {
ItemKind::Fn(.., ref generics, _)
| ItemKind::Impl(_, _, _, ref generics, ..)
- | ItemKind::Ty(_, ref generics)
+ | ItemKind::TyAlias(_, ref generics)
| ItemKind::OpaqueTy(OpaqueTy {
ref generics,
impl_trait_fn: None,
}) => {}
hir::ItemKind::OpaqueTy(..)
- | hir::ItemKind::Ty(..)
+ | hir::ItemKind::TyAlias(..)
| hir::ItemKind::Static(..)
| hir::ItemKind::Const(..)
| hir::ItemKind::Fn(..) => {
generics
}
- ItemKind::Ty(_, ref generics)
+ ItemKind::TyAlias(_, ref generics)
| ItemKind::Enum(_, ref generics)
| ItemKind::Struct(_, ref generics)
| ItemKind::OpaqueTy(hir::OpaqueTy { ref generics, .. })
icx.to_ty(ty)
}
},
- ItemKind::Ty(ref ty, _)
+ ItemKind::TyAlias(ref ty, _)
| ItemKind::Impl(.., ref ty, _) => icx.to_ty(ty),
ItemKind::Fn(..) => {
let substs = InternalSubsts::identity_for_item(tcx, def_id);
generics
}
ItemKind::Fn(.., ref generics, _)
- | ItemKind::Ty(_, ref generics)
+ | ItemKind::TyAlias(_, ref generics)
| ItemKind::Enum(_, ref generics)
| ItemKind::Struct(_, ref generics)
| ItemKind::Union(_, ref generics) => generics,
}
};
- if let Some(&hir::ItemKind::Ty(ref ty, ref generics)) = alias {
+ if let Some(&hir::ItemKind::TyAlias(ref ty, ref generics)) = alias {
let provided_params = &path.segments.last().expect("segments were empty");
let mut ty_substs = FxHashMap::default();
let mut lt_substs = FxHashMap::default();
om.unions.push(self.visit_union_data(item, ident.name, sd, gen)),
hir::ItemKind::Fn(ref fd, header, ref gen, body) =>
self.visit_fn(om, item, ident.name, &**fd, header, gen, body),
- hir::ItemKind::Ty(ref ty, ref gen) => {
+ hir::ItemKind::TyAlias(ref ty, ref gen) => {
let t = Typedef {
ty,
gen,
/// A type alias (`type` or `pub type`).
///
/// E.g., `type Foo = Bar<u8>;`.
- Ty(P<Ty>, Generics),
+ TyAlias(P<Ty>, Generics),
/// An opaque `impl Trait` type alias.
///
/// E.g., `type Foo = impl Bar + Boo;`.
ItemKind::Mod(..) => "module",
ItemKind::ForeignMod(..) => "foreign module",
ItemKind::GlobalAsm(..) => "global asm",
- ItemKind::Ty(..) => "type alias",
+ ItemKind::TyAlias(..) => "type alias",
ItemKind::OpaqueTy(..) => "opaque type",
ItemKind::Enum(..) => "enum",
ItemKind::Struct(..) => "struct",
pub fn item_ty_poly(&self, span: Span, name: Ident, ty: P<ast::Ty>,
generics: Generics) -> P<ast::Item> {
- self.item(span, name, Vec::new(), ast::ItemKind::Ty(ty, generics))
+ self.item(span, name, Vec::new(), ast::ItemKind::TyAlias(ty, generics))
}
pub fn item_ty(&self, span: Span, name: Ident, ty: P<ast::Ty>) -> P<ast::Item> {
ItemKind::Mod(m) => vis.visit_mod(m),
ItemKind::ForeignMod(nm) => vis.visit_foreign_mod(nm),
ItemKind::GlobalAsm(_ga) => {}
- ItemKind::Ty(ty, generics) => {
+ ItemKind::TyAlias(ty, generics) => {
vis.visit_ty(ty);
vis.visit_generics(generics);
}
let (ident, alias, generics) = type_?;
// TYPE ITEM
let item_ = match alias {
- AliasKind::Weak(ty) => ItemKind::Ty(ty, generics),
+ AliasKind::Weak(ty) => ItemKind::TyAlias(ty, generics),
AliasKind::OpaqueTy(bounds) => ItemKind::OpaqueTy(bounds, generics),
};
let prev_span = self.prev_span;
self.s.word(ga.asm.as_str().to_string());
self.end();
}
- ast::ItemKind::Ty(ref ty, ref generics) => {
+ ast::ItemKind::TyAlias(ref ty, ref generics) => {
self.head(visibility_qualified(&item.vis, "type"));
self.print_ident(item.ident);
self.print_generic_params(&generics.params);
walk_list!(visitor, visit_foreign_item, &foreign_module.items);
}
ItemKind::GlobalAsm(ref ga) => visitor.visit_global_asm(ga),
- ItemKind::Ty(ref typ, ref generics) => {
+ ItemKind::TyAlias(ref typ, ref generics) => {
visitor.visit_ty(typ);
visitor.visit_generics(generics)
}