Skip to content

Commit c3d8791

Browse files
committed
Rename Ty.node to Ty.kind
1 parent d4573c9 commit c3d8791

File tree

50 files changed

+138
-137
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+138
-137
lines changed

src/librustc/hir/intravisit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ pub fn walk_variant<'v, V: Visitor<'v>>(visitor: &mut V,
594594
pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) {
595595
visitor.visit_id(typ.hir_id);
596596

597-
match typ.node {
597+
match typ.kind {
598598
TyKind::Slice(ref ty) => {
599599
visitor.visit_ty(ty)
600600
}

src/librustc/hir/lowering.rs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ struct ImplTraitTypeIdVisitor<'a> { ids: &'a mut SmallVec<[NodeId; 1]> }
346346

347347
impl<'a, 'b> Visitor<'a> for ImplTraitTypeIdVisitor<'b> {
348348
fn visit_ty(&mut self, ty: &'a Ty) {
349-
match ty.node {
349+
match ty.kind {
350350
| TyKind::Typeof(_)
351351
| TyKind::BareFn(_)
352352
=> return,
@@ -497,7 +497,7 @@ impl<'a> LoweringContext<'a> {
497497
}
498498

499499
fn visit_ty(&mut self, t: &'tcx Ty) {
500-
match t.node {
500+
match t.kind {
501501
// Mirrors the case in visit::walk_ty
502502
TyKind::BareFn(ref f) => {
503503
walk_list!(
@@ -1104,7 +1104,7 @@ impl<'a> LoweringContext<'a> {
11041104
let ty = this.lower_ty(
11051105
&Ty {
11061106
id: this.sess.next_node_id(),
1107-
node: TyKind::ImplTrait(impl_trait_node_id, bounds.clone()),
1107+
kind: TyKind::ImplTrait(impl_trait_node_id, bounds.clone()),
11081108
span: constraint.span,
11091109
},
11101110
itctx,
@@ -1165,14 +1165,14 @@ impl<'a> LoweringContext<'a> {
11651165
let id = self.lower_node_id(t.id);
11661166
let qpath = self.lower_qpath(t.id, qself, path, param_mode, itctx);
11671167
let ty = self.ty_path(id, t.span, qpath);
1168-
if let hir::TyKind::TraitObject(..) = ty.node {
1168+
if let hir::TyKind::TraitObject(..) = ty.kind {
11691169
self.maybe_lint_bare_trait(t.span, t.id, qself.is_none() && path.is_global());
11701170
}
11711171
ty
11721172
}
11731173

11741174
fn lower_ty_direct(&mut self, t: &Ty, mut itctx: ImplTraitContext<'_>) -> hir::Ty {
1175-
let kind = match t.node {
1175+
let kind = match t.kind {
11761176
TyKind::Infer => hir::TyKind::Infer,
11771177
TyKind::Err => hir::TyKind::Err,
11781178
TyKind::Slice(ref ty) => hir::TyKind::Slice(self.lower_ty(ty, itctx)),
@@ -1345,7 +1345,7 @@ impl<'a> LoweringContext<'a> {
13451345
};
13461346

13471347
hir::Ty {
1348-
node: kind,
1348+
kind,
13491349
span: t.span,
13501350
hir_id: self.lower_node_id(t.id),
13511351
}
@@ -1505,7 +1505,7 @@ impl<'a> LoweringContext<'a> {
15051505

15061506
fn visit_ty(&mut self, t: &'v hir::Ty) {
15071507
// Don't collect elided lifetimes used inside of `fn()` syntax.
1508-
if let hir::TyKind::BareFn(_) = t.node {
1508+
if let hir::TyKind::BareFn(_) = t.kind {
15091509
let old_collect_elided_lifetimes = self.collect_elided_lifetimes;
15101510
self.collect_elided_lifetimes = false;
15111511

@@ -2026,7 +2026,7 @@ impl<'a> LoweringContext<'a> {
20262026
.map(|ty| this.lower_ty_direct(ty, ImplTraitContext::disallowed()))
20272027
.collect();
20282028
let mk_tup = |this: &mut Self, tys, span| {
2029-
hir::Ty { node: hir::TyKind::Tup(tys), hir_id: this.next_id(), span }
2029+
hir::Ty { kind: hir::TyKind::Tup(tys), hir_id: this.next_id(), span }
20302030
};
20312031
(
20322032
hir::GenericArgs {
@@ -2179,16 +2179,16 @@ impl<'a> LoweringContext<'a> {
21792179
_ => false,
21802180
};
21812181

2182-
match arg.ty.node {
2182+
match arg.ty.kind {
21832183
TyKind::ImplicitSelf if is_mutable_pat => hir::ImplicitSelfKind::Mut,
21842184
TyKind::ImplicitSelf => hir::ImplicitSelfKind::Imm,
21852185
// Given we are only considering `ImplicitSelf` types, we needn't consider
21862186
// the case where we have a mutable pattern to a reference as that would
21872187
// no longer be an `ImplicitSelf`.
2188-
TyKind::Rptr(_, ref mt) if mt.ty.node.is_implicit_self() &&
2188+
TyKind::Rptr(_, ref mt) if mt.ty.kind.is_implicit_self() &&
21892189
mt.mutbl == ast::Mutability::Mutable =>
21902190
hir::ImplicitSelfKind::MutRef,
2191-
TyKind::Rptr(_, ref mt) if mt.ty.node.is_implicit_self() =>
2191+
TyKind::Rptr(_, ref mt) if mt.ty.kind.is_implicit_self() =>
21922192
hir::ImplicitSelfKind::ImmRef,
21932193
_ => hir::ImplicitSelfKind::None,
21942194
}
@@ -2403,7 +2403,7 @@ impl<'a> LoweringContext<'a> {
24032403
let opaque_ty_ref = hir::TyKind::Def(hir::ItemId { id: opaque_ty_id }, generic_args.into());
24042404

24052405
hir::FunctionRetTy::Return(P(hir::Ty {
2406-
node: opaque_ty_ref,
2406+
kind: opaque_ty_ref,
24072407
span,
24082408
hir_id: self.next_id(),
24092409
}))
@@ -2424,7 +2424,7 @@ impl<'a> LoweringContext<'a> {
24242424
FunctionRetTy::Default(ret_ty_span) => {
24252425
P(hir::Ty {
24262426
hir_id: self.next_id(),
2427-
node: hir::TyKind::Tup(hir_vec![]),
2427+
kind: hir::TyKind::Tup(hir_vec![]),
24282428
span: *ret_ty_span,
24292429
})
24302430
}
@@ -3164,7 +3164,7 @@ impl<'a> LoweringContext<'a> {
31643164
}
31653165

31663166
fn ty_path(&mut self, mut hir_id: hir::HirId, span: Span, qpath: hir::QPath) -> hir::Ty {
3167-
let node = match qpath {
3167+
let kind = match qpath {
31683168
hir::QPath::Resolved(None, path) => {
31693169
// Turn trait object paths into `TyKind::TraitObject` instead.
31703170
match path.res {
@@ -3188,9 +3188,10 @@ impl<'a> LoweringContext<'a> {
31883188
}
31893189
_ => hir::TyKind::Path(qpath),
31903190
};
3191+
31913192
hir::Ty {
31923193
hir_id,
3193-
node,
3194+
kind,
31943195
span,
31953196
}
31963197
}
@@ -3394,7 +3395,7 @@ pub fn is_range_literal(sess: &Session, expr: &hir::Expr) -> bool {
33943395
// `..=` desugars into `::std::ops::RangeInclusive::new(...)`.
33953396
ExprKind::Call(ref func, _) => {
33963397
if let ExprKind::Path(QPath::TypeRelative(ref ty, ref segment)) = func.kind {
3397-
if let TyKind::Path(QPath::Resolved(None, ref path)) = ty.node {
3398+
if let TyKind::Path(QPath::Resolved(None, ref path)) = ty.kind {
33983399
let new_call = segment.ident.as_str() == "new";
33993400
return is_range_path(&path) && is_lit(sess, &expr.span) && new_call;
34003401
}

src/librustc/hir/lowering/item.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ impl LoweringContext<'_> {
789789
}
790790

791791
fn lower_struct_field(&mut self, (index, f): (usize, &StructField)) -> hir::StructField {
792-
let ty = if let TyKind::Path(ref qself, ref path) = f.ty.node {
792+
let ty = if let TyKind::Path(ref qself, ref path) = f.ty.kind {
793793
let t = self.lower_path_ty(
794794
&f.ty,
795795
qself,
@@ -1343,7 +1343,7 @@ impl LoweringContext<'_> {
13431343
);
13441344
};
13451345
// Check if the where clause type is a plain type parameter.
1346-
match bound_pred.bounded_ty.node {
1346+
match bound_pred.bounded_ty.kind {
13471347
TyKind::Path(None, ref path)
13481348
if path.segments.len() == 1
13491349
&& bound_pred.bound_generic_params.is_empty() =>

src/librustc/hir/map/def_collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
292292
}
293293

294294
fn visit_ty(&mut self, ty: &'a Ty) {
295-
match ty.node {
295+
match ty.kind {
296296
TyKind::Mac(..) => return self.visit_macro_invoc(ty.id),
297297
TyKind::ImplTrait(node_id, _) => {
298298
self.create_def(node_id, DefPathData::ImplTrait, ty.span);

src/librustc/hir/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ impl GenericArgs {
479479
match arg {
480480
GenericArg::Lifetime(_) => {}
481481
GenericArg::Type(ref ty) => {
482-
if let TyKind::Tup(ref tys) = ty.node {
482+
if let TyKind::Tup(ref tys) = ty.kind {
483483
return tys;
484484
}
485485
break;
@@ -1939,7 +1939,7 @@ impl TypeBinding {
19391939
#[derive(RustcEncodable, RustcDecodable)]
19401940
pub struct Ty {
19411941
pub hir_id: HirId,
1942-
pub node: TyKind,
1942+
pub kind: TyKind,
19431943
pub span: Span,
19441944
}
19451945

src/librustc/hir/print.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl<'a> State<'a> {
286286
pub fn print_type(&mut self, ty: &hir::Ty) {
287287
self.maybe_print_comment(ty.span.lo());
288288
self.ibox(0);
289-
match ty.node {
289+
match ty.kind {
290290
hir::TyKind::Slice(ref ty) => {
291291
self.s.word("[");
292292
self.print_type(&ty);
@@ -1880,7 +1880,7 @@ impl<'a> State<'a> {
18801880
s.ann.nested(s, Nested::BodyParamPat(body_id, i));
18811881
i += 1;
18821882

1883-
if let hir::TyKind::Infer = ty.node {
1883+
if let hir::TyKind::Infer = ty.kind {
18841884
// Print nothing.
18851885
} else {
18861886
s.s.word(":");

src/librustc/ich/impls_hir.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,11 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::Ty {
144144
hcx.while_hashing_hir_bodies(true, |hcx| {
145145
let hir::Ty {
146146
hir_id: _,
147-
ref node,
147+
ref kind,
148148
ref span,
149149
} = *self;
150150

151-
node.hash_stable(hcx, hasher);
151+
kind.hash_stable(hcx, hasher);
152152
span.hash_stable(hcx, hasher);
153153
})
154154
}

src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
9898
}
9999

100100
fn visit_ty(&mut self, arg: &'tcx hir::Ty) {
101-
match arg.node {
101+
match arg.kind {
102102
hir::TyKind::BareFn(_) => {
103103
self.current_index.shift_in(1);
104104
intravisit::walk_ty(self, arg);

src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
8787
return None;
8888
}
8989
if let FunctionRetTy::Return(ty) = &fndecl.output {
90-
if let (TyKind::Def(_, _), ty::ReStatic) = (&ty.node, sub) {
90+
if let (TyKind::Def(_, _), ty::ReStatic) = (&ty.kind, sub) {
9191
// This is an impl Trait return that evaluates de need of 'static.
9292
// We handle this case better in `static_impl_trait`.
9393
return None;

src/librustc/lint/internal.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TyTyKind {
9494
}
9595

9696
fn check_ty(&mut self, cx: &LateContext<'_, '_>, ty: &'tcx Ty) {
97-
match &ty.node {
97+
match &ty.kind {
9898
TyKind::Path(qpath) => {
9999
if let QPath::Resolved(_, path) = qpath {
100100
if let Some(last) = path.segments.iter().last() {
@@ -169,7 +169,7 @@ fn lint_ty_kind_usage(cx: &LateContext<'_, '_>, segment: &PathSegment) -> bool {
169169
}
170170

171171
fn is_ty_or_ty_ctxt(cx: &LateContext<'_, '_>, ty: &Ty) -> Option<String> {
172-
match &ty.node {
172+
match &ty.kind {
173173
TyKind::Path(qpath) => {
174174
if let QPath::Resolved(_, path) = qpath {
175175
let did = path.res.opt_def_id()?;

src/librustc/middle/dead.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
292292
}
293293

294294
fn visit_ty(&mut self, ty: &'tcx hir::Ty) {
295-
match ty.node {
295+
match ty.kind {
296296
TyKind::Def(item_id, _) => {
297297
let item = self.tcx.hir().expect_item(item_id.id);
298298
intravisit::walk_item(self, item);

src/librustc/middle/resolve_lifetime.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,8 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
558558

559559
fn visit_ty(&mut self, ty: &'tcx hir::Ty) {
560560
debug!("visit_ty: id={:?} ty={:?}", ty.hir_id, ty);
561-
debug!("visit_ty: ty.node={:?}", ty.node);
562-
match ty.node {
561+
debug!("visit_ty: ty.kind={:?}", ty.kind);
562+
match ty.kind {
563563
hir::TyKind::BareFn(ref c) => {
564564
let next_early_index = self.next_early_index();
565565
let was_in_fn_syntax = self.is_in_fn_syntax;
@@ -1352,7 +1352,7 @@ fn object_lifetime_defaults_for_item(
13521352
continue;
13531353
}
13541354

1355-
let res = match data.bounded_ty.node {
1355+
let res = match data.bounded_ty.kind {
13561356
hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => path.res,
13571357
_ => continue,
13581358
};
@@ -1487,7 +1487,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
14871487
let mut elide_use = None;
14881488
let mut find_arg_use_span = |inputs: &hir::HirVec<hir::Ty>| {
14891489
for input in inputs {
1490-
match input.node {
1490+
match input.kind {
14911491
hir::TyKind::Rptr(lt, _) => {
14921492
if lt.name.ident() == name {
14931493
// include the trailing whitespace between the lifetime and type names
@@ -2270,8 +2270,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
22702270
}
22712271

22722272
fn visit_ty(&mut self, ty: &'a hir::Ty) {
2273-
if let hir::TyKind::Rptr(lifetime_ref, ref mt) = ty.node {
2274-
if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = mt.ty.node
2273+
if let hir::TyKind::Rptr(lifetime_ref, ref mt) = ty.kind {
2274+
if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = mt.ty.kind
22752275
{
22762276
if self.is_self_ty(path.res) {
22772277
if let Some(lifetime) = self.map.defs.get(&lifetime_ref.hir_id) {
@@ -2286,7 +2286,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
22862286

22872287
let mut visitor = SelfVisitor {
22882288
map: self.map,
2289-
impl_self: impl_self.map(|ty| &ty.node),
2289+
impl_self: impl_self.map(|ty| &ty.kind),
22902290
lifetime: Set1::Empty,
22912291
};
22922292
visitor.visit_ty(&inputs[0]);
@@ -2364,10 +2364,10 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
23642364
}
23652365

23662366
fn visit_ty(&mut self, ty: &hir::Ty) {
2367-
if let hir::TyKind::BareFn(_) = ty.node {
2367+
if let hir::TyKind::BareFn(_) = ty.kind {
23682368
self.outer_index.shift_in(1);
23692369
}
2370-
match ty.node {
2370+
match ty.kind {
23712371
hir::TyKind::TraitObject(ref bounds, ref lifetime) => {
23722372
for bound in bounds {
23732373
self.visit_poly_trait_ref(bound, hir::TraitBoundModifier::None);
@@ -2384,7 +2384,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
23842384
intravisit::walk_ty(self, ty);
23852385
}
23862386
}
2387-
if let hir::TyKind::BareFn(_) = ty.node {
2387+
if let hir::TyKind::BareFn(_) = ty.kind {
23882388
self.outer_index.shift_out(1);
23892389
}
23902390
}
@@ -2991,7 +2991,7 @@ fn insert_late_bound_lifetimes(
29912991
}
29922992

29932993
fn visit_ty(&mut self, ty: &'v hir::Ty) {
2994-
match ty.node {
2994+
match ty.kind {
29952995
hir::TyKind::Path(hir::QPath::Resolved(Some(_), _))
29962996
| hir::TyKind::Path(hir::QPath::TypeRelative(..)) => {
29972997
// ignore lifetimes appearing in associated type

src/librustc/traits/error_reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
11771177
..
11781178
}) => {
11791179
(self.tcx.sess.source_map().def_span(span), decl.inputs.iter()
1180-
.map(|arg| match arg.clone().node {
1180+
.map(|arg| match arg.clone().kind {
11811181
hir::TyKind::Tup(ref tys) => ArgKind::Tuple(
11821182
Some(arg.span),
11831183
vec![("_".to_owned(), "_".to_owned()); tys.len()]

src/librustc_interface/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ impl<'a> ReplaceBodyWithLoop<'a> {
738738
fn should_ignore_fn(ret_ty: &ast::FnDecl) -> bool {
739739
if let ast::FunctionRetTy::Ty(ref ty) = ret_ty.output {
740740
fn involves_impl_trait(ty: &ast::Ty) -> bool {
741-
match ty.node {
741+
match ty.kind {
742742
ast::TyKind::ImplTrait(..) => true,
743743
ast::TyKind::Slice(ref subty) |
744744
ast::TyKind::Array(ref subty, _) |

src/librustc_lint/builtin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ impl TypeAliasBounds {
10901090
match *qpath {
10911091
hir::QPath::TypeRelative(ref ty, _) => {
10921092
// If this is a type variable, we found a `T::Assoc`.
1093-
match ty.node {
1093+
match ty.kind {
10941094
hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => {
10951095
match path.res {
10961096
Res::Def(DefKind::TyParam, _) => true,
@@ -1750,7 +1750,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExplicitOutlivesRequirements {
17501750
hir::WherePredicate::BoundPredicate(predicate) => {
17511751
// FIXME we can also infer bounds on associated types,
17521752
// and should check for them here.
1753-
match predicate.bounded_ty.node {
1753+
match predicate.bounded_ty.kind {
17541754
hir::TyKind::Path(hir::QPath::Resolved(
17551755
None,
17561756
ref path,

src/librustc_metadata/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1799,7 +1799,7 @@ impl EncodeContext<'tcx> {
17991799
}
18001800

18011801
fn encode_info_for_ty(&mut self, ty: &hir::Ty) {
1802-
match ty.node {
1802+
match ty.kind {
18031803
hir::TyKind::Array(_, ref length) => {
18041804
let def_id = self.tcx.hir().local_def_id(length.hir_id);
18051805
self.record(def_id, EncodeContext::encode_info_for_anon_const, def_id);

0 commit comments

Comments
 (0)