Skip to content

Commit b474867

Browse files
committed
Rename ForeignItem.node to ForeignItem.kind
1 parent 7bc94cc commit b474867

File tree

35 files changed

+52
-52
lines changed

35 files changed

+52
-52
lines changed

src/librustc/hir/intravisit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ pub fn walk_foreign_item<'v, V: Visitor<'v>>(visitor: &mut V, foreign_item: &'v
743743
visitor.visit_vis(&foreign_item.vis);
744744
visitor.visit_ident(foreign_item.ident);
745745

746-
match foreign_item.node {
746+
match foreign_item.kind {
747747
ForeignItemKind::Fn(ref function_declaration, ref param_names, ref generics) => {
748748
visitor.visit_generics(generics);
749749
visitor.visit_fn_decl(function_declaration);

src/librustc/hir/lowering/item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ impl LoweringContext<'_> {
711711
hir_id: self.lower_node_id(i.id),
712712
ident: i.ident,
713713
attrs: self.lower_attrs(&i.attrs),
714-
node: match i.node {
714+
kind: match i.kind {
715715
ForeignItemKind::Fn(ref fdec, ref generics) => {
716716
let (generics, (fn_dec, fn_args)) = self.add_in_band_defs(
717717
generics,

src/librustc/hir/map/def_collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
157157
}
158158

159159
fn visit_foreign_item(&mut self, foreign_item: &'a ForeignItem) {
160-
if let ForeignItemKind::Macro(_) = foreign_item.node {
160+
if let ForeignItemKind::Macro(_) = foreign_item.kind {
161161
return self.visit_macro_invoc(foreign_item.id);
162162
}
163163

src/librustc/hir/map/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ impl<'hir> Map<'hir> {
313313
}
314314
}
315315
Node::ForeignItem(item) => {
316-
match item.node {
316+
match item.kind {
317317
ForeignItemKind::Fn(..) => DefKind::Fn,
318318
ForeignItemKind::Static(..) => DefKind::Static,
319319
ForeignItemKind::Type => DefKind::ForeignTy,
@@ -820,7 +820,7 @@ impl<'hir> Map<'hir> {
820820
}
821821
},
822822
Node::ForeignItem(fi) => {
823-
match fi.node {
823+
match fi.kind {
824824
ForeignItemKind::Fn(..) => true,
825825
_ => false,
826826
}

src/librustc/hir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2581,7 +2581,7 @@ pub struct ForeignItem {
25812581
#[stable_hasher(project(name))]
25822582
pub ident: Ident,
25832583
pub attrs: HirVec<Attribute>,
2584-
pub node: ForeignItemKind,
2584+
pub kind: ForeignItemKind,
25852585
pub hir_id: HirId,
25862586
pub span: Span,
25872587
pub vis: Visibility,

src/librustc/hir/print.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ impl<'a> State<'a> {
372372
self.hardbreak_if_not_bol();
373373
self.maybe_print_comment(item.span.lo());
374374
self.print_outer_attributes(&item.attrs);
375-
match item.node {
375+
match item.kind {
376376
hir::ForeignItemKind::Fn(ref decl, ref arg_names, ref generics) => {
377377
self.head("");
378378
self.print_fn(decl,

src/librustc/middle/dead.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> {
613613
fn visit_foreign_item(&mut self, fi: &'tcx hir::ForeignItem) {
614614
if self.should_warn_about_foreign_item(fi) {
615615
self.warn_dead_code(fi.hir_id, fi.span, fi.ident.name,
616-
fi.node.descriptive_variant(), "used");
616+
fi.kind.descriptive_variant(), "used");
617617
}
618618
intravisit::walk_foreign_item(self, fi);
619619
}

src/librustc/middle/resolve_lifetime.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
541541
}
542542

543543
fn visit_foreign_item(&mut self, item: &'tcx hir::ForeignItem) {
544-
match item.node {
544+
match item.kind {
545545
hir::ForeignItemKind::Fn(ref decl, _, ref generics) => {
546546
self.visit_early_late(None, decl, generics, |this| {
547547
intravisit::walk_foreign_item(this, item);

src/librustc/middle/stability.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> {
382382
}
383383

384384
fn visit_foreign_item(&mut self, i: &'tcx hir::ForeignItem) {
385-
self.check_missing_stability(i.hir_id, i.span, i.node.descriptive_variant());
385+
self.check_missing_stability(i.hir_id, i.span, i.kind.descriptive_variant());
386386
intravisit::walk_foreign_item(self, i);
387387
}
388388

src/librustc_codegen_llvm/consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ impl CodegenCx<'ll, 'tcx> {
249249
}
250250

251251
Node::ForeignItem(&hir::ForeignItem {
252-
ref attrs, span, node: hir::ForeignItemKind::Static(..), ..
252+
ref attrs, span, kind: hir::ForeignItemKind::Static(..), ..
253253
}) => {
254254
let fn_attrs = self.tcx.codegen_fn_attrs(def_id);
255255
(check_and_apply_linkage(&self, &fn_attrs, ty, sym, span), attrs)

src/librustc_lint/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImproperCTypes {
978978
if let Abi::Rust | Abi::RustCall | Abi::RustIntrinsic | Abi::PlatformIntrinsic = abi {
979979
// Don't worry about types in internal ABIs.
980980
} else {
981-
match it.node {
981+
match it.kind {
982982
hir::ForeignItemKind::Fn(ref decl, _, _) => {
983983
vis.check_foreign_fn(it.hir_id, decl);
984984
}

src/librustc_metadata/encoder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,7 @@ impl EncodeContext<'tcx> {
16771677

16781678
debug!("EncodeContext::encode_info_for_foreign_item({:?})", def_id);
16791679

1680-
let kind = match nitem.node {
1680+
let kind = match nitem.kind {
16811681
hir::ForeignItemKind::Fn(_, ref names, _) => {
16821682
let data = FnData {
16831683
asyncness: hir::IsAsync::NotAsync,
@@ -1703,7 +1703,7 @@ impl EncodeContext<'tcx> {
17031703

17041704
ty: Some(self.encode_item_type(def_id)),
17051705
inherent_impls: Lazy::empty(),
1706-
variances: match nitem.node {
1706+
variances: match nitem.kind {
17071707
hir::ForeignItemKind::Fn(..) => self.encode_variances_of(def_id),
17081708
_ => Lazy::empty(),
17091709
},

src/librustc_passes/ast_validation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
682682
}
683683

684684
fn visit_foreign_item(&mut self, fi: &'a ForeignItem) {
685-
match fi.node {
685+
match fi.kind {
686686
ForeignItemKind::Fn(ref decl, _) => {
687687
self.check_fn_decl(decl);
688688
self.check_decl_no_pat(decl, |span, _| {

src/librustc_resolve/build_reduced_graph.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
813813

814814
/// Constructs the reduced graph for one foreign item.
815815
fn build_reduced_graph_for_foreign_item(&mut self, item: &ForeignItem) {
816-
let (res, ns) = match item.node {
816+
let (res, ns) = match item.kind {
817817
ForeignItemKind::Fn(..) => {
818818
(Res::Def(DefKind::Fn, self.r.definitions.local_def_id(item.id)), ValueNS)
819819
}
@@ -1169,7 +1169,7 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
11691169
}
11701170

11711171
fn visit_foreign_item(&mut self, foreign_item: &'b ForeignItem) {
1172-
if let ForeignItemKind::Macro(_) = foreign_item.node {
1172+
if let ForeignItemKind::Macro(_) = foreign_item.kind {
11731173
self.visit_invoc(foreign_item.id);
11741174
return;
11751175
}

src/librustc_resolve/late.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LateResolutionVisitor<'a, '_> {
406406
visit::walk_poly_trait_ref(self, tref, m);
407407
}
408408
fn visit_foreign_item(&mut self, foreign_item: &'tcx ForeignItem) {
409-
let generic_params = match foreign_item.node {
409+
let generic_params = match foreign_item.kind {
410410
ForeignItemKind::Fn(_, ref generics) => {
411411
HasGenericParams(generics, ItemRibKind)
412412
}

src/librustc_save_analysis/dump_visitor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1570,7 +1570,7 @@ impl<'l, 'tcx> Visitor<'l> for DumpVisitor<'l, 'tcx> {
15701570
let hir_id = self.tcx.hir().node_to_hir_id(item.id);
15711571
let access = access_from!(self.save_ctxt, item, hir_id);
15721572

1573-
match item.node {
1573+
match item.kind {
15741574
ast::ForeignItemKind::Fn(ref decl, ref generics) => {
15751575
if let Some(fn_data) = self.save_ctxt.get_extern_item_data(item) {
15761576
down_cast_data!(fn_data, DefData, item.span);

src/librustc_save_analysis/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> {
130130
pub fn get_extern_item_data(&self, item: &ast::ForeignItem) -> Option<Data> {
131131
let qualname = format!("::{}",
132132
self.tcx.def_path_str(self.tcx.hir().local_def_id_from_node_id(item.id)));
133-
match item.node {
133+
match item.kind {
134134
ast::ForeignItemKind::Fn(ref decl, ref generics) => {
135135
filter!(self.span_utils, item.ident.span);
136136

src/librustc_save_analysis/sig.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ impl Sig for ast::Variant {
765765
impl Sig for ast::ForeignItem {
766766
fn make(&self, offset: usize, _parent_id: Option<NodeId>, scx: &SaveContext<'_, '_>) -> Result {
767767
let id = Some(self.id);
768-
match self.node {
768+
match self.kind {
769769
ast::ForeignItemKind::Fn(ref decl, ref generics) => {
770770
let mut text = String::new();
771771
text.push_str("fn ");

src/librustc_traits/lowering/environment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ crate fn environment(tcx: TyCtxt<'_>, def_id: DefId) -> Environment<'_> {
212212
_ => NodeKind::Other,
213213
}
214214

215-
Node::ForeignItem(item) => match item.node {
215+
Node::ForeignItem(item) => match item.kind {
216216
ForeignItemKind::Fn(..) => NodeKind::Fn,
217217
_ => NodeKind::Other,
218218
}

src/librustc_typeck/check/intrinsic.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn equate_intrinsic_type<'tcx>(
2424
) {
2525
let def_id = tcx.hir().local_def_id(it.hir_id);
2626

27-
match it.node {
27+
match it.kind {
2828
hir::ForeignItemKind::Fn(..) => {}
2929
_ => {
3030
struct_span_err!(tcx.sess, it.span, E0622,
@@ -37,7 +37,7 @@ fn equate_intrinsic_type<'tcx>(
3737

3838
let i_n_tps = tcx.generics_of(def_id).own_counts().types;
3939
if i_n_tps != n_tps {
40-
let span = match it.node {
40+
let span = match it.kind {
4141
hir::ForeignItemKind::Fn(_, _, ref generics) => generics.span,
4242
_ => bug!()
4343
};

src/librustc_typeck/check/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@ pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, it: &'tcx hir::Item) {
15881588
).emit();
15891589
}
15901590

1591-
if let hir::ForeignItemKind::Fn(ref fn_decl, _, _) = item.node {
1591+
if let hir::ForeignItemKind::Fn(ref fn_decl, _, _) = item.kind {
15921592
require_c_abi_if_c_variadic(tcx, fn_decl, m.abi, item.span);
15931593
}
15941594
}
@@ -4242,7 +4242,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
42424242
}
42434243
}
42444244
Some(Node::ForeignItem(hir::ForeignItem {
4245-
node: hir::ForeignItemKind::Fn(_, idents, _),
4245+
kind: hir::ForeignItemKind::Fn(_, idents, _),
42464246
..
42474247
})) |
42484248
Some(Node::TraitItem(hir::TraitItem {

src/librustc_typeck/check/wfcheck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ pub fn check_item_well_formed(tcx: TyCtxt<'_>, def_id: DefId) {
128128
check_item_type(tcx, item.hir_id, ty.span, false);
129129
}
130130
hir::ItemKind::ForeignMod(ref module) => for it in module.items.iter() {
131-
if let hir::ForeignItemKind::Static(ref ty, ..) = it.node {
131+
if let hir::ForeignItemKind::Static(ref ty, ..) = it.kind {
132132
check_item_type(tcx, it.hir_id, ty.span, true);
133133
}
134134
},

src/librustc_typeck/collect.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ fn type_param_predicates(
312312
}
313313
}
314314

315-
Node::ForeignItem(item) => match item.node {
315+
Node::ForeignItem(item) => match item.kind {
316316
ForeignItemKind::Fn(_, _, ref generics) => generics,
317317
_ => return result,
318318
},
@@ -415,7 +415,7 @@ fn convert_item(tcx: TyCtxt<'_>, item_id: hir::HirId) {
415415
tcx.generics_of(def_id);
416416
tcx.type_of(def_id);
417417
tcx.predicates_of(def_id);
418-
if let hir::ForeignItemKind::Fn(..) = item.node {
418+
if let hir::ForeignItemKind::Fn(..) = item.kind {
419419
tcx.fn_sig(def_id);
420420
}
421421
}
@@ -872,7 +872,7 @@ fn has_late_bound_regions<'tcx>(tcx: TyCtxt<'tcx>, node: Node<'tcx>) -> Option<S
872872
}
873873
_ => None,
874874
},
875-
Node::ForeignItem(item) => match item.node {
875+
Node::ForeignItem(item) => match item.kind {
876876
hir::ForeignItemKind::Fn(ref fn_decl, _, ref generics) => {
877877
has_late_bound_regions(tcx, generics, fn_decl)
878878
}
@@ -977,7 +977,7 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::Generics {
977977
}
978978
}
979979

980-
Node::ForeignItem(item) => match item.node {
980+
Node::ForeignItem(item) => match item.kind {
981981
ForeignItemKind::Static(..) => &no_generics,
982982
ForeignItemKind::Fn(_, _, ref generics) => generics,
983983
ForeignItemKind::Type => &no_generics,
@@ -1331,7 +1331,7 @@ pub fn checked_type_of(tcx: TyCtxt<'_>, def_id: DefId, fail: bool) -> Option<Ty<
13311331
}
13321332
}
13331333

1334-
Node::ForeignItem(foreign_item) => match foreign_item.node {
1334+
Node::ForeignItem(foreign_item) => match foreign_item.kind {
13351335
ForeignItemKind::Fn(..) => {
13361336
let substs = InternalSubsts::identity_for_item(tcx, def_id);
13371337
tcx.mk_fn_def(def_id, substs)
@@ -1823,7 +1823,7 @@ fn fn_sig(tcx: TyCtxt<'_>, def_id: DefId) -> ty::PolyFnSig<'_> {
18231823
},
18241824

18251825
ForeignItem(&hir::ForeignItem {
1826-
node: ForeignItemKind::Fn(ref fn_decl, _, _),
1826+
kind: ForeignItemKind::Fn(ref fn_decl, _, _),
18271827
..
18281828
}) => {
18291829
let abi = tcx.hir().get_foreign_abi(hir_id);
@@ -2133,7 +2133,7 @@ fn explicit_predicates_of(
21332133
}
21342134
}
21352135

2136-
Node::ForeignItem(item) => match item.node {
2136+
Node::ForeignItem(item) => match item.kind {
21372137
ForeignItemKind::Static(..) => NO_GENERICS,
21382138
ForeignItemKind::Fn(_, _, ref generics) => generics,
21392139
ForeignItemKind::Type => NO_GENERICS,
@@ -2420,7 +2420,7 @@ fn static_mutability(tcx: TyCtxt<'_>, def_id: DefId) -> Option<hir::Mutability>
24202420
kind: hir::ItemKind::Static(_, mutbl, _), ..
24212421
})) |
24222422
Some(Node::ForeignItem( &hir::ForeignItem {
2423-
node: hir::ForeignItemKind::Static(_, mutbl), ..
2423+
kind: hir::ForeignItemKind::Static(_, mutbl), ..
24242424
})) => Some(mutbl),
24252425
Some(_) => None,
24262426
_ => bug!("static_mutability applied to non-local def-id {:?}", def_id),

src/librustc_typeck/variance/constraints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for ConstraintContext<'a, 'tcx> {
9494

9595
hir::ItemKind::ForeignMod(ref foreign_mod) => {
9696
for foreign_item in &foreign_mod.items {
97-
if let hir::ForeignItemKind::Fn(..) = foreign_item.node {
97+
if let hir::ForeignItemKind::Fn(..) = foreign_item.kind {
9898
self.visit_node_helper(foreign_item.hir_id);
9999
}
100100
}

src/librustc_typeck/variance/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ fn variances_of(tcx: TyCtxt<'_>, item_def_id: DefId) -> &[ty::Variance] {
7070
_ => unsupported()
7171
},
7272

73-
Node::ForeignItem(item) => match item.node {
73+
Node::ForeignItem(item) => match item.kind {
7474
hir::ForeignItemKind::Fn(..) => {}
7575

7676
_ => unsupported()

src/librustc_typeck/variance/terms.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for TermsContext<'a, 'tcx> {
157157

158158
hir::ItemKind::ForeignMod(ref foreign_mod) => {
159159
for foreign_item in &foreign_mod.items {
160-
if let hir::ForeignItemKind::Fn(..) = foreign_item.node {
160+
if let hir::ForeignItemKind::Fn(..) = foreign_item.kind {
161161
self.add_inferreds_for_item(foreign_item.hir_id);
162162
}
163163
}

src/librustdoc/visit_ast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
561561
om.foreigns.push(ForeignItem {
562562
id: item.hir_id,
563563
name: renamed.unwrap_or(item.ident).name,
564-
kind: &item.node,
564+
kind: &item.kind,
565565
vis: &item.vis,
566566
attrs: &item.attrs,
567567
whence: item.span

src/libsyntax/ast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2421,7 +2421,7 @@ impl ItemKind {
24212421
pub struct ForeignItem {
24222422
pub ident: Ident,
24232423
pub attrs: Vec<Attribute>,
2424-
pub node: ForeignItemKind,
2424+
pub kind: ForeignItemKind,
24252425
pub id: NodeId,
24262426
pub span: Span,
24272427
pub vis: Visibility,

src/libsyntax/ext/expand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1378,7 +1378,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
13781378
.make_foreign_items();
13791379
}
13801380

1381-
if let ast::ForeignItemKind::Macro(mac) = foreign_item.node {
1381+
if let ast::ForeignItemKind::Macro(mac) = foreign_item.kind {
13821382
self.check_attributes(&foreign_item.attrs);
13831383
return self.collect_bang(mac, foreign_item.span, AstFragmentKind::ForeignItems)
13841384
.make_foreign_items();

src/libsyntax/ext/placeholders.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub fn placeholder(kind: AstFragmentKind, id: ast::NodeId) -> AstFragment {
6565
AstFragmentKind::ForeignItems =>
6666
AstFragment::ForeignItems(smallvec![ast::ForeignItem {
6767
id, span, ident, vis, attrs,
68-
node: ast::ForeignItemKind::Macro(mac_placeholder()),
68+
kind: ast::ForeignItemKind::Macro(mac_placeholder()),
6969
}]),
7070
AstFragmentKind::Pat => AstFragment::Pat(P(ast::Pat {
7171
id, span, kind: ast::PatKind::Mac(mac_placeholder()),
@@ -275,7 +275,7 @@ impl<'a, 'b> MutVisitor for PlaceholderExpander<'a, 'b> {
275275
}
276276

277277
fn flat_map_foreign_item(&mut self, item: ast::ForeignItem) -> SmallVec<[ast::ForeignItem; 1]> {
278-
match item.node {
278+
match item.kind {
279279
ast::ForeignItemKind::Macro(_) => self.remove(item.id).make_foreign_items(),
280280
_ => noop_flat_map_foreign_item(item, self),
281281
}

src/libsyntax/feature_gate/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
408408
}
409409

410410
fn visit_foreign_item(&mut self, i: &'a ast::ForeignItem) {
411-
match i.node {
411+
match i.kind {
412412
ast::ForeignItemKind::Fn(..) |
413413
ast::ForeignItemKind::Static(..) => {
414414
let link_name = attr::first_attr_value_str_by_name(&i.attrs, sym::link_name);

0 commit comments

Comments
 (0)