Node::ImplItem(item) => &item.generics,
Node::Item(item) => {
- match item.node {
+ match item.kind {
ItemKind::Fn(.., ref generics, _)
| ItemKind::Impl(_, _, _, ref generics, ..)
| ItemKind::TyAlias(_, ref generics)
/// `ast_ty_to_ty`, because we want to avoid triggering an all-out
/// conversion of the type to avoid inducing unnecessary cycles.
fn is_param(tcx: TyCtxt<'_>, ast_ty: &hir::Ty, param_id: hir::HirId) -> bool {
- if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.node {
+ if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.kind {
match path.res {
Res::SelfTy(Some(def_id), None) | Res::Def(DefKind::TyParam, def_id) => {
def_id == tcx.hir().local_def_id(param_id)
let it = tcx.hir().expect_item(item_id);
debug!("convert: item {} with id {}", it.ident, it.hir_id);
let def_id = tcx.hir().local_def_id(item_id);
- match it.node {
+ match it.kind {
// These don't define types.
hir::ItemKind::ExternCrate(_)
| hir::ItemKind::Use(..)
tcx.generics_of(def_id);
tcx.type_of(def_id);
tcx.predicates_of(def_id);
- if let hir::ItemKind::Fn(..) = it.node {
+ if let hir::ItemKind::Fn(..) = it.kind {
tcx.fn_sig(def_id);
}
}
};
let repr = ReprOptions::new(tcx, def_id);
- let (kind, variants) = match item.node {
+ let (kind, variants) = match item.kind {
ItemKind::Enum(ref def, _) => {
let mut distance_from_explicit = 0;
let variants = def.variants
_ => bug!("trait_node_id {} is not an item", trait_hir_id),
};
- let (generics, bounds) = match item.node {
+ let (generics, bounds) = match item.kind {
hir::ItemKind::Trait(.., ref generics, ref supertraits, _) => (generics, supertraits),
hir::ItemKind::TraitAlias(ref generics, ref supertraits) => (generics, supertraits),
_ => span_bug!(item.span, "super_predicates invoked on non-trait"),
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
let item = tcx.hir().expect_item(hir_id);
- let (is_auto, unsafety) = match item.node {
+ let (is_auto, unsafety) = match item.kind {
hir::ItemKind::Trait(is_auto, unsafety, ..) => (is_auto == hir::IsAuto::Yes, unsafety),
hir::ItemKind::TraitAlias(..) => (false, hir::Unsafety::Normal),
_ => span_bug!(item.span, "trait_def_of_item invoked on non-trait"),
if self.has_late_bound_regions.is_some() {
return;
}
- match ty.node {
+ match ty.kind {
hir::TyKind::BareFn(..) => {
self.outer_index.shift_in(1);
intravisit::walk_ty(self, ty);
}
_ => None,
},
- Node::Item(item) => match item.node {
+ Node::Item(item) => match item.kind {
hir::ItemKind::Fn(ref fn_decl, .., ref generics, _) => {
has_late_bound_regions(tcx, generics, fn_decl)
}
kind: hir::ExprKind::Closure(..),
..
}) => Some(tcx.closure_base_def_id(def_id)),
- Node::Item(item) => match item.node {
+ Node::Item(item) => match item.kind {
ItemKind::OpaqueTy(hir::OpaqueTy { impl_trait_fn, .. }) => impl_trait_fn,
_ => None,
},
Node::ImplItem(item) => &item.generics,
Node::Item(item) => {
- match item.node {
+ match item.kind {
ItemKind::Fn(.., ref generics, _) | ItemKind::Impl(_, _, _, ref generics, ..) => {
generics
}
}
TraitItemKind::Const(ref ty, body_id) => {
body_id.and_then(|body_id| {
- if let hir::TyKind::Infer = ty.node {
+ if let hir::TyKind::Infer = ty.kind {
Some(infer_placeholder_type(tcx, def_id, body_id, ty.span, item.ident))
} else {
None
tcx.mk_fn_def(def_id, substs)
}
ImplItemKind::Const(ref ty, body_id) => {
- if let hir::TyKind::Infer = ty.node {
+ if let hir::TyKind::Infer = ty.kind {
infer_placeholder_type(tcx, def_id, body_id, ty.span, item.ident)
} else {
icx.to_ty(ty)
},
Node::Item(item) => {
- match item.node {
+ match item.kind {
ItemKind::Static(ref ty, .., body_id)
| ItemKind::Const(ref ty, body_id) => {
- if let hir::TyKind::Infer = ty.node {
+ if let hir::TyKind::Infer = ty.kind {
infer_placeholder_type(tcx, def_id, body_id, ty.span, item.ident)
} else {
icx.to_ty(ty)
span_bug!(
item.span,
"compute_type_of_item: unexpected item type: {:?}",
- item.node
+ item.kind
);
}
}
let parent_node = tcx.hir().get(tcx.hir().get_parent_node(hir_id));
match parent_node {
Node::Ty(&hir::Ty {
- node: hir::TyKind::Array(_, ref constant),
+ kind: hir::TyKind::Array(_, ref constant),
..
})
| Node::Ty(&hir::Ty {
- node: hir::TyKind::Typeof(ref constant),
+ kind: hir::TyKind::Typeof(ref constant),
..
})
| Node::Expr(&hir::Expr {
.to_ty(tcx)
}
- Node::Ty(&hir::Ty { node: hir::TyKind::Path(_), .. }) |
+ Node::Ty(&hir::Ty { kind: hir::TyKind::Path(_), .. }) |
Node::Expr(&hir::Expr { kind: ExprKind::Struct(..), .. }) |
Node::Expr(&hir::Expr { kind: ExprKind::Path(_), .. }) |
Node::TraitRef(..) => {
let path = match parent_node {
Node::Ty(&hir::Ty {
- node: hir::TyKind::Path(QPath::Resolved(_, ref path)),
+ kind: hir::TyKind::Path(QPath::Resolved(_, ref path)),
..
})
| Node::Expr(&hir::Expr {
pub fn get_infer_ret_ty(output: &'_ hir::FunctionRetTy) -> Option<&hir::Ty> {
if let hir::FunctionRetTy::Return(ref ty) = output {
- if let hir::TyKind::Infer = ty.node {
+ if let hir::TyKind::Infer = ty.kind {
return Some(&**ty)
}
}
..
})
| Item(hir::Item {
- node: ItemKind::Fn(decl, header, _, _),
+ kind: ItemKind::Fn(decl, header, _, _),
..
}) => match get_infer_ret_ty(&decl.output) {
Some(ty) => {
let icx = ItemCtxt::new(tcx, def_id);
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
- match tcx.hir().expect_item(hir_id).node {
+ match tcx.hir().expect_item(hir_id).kind {
hir::ItemKind::Impl(.., ref opt_trait_ref, _, _) => {
opt_trait_ref.as_ref().map(|ast_trait_ref| {
let selfty = tcx.type_of(def_id);
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
let is_rustc_reservation = tcx.has_attr(def_id, sym::rustc_reservation_impl);
let item = tcx.hir().expect_item(hir_id);
- match &item.node {
+ match &item.kind {
hir::ItemKind::Impl(_, hir::ImplPolarity::Negative, ..) => {
if is_rustc_reservation {
tcx.sess.span_err(item.span, "reservation impls can't be negative");
},
Node::Item(item) => {
- match item.node {
+ match item.kind {
ItemKind::Impl(_, _, defaultness, ref generics, ..) => {
if defaultness.is_default() {
is_default_impl_trait = tcx.impl_trait_ref(def_id);
// in trait checking. See `setup_constraining_predicates`
// for details.
if let Node::Item(&Item {
- node: ItemKind::Impl(..),
+ kind: ItemKind::Impl(..),
..
}) = node
{
fn static_mutability(tcx: TyCtxt<'_>, def_id: DefId) -> Option<hir::Mutability> {
match tcx.hir().get_if_local(def_id) {
Some(Node::Item(&hir::Item {
- node: hir::ItemKind::Static(_, mutbl, _), ..
+ kind: hir::ItemKind::Static(_, mutbl, _), ..
})) |
Some(Node::ForeignItem( &hir::ForeignItem {
node: hir::ForeignItemKind::Static(_, mutbl), ..