Skip to content
Permalink
Browse files

Rename `ImplItem.node` to `ImplItem.kind`

  • Loading branch information...
varkor committed Sep 26, 2019
1 parent 8bd0382 commit ce6aabbaa19378ac621c2971934383a146176fec
Showing with 107 additions and 108 deletions.
  1. +2 −2 src/librustc/hir/intravisit.rs
  2. +3 −3 src/librustc/hir/lowering/item.rs
  3. +5 −2 src/librustc/hir/map/blocks.rs
  4. +1 −1 src/librustc/hir/map/def_collector.rs
  5. +8 −8 src/librustc/hir/map/mod.rs
  6. +1 −1 src/librustc/hir/mod.rs
  7. +1 −1 src/librustc/hir/print.rs
  8. +2 −2 src/librustc/ich/impls_hir.rs
  9. +1 −1 src/librustc/infer/error_reporting/mod.rs
  10. +1 −1 src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs
  11. +1 −1 src/librustc/infer/opaque_types/mod.rs
  12. +1 −1 src/librustc/middle/dead.rs
  13. +3 −3 src/librustc/middle/reachable.rs
  14. +4 −4 src/librustc/middle/resolve_lifetime.rs
  15. +1 −1 src/librustc/traits/error_reporting.rs
  16. +1 −1 src/librustc_codegen_ssa/back/symbol_export.rs
  17. +1 −1 src/librustc_incremental/persist/dirty_clean.rs
  18. +1 −1 src/librustc_interface/util.rs
  19. +1 −1 src/librustc_lint/builtin.rs
  20. +1 −1 src/librustc_lint/nonstandard_style.rs
  21. +16 −17 src/librustc_metadata/encoder.rs
  22. +1 −1 src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs
  23. +2 −2 src/librustc_mir/build/mod.rs
  24. +1 −1 src/librustc_mir/monomorphize/collector.rs
  25. +3 −6 src/librustc_passes/ast_validation.rs
  26. +3 −3 src/librustc_privacy/lib.rs
  27. +1 −1 src/librustc_resolve/build_reduced_graph.rs
  28. +1 −1 src/librustc_resolve/late.rs
  29. +1 −1 src/librustc_save_analysis/dump_visitor.rs
  30. +1 −1 src/librustc_traits/lowering/environment.rs
  31. +4 −4 src/librustc_typeck/check/compare_method.rs
  32. +7 −7 src/librustc_typeck/check/mod.rs
  33. +1 −1 src/librustc_typeck/check/wfcheck.rs
  34. +5 −5 src/librustc_typeck/collect.rs
  35. +1 −1 src/librustc_typeck/impl_wf_check.rs
  36. +1 −1 src/librustc_typeck/variance/constraints.rs
  37. +1 −1 src/librustc_typeck/variance/mod.rs
  38. +1 −1 src/librustc_typeck/variance/terms.rs
  39. +1 −1 src/librustdoc/clean/mod.rs
  40. +1 −1 src/libsyntax/ast.rs
  41. +1 −1 src/libsyntax/ext/expand.rs
  42. +2 −2 src/libsyntax/ext/placeholders.rs
  43. +1 −1 src/libsyntax/feature_gate/check.rs
  44. +2 −2 src/libsyntax/mut_visit.rs
  45. +4 −4 src/libsyntax/parse/parser/item.rs
  46. +1 −1 src/libsyntax/print/pprust.rs
  47. +1 −1 src/libsyntax/visit.rs
  48. +2 −2 src/libsyntax_ext/deriving/generic/mod.rs
@@ -905,7 +905,7 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
ref defaultness,
ref attrs,
ref generics,
ref node,
ref kind,
span: _,
} = *impl_item;

@@ -914,7 +914,7 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
visitor.visit_defaultness(defaultness);
walk_list!(visitor, visit_attribute, attrs);
visitor.visit_generics(generics);
match *node {
match *kind {
ImplItemKind::Const(ref ty, body) => {
visitor.visit_id(impl_item.hir_id);
visitor.visit_ty(ty);
@@ -902,7 +902,7 @@ impl LoweringContext<'_> {
fn lower_impl_item(&mut self, i: &ImplItem) -> hir::ImplItem {
let impl_item_def_id = self.resolver.definitions().local_def_id(i.id);

let (generics, node) = match i.node {
let (generics, kind) = match i.kind {
ImplItemKind::Const(ref ty, ref expr) => (
self.lower_generics(&i.generics, ImplTraitContext::disallowed()),
hir::ImplItemKind::Const(
@@ -946,7 +946,7 @@ impl LoweringContext<'_> {
generics,
vis: self.lower_visibility(&i.vis, None),
defaultness: self.lower_defaultness(i.defaultness, true /* [1] */),
node,
kind,
span: i.span,
}

@@ -960,7 +960,7 @@ impl LoweringContext<'_> {
span: i.span,
vis: self.lower_visibility(&i.vis, Some(i.id)),
defaultness: self.lower_defaultness(i.defaultness, true /* [1] */),
kind: match i.node {
kind: match i.kind {
ImplItemKind::Const(..) => hir::AssocItemKind::Const,
ImplItemKind::TyAlias(..) => hir::AssocItemKind::Type,
ImplItemKind::OpaqueTy(..) => hir::AssocItemKind::OpaqueTy,
@@ -43,7 +43,10 @@ impl MaybeFnLike for ast::Item {

impl MaybeFnLike for ast::ImplItem {
fn is_fn_like(&self) -> bool {
match self.node { ast::ImplItemKind::Method(..) => true, _ => false, }
match self.kind {
ast::ImplItemKind::Method(..) => true,
_ => false,
}
}
}

@@ -234,7 +237,7 @@ impl<'a> FnLikeNode<'a> {
_ => bug!("trait method FnLikeNode that is not fn-like"),
},
map::Node::ImplItem(ii) => {
match ii.node {
match ii.kind {
ast::ImplItemKind::Method(ref sig, body) => {
method(ii.hir_id, ii.ident, sig, Some(&ii.vis), body, ii.span, &ii.attrs)
}
@@ -228,7 +228,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
}

fn visit_impl_item(&mut self, ii: &'a ImplItem) {
let def_data = match ii.node {
let def_data = match ii.kind {
ImplItemKind::Method(MethodSig {
ref header,
ref decl,
@@ -64,7 +64,7 @@ impl<'hir> Entry<'hir> {
}

Node::ImplItem(ref item) => {
match item.node {
match item.kind {
ImplItemKind::Method(ref method_sig, _) => Some(&method_sig.decl),
_ => None,
}
@@ -101,7 +101,7 @@ impl<'hir> Entry<'hir> {
}

Node::ImplItem(item) => {
match item.node {
match item.kind {
ImplItemKind::Const(_, body) |
ImplItemKind::Method(_, body) => Some(body),
_ => None,
@@ -327,7 +327,7 @@ impl<'hir> Map<'hir> {
}
}
Node::ImplItem(item) => {
match item.node {
match item.kind {
ImplItemKind::Const(..) => DefKind::AssocConst,
ImplItemKind::Method(..) => DefKind::Method,
ImplItemKind::TyAlias(..) => DefKind::AssocTy,
@@ -455,14 +455,14 @@ impl<'hir> Map<'hir> {
match self.get(id) {
Node::Item(&Item { node: ItemKind::Const(..), .. }) |
Node::TraitItem(&TraitItem { node: TraitItemKind::Const(..), .. }) |
Node::ImplItem(&ImplItem { node: ImplItemKind::Const(..), .. }) |
Node::ImplItem(&ImplItem { kind: ImplItemKind::Const(..), .. }) |
Node::AnonConst(_) => {
BodyOwnerKind::Const
}
Node::Ctor(..) |
Node::Item(&Item { node: ItemKind::Fn(..), .. }) |
Node::TraitItem(&TraitItem { node: TraitItemKind::Method(..), .. }) |
Node::ImplItem(&ImplItem { node: ImplItemKind::Method(..), .. }) => {
Node::ImplItem(&ImplItem { kind: ImplItemKind::Method(..), .. }) => {
BodyOwnerKind::Fn
}
Node::Item(&Item { node: ItemKind::Static(_, m, _), .. }) => {
@@ -657,7 +657,7 @@ impl<'hir> Map<'hir> {
..
})
| Node::ImplItem(&ImplItem {
node: ImplItemKind::Const(..),
kind: ImplItemKind::Const(..),
..
})
| Node::AnonConst(_)
@@ -832,7 +832,7 @@ impl<'hir> Map<'hir> {
}
},
Node::ImplItem(ii) => {
match ii.node {
match ii.kind {
ImplItemKind::Method(..) => true,
_ => false,
}
@@ -1310,7 +1310,7 @@ fn hir_id_to_string(map: &Map<'_>, id: HirId, include_id: bool) -> String {
format!("foreign item {}{}", path_str(), id_str)
}
Some(Node::ImplItem(ii)) => {
match ii.node {
match ii.kind {
ImplItemKind::Const(..) => {
format!("assoc const {} in {}{}", ii.ident, path_str(), id_str)
}
@@ -1873,7 +1873,7 @@ pub struct ImplItem {
pub defaultness: Defaultness,
pub attrs: HirVec<Attribute>,
pub generics: Generics,
pub node: ImplItemKind,
pub kind: ImplItemKind,
pub span: Span,
}

@@ -896,7 +896,7 @@ impl<'a> State<'a> {
self.print_outer_attributes(&ii.attrs);
self.print_defaultness(ii.defaultness);

match ii.node {
match ii.kind {
hir::ImplItemKind::Const(ref ty, expr) => {
self.print_associated_const(ii.ident, &ty, Some(expr), &ii.vis);
}
@@ -226,7 +226,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::ImplItem {
defaultness,
ref attrs,
ref generics,
ref node,
ref kind,
span
} = *self;

@@ -236,7 +236,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::ImplItem {
defaultness.hash_stable(hcx, hasher);
attrs.hash_stable(hcx, hasher);
generics.hash_stable(hcx, hasher);
node.hash_stable(hcx, hasher);
kind.hash_stable(hcx, hasher);
span.hash_stable(hcx, hasher);
});
}
@@ -267,7 +267,7 @@ impl<'tcx> TyCtxt<'tcx> {
}

fn impl_item_scope_tag(item: &hir::ImplItem) -> &'static str {
match item.node {
match item.kind {
hir::ImplItemKind::Method(..) => "method body",
hir::ImplItemKind::Const(..)
| hir::ImplItemKind::OpaqueTy(..)
@@ -39,7 +39,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
..
})
| Node::ImplItem(&hir::ImplItem {
node: hir::ImplItemKind::Method(ref m, ..),
kind: hir::ImplItemKind::Method(ref m, ..),
..
}) => &m.decl,
_ => return None,
@@ -1060,7 +1060,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
(def_scope_default(), hir::OpaqueTyOrigin::TypeAlias)
}
},
Some(Node::ImplItem(item)) => match item.node {
Some(Node::ImplItem(item)) => match item.kind {
hir::ImplItemKind::OpaqueTy(_) => (
may_define_opaque_type(
tcx,
@@ -626,7 +626,7 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> {
}

fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) {
match impl_item.node {
match impl_item.kind {
hir::ImplItemKind::Const(_, body_id) => {
if !self.symbol_is_live(impl_item.hir_id) {
self.warn_dead_code(impl_item.hir_id,
@@ -55,7 +55,7 @@ fn method_might_be_inlined(
if codegen_fn_attrs.requests_inline() || generics.requires_monomorphization(tcx) {
return true
}
if let hir::ImplItemKind::Method(method_sig, _) = &impl_item.node {
if let hir::ImplItemKind::Method(method_sig, _) = &impl_item.kind {
if method_sig.header.is_const() {
return true
}
@@ -172,7 +172,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
}
}
Some(Node::ImplItem(impl_item)) => {
match impl_item.node {
match impl_item.kind {
hir::ImplItemKind::Const(..) => true,
hir::ImplItemKind::Method(..) => {
let attrs = self.tcx.codegen_fn_attrs(def_id);
@@ -299,7 +299,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
}
}
Node::ImplItem(impl_item) => {
match impl_item.node {
match impl_item.kind {
hir::ImplItemKind::Const(_, body) => {
self.visit_nested_body(body);
}
@@ -830,7 +830,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {

fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) {
use self::hir::ImplItemKind::*;
match impl_item.node {
match impl_item.kind {
Method(ref sig, _) => {
let tcx = self.tcx;
self.visit_early_late(
@@ -1530,7 +1530,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
}
},
Node::ImplItem(impl_item) => {
if let hir::ImplItemKind::Method(sig, _) = &impl_item.node {
if let hir::ImplItemKind::Method(sig, _) = &impl_item.kind {
find_arg_use_span(&sig.decl.inputs);
}
}
@@ -1875,7 +1875,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
..
})
| Node::ImplItem(&hir::ImplItem {
node: hir::ImplItemKind::Method(..),
kind: hir::ImplItemKind::Method(..),
..
}) => {
let scope = self.tcx.hir().local_def_id(fn_id);
@@ -2190,7 +2190,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
}

Node::ImplItem(&hir::ImplItem {
node: hir::ImplItemKind::Method(_, body),
kind: hir::ImplItemKind::Method(_, body),
..
}) => {
if let hir::ItemKind::Impl(.., ref self_ty, ref impl_items) = self.tcx
@@ -1168,7 +1168,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
}) |
Node::ImplItem(&hir::ImplItem {
span,
node: hir::ImplItemKind::Method(hir::MethodSig { ref decl, .. }, _),
kind: hir::ImplItemKind::Method(hir::MethodSig { ref decl, .. }, _),
..
}) |
Node::TraitItem(&hir::TraitItem {
@@ -101,7 +101,7 @@ fn reachable_non_generics_provider(
node: hir::ItemKind::Fn(..), ..
}) |
Node::ImplItem(&hir::ImplItem {
node: hir::ImplItemKind::Method(..),
kind: hir::ImplItemKind::Method(..),
..
}) => {
let def_id = tcx.hir().local_def_id(hir_id);
@@ -404,7 +404,7 @@ impl DirtyCleanVisitor<'tcx> {
}
},
HirNode::ImplItem(item) => {
match item.node {
match item.kind {
ImplItemKind::Method(..) => ("Node::ImplItem", LABELS_FN_IN_IMPL),
ImplItemKind::Const(..) => ("NodeImplConst", LABELS_CONST_IN_IMPL),
ImplItemKind::TyAlias(..) => ("NodeImplType", LABELS_CONST_IN_IMPL),
@@ -806,7 +806,7 @@ impl<'a> MutVisitor for ReplaceBodyWithLoop<'a> {
}

fn flat_map_impl_item(&mut self, i: ast::ImplItem) -> SmallVec<[ast::ImplItem; 1]> {
let is_const = match i.node {
let is_const = match i.kind {
ast::ImplItemKind::Const(..) => true,
ast::ImplItemKind::Method(ast::MethodSig { ref decl, ref header, .. }, _) =>
header.constness.node == ast::Constness::Const || Self::should_ignore_fn(decl),
@@ -459,7 +459,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
return;
}

let desc = match impl_item.node {
let desc = match impl_item.kind {
hir::ImplItemKind::Const(..) => "an associated constant",
hir::ImplItemKind::Method(..) => "a method",
hir::ImplItemKind::TyAlias(_) => "an associated type",
@@ -405,7 +405,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonUpperCaseGlobals {
}

fn check_impl_item(&mut self, cx: &LateContext<'_, '_>, ii: &hir::ImplItem) {
if let hir::ImplItemKind::Const(..) = ii.node {
if let hir::ImplItemKind::Const(..) = ii.kind {
NonUpperCaseGlobals::check_upper_case(cx, "associated constant", &ii.ident);
}
}
@@ -970,7 +970,7 @@ impl EncodeContext<'tcx> {

let kind = match impl_item.kind {
ty::AssocKind::Const => {
if let hir::ImplItemKind::Const(_, body_id) = ast_item.node {
if let hir::ImplItemKind::Const(_, body_id) = ast_item.kind {
let mir = self.tcx.at(ast_item.span).mir_const_qualif(def_id).0;

EntryKind::AssocConst(container,
@@ -981,7 +981,7 @@ impl EncodeContext<'tcx> {
}
}
ty::AssocKind::Method => {
let fn_data = if let hir::ImplItemKind::Method(ref sig, body) = ast_item.node {
let fn_data = if let hir::ImplItemKind::Method(ref sig, body) = ast_item.kind {
FnData {
asyncness: sig.header.asyncness,
constness: sig.header.constness,
@@ -1001,21 +1001,20 @@ impl EncodeContext<'tcx> {
ty::AssocKind::Type => EntryKind::AssocType(container)
};

let mir =
match ast_item.node {
hir::ImplItemKind::Const(..) => true,
hir::ImplItemKind::Method(ref sig, _) => {
let generics = self.tcx.generics_of(def_id);
let needs_inline = (generics.requires_monomorphization(self.tcx) ||
tcx.codegen_fn_attrs(def_id).requests_inline()) &&
!self.metadata_output_only();
let is_const_fn = sig.header.constness == hir::Constness::Const;
let always_encode_mir = self.tcx.sess.opts.debugging_opts.always_encode_mir;
needs_inline || is_const_fn || always_encode_mir
},
hir::ImplItemKind::OpaqueTy(..) |
hir::ImplItemKind::TyAlias(..) => false,
};
let mir = match ast_item.kind {
hir::ImplItemKind::Const(..) => true,
hir::ImplItemKind::Method(ref sig, _) => {
let generics = self.tcx.generics_of(def_id);
let needs_inline = (generics.requires_monomorphization(self.tcx) ||
tcx.codegen_fn_attrs(def_id).requests_inline()) &&
!self.metadata_output_only();
let is_const_fn = sig.header.constness == hir::Constness::Const;
let always_encode_mir = self.tcx.sess.opts.debugging_opts.always_encode_mir;
needs_inline || is_const_fn || always_encode_mir
},
hir::ImplItemKind::OpaqueTy(..) |
hir::ImplItemKind::TyAlias(..) => false,
};

Entry {
kind,
@@ -772,7 +772,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
},
),
hir::Node::ImplItem(hir::ImplItem {
node: hir::ImplItemKind::Method(method_sig, _),
kind: hir::ImplItemKind::Method(method_sig, _),
..
}) => (method_sig.decl.output.span(), ""),
_ => (body.span, ""),

0 comments on commit ce6aabb

Please sign in to comment.
You can’t perform that action at this time.