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()?;

0 commit comments

Comments
 (0)