Skip to content

Commit 50702b2

Browse files
committed
Auto merge of #52264 - csmoe:kind, r=oli-obk
Rename spanned HIR node enums from Foo_ to FooKind Closes #51968 r? @oli-obk
2 parents 3d5753f + c692816 commit 50702b2

File tree

99 files changed

+2058
-1968
lines changed

Some content is hidden

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

99 files changed

+2058
-1968
lines changed

src/librustc/cfg/construct.rs

+39-39
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
111111
fn stmt(&mut self, stmt: &hir::Stmt, pred: CFGIndex) -> CFGIndex {
112112
let hir_id = self.tcx.hir.node_to_hir_id(stmt.node.id());
113113
match stmt.node {
114-
hir::StmtDecl(ref decl, _) => {
114+
hir::StmtKind::Decl(ref decl, _) => {
115115
let exit = self.decl(&decl, pred);
116116
self.add_ast_node(hir_id.local_id, &[exit])
117117
}
118118

119-
hir::StmtExpr(ref expr, _) |
120-
hir::StmtSemi(ref expr, _) => {
119+
hir::StmtKind::Expr(ref expr, _) |
120+
hir::StmtKind::Semi(ref expr, _) => {
121121
let exit = self.expr(&expr, pred);
122122
self.add_ast_node(hir_id.local_id, &[exit])
123123
}
@@ -126,12 +126,12 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
126126

127127
fn decl(&mut self, decl: &hir::Decl, pred: CFGIndex) -> CFGIndex {
128128
match decl.node {
129-
hir::DeclLocal(ref local) => {
129+
hir::DeclKind::Local(ref local) => {
130130
let init_exit = self.opt_expr(&local.init, pred);
131131
self.pat(&local.pat, init_exit)
132132
}
133133

134-
hir::DeclItem(_) => pred,
134+
hir::DeclKind::Item(_) => pred,
135135
}
136136
}
137137

@@ -179,12 +179,12 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
179179

180180
fn expr(&mut self, expr: &hir::Expr, pred: CFGIndex) -> CFGIndex {
181181
match expr.node {
182-
hir::ExprBlock(ref blk, _) => {
182+
hir::ExprKind::Block(ref blk, _) => {
183183
let blk_exit = self.block(&blk, pred);
184184
self.add_ast_node(expr.hir_id.local_id, &[blk_exit])
185185
}
186186

187-
hir::ExprIf(ref cond, ref then, None) => {
187+
hir::ExprKind::If(ref cond, ref then, None) => {
188188
//
189189
// [pred]
190190
// |
@@ -204,7 +204,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
204204
self.add_ast_node(expr.hir_id.local_id, &[cond_exit, then_exit]) // 3,4
205205
}
206206

207-
hir::ExprIf(ref cond, ref then, Some(ref otherwise)) => {
207+
hir::ExprKind::If(ref cond, ref then, Some(ref otherwise)) => {
208208
//
209209
// [pred]
210210
// |
@@ -225,7 +225,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
225225
self.add_ast_node(expr.hir_id.local_id, &[then_exit, else_exit]) // 4, 5
226226
}
227227

228-
hir::ExprWhile(ref cond, ref body, _) => {
228+
hir::ExprKind::While(ref cond, ref body, _) => {
229229
//
230230
// [pred]
231231
// |
@@ -267,7 +267,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
267267
expr_exit
268268
}
269269

270-
hir::ExprLoop(ref body, _, _) => {
270+
hir::ExprKind::Loop(ref body, _, _) => {
271271
//
272272
// [pred]
273273
// |
@@ -295,11 +295,11 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
295295
expr_exit
296296
}
297297

298-
hir::ExprMatch(ref discr, ref arms, _) => {
298+
hir::ExprKind::Match(ref discr, ref arms, _) => {
299299
self.match_(expr.hir_id.local_id, &discr, &arms, pred)
300300
}
301301

302-
hir::ExprBinary(op, ref l, ref r) if op.node.is_lazy() => {
302+
hir::ExprKind::Binary(op, ref l, ref r) if op.node.is_lazy() => {
303303
//
304304
// [pred]
305305
// |
@@ -319,14 +319,14 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
319319
self.add_ast_node(expr.hir_id.local_id, &[l_exit, r_exit]) // 3,4
320320
}
321321

322-
hir::ExprRet(ref v) => {
322+
hir::ExprKind::Ret(ref v) => {
323323
let v_exit = self.opt_expr(v, pred);
324324
let b = self.add_ast_node(expr.hir_id.local_id, &[v_exit]);
325325
self.add_returning_edge(expr, b);
326326
self.add_unreachable_node()
327327
}
328328

329-
hir::ExprBreak(destination, ref opt_expr) => {
329+
hir::ExprKind::Break(destination, ref opt_expr) => {
330330
let v = self.opt_expr(opt_expr, pred);
331331
let (target_scope, break_dest) =
332332
self.find_scope_edge(expr, destination, ScopeCfKind::Break);
@@ -335,74 +335,74 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
335335
self.add_unreachable_node()
336336
}
337337

338-
hir::ExprContinue(destination) => {
338+
hir::ExprKind::Continue(destination) => {
339339
let (target_scope, cont_dest) =
340340
self.find_scope_edge(expr, destination, ScopeCfKind::Continue);
341341
let a = self.add_ast_node(expr.hir_id.local_id, &[pred]);
342342
self.add_exiting_edge(expr, a, target_scope, cont_dest);
343343
self.add_unreachable_node()
344344
}
345345

346-
hir::ExprArray(ref elems) => {
346+
hir::ExprKind::Array(ref elems) => {
347347
self.straightline(expr, pred, elems.iter().map(|e| &*e))
348348
}
349349

350-
hir::ExprCall(ref func, ref args) => {
350+
hir::ExprKind::Call(ref func, ref args) => {
351351
self.call(expr, pred, &func, args.iter().map(|e| &*e))
352352
}
353353

354-
hir::ExprMethodCall(.., ref args) => {
354+
hir::ExprKind::MethodCall(.., ref args) => {
355355
self.call(expr, pred, &args[0], args[1..].iter().map(|e| &*e))
356356
}
357357

358-
hir::ExprIndex(ref l, ref r) |
359-
hir::ExprBinary(_, ref l, ref r) if self.tables.is_method_call(expr) => {
358+
hir::ExprKind::Index(ref l, ref r) |
359+
hir::ExprKind::Binary(_, ref l, ref r) if self.tables.is_method_call(expr) => {
360360
self.call(expr, pred, &l, Some(&**r).into_iter())
361361
}
362362

363-
hir::ExprUnary(_, ref e) if self.tables.is_method_call(expr) => {
363+
hir::ExprKind::Unary(_, ref e) if self.tables.is_method_call(expr) => {
364364
self.call(expr, pred, &e, None::<hir::Expr>.iter())
365365
}
366366

367-
hir::ExprTup(ref exprs) => {
367+
hir::ExprKind::Tup(ref exprs) => {
368368
self.straightline(expr, pred, exprs.iter().map(|e| &*e))
369369
}
370370

371-
hir::ExprStruct(_, ref fields, ref base) => {
371+
hir::ExprKind::Struct(_, ref fields, ref base) => {
372372
let field_cfg = self.straightline(expr, pred, fields.iter().map(|f| &*f.expr));
373373
self.opt_expr(base, field_cfg)
374374
}
375375

376-
hir::ExprAssign(ref l, ref r) |
377-
hir::ExprAssignOp(_, ref l, ref r) => {
376+
hir::ExprKind::Assign(ref l, ref r) |
377+
hir::ExprKind::AssignOp(_, ref l, ref r) => {
378378
self.straightline(expr, pred, [r, l].iter().map(|&e| &**e))
379379
}
380380

381-
hir::ExprIndex(ref l, ref r) |
382-
hir::ExprBinary(_, ref l, ref r) => { // NB: && and || handled earlier
381+
hir::ExprKind::Index(ref l, ref r) |
382+
hir::ExprKind::Binary(_, ref l, ref r) => { // NB: && and || handled earlier
383383
self.straightline(expr, pred, [l, r].iter().map(|&e| &**e))
384384
}
385385

386-
hir::ExprBox(ref e) |
387-
hir::ExprAddrOf(_, ref e) |
388-
hir::ExprCast(ref e, _) |
389-
hir::ExprType(ref e, _) |
390-
hir::ExprUnary(_, ref e) |
391-
hir::ExprField(ref e, _) |
392-
hir::ExprYield(ref e) |
393-
hir::ExprRepeat(ref e, _) => {
386+
hir::ExprKind::Box(ref e) |
387+
hir::ExprKind::AddrOf(_, ref e) |
388+
hir::ExprKind::Cast(ref e, _) |
389+
hir::ExprKind::Type(ref e, _) |
390+
hir::ExprKind::Unary(_, ref e) |
391+
hir::ExprKind::Field(ref e, _) |
392+
hir::ExprKind::Yield(ref e) |
393+
hir::ExprKind::Repeat(ref e, _) => {
394394
self.straightline(expr, pred, Some(&**e).into_iter())
395395
}
396396

397-
hir::ExprInlineAsm(_, ref outputs, ref inputs) => {
397+
hir::ExprKind::InlineAsm(_, ref outputs, ref inputs) => {
398398
let post_outputs = self.exprs(outputs.iter().map(|e| &*e), pred);
399399
let post_inputs = self.exprs(inputs.iter().map(|e| &*e), post_outputs);
400400
self.add_ast_node(expr.hir_id.local_id, &[post_inputs])
401401
}
402402

403-
hir::ExprClosure(..) |
404-
hir::ExprLit(..) |
405-
hir::ExprPath(_) => {
403+
hir::ExprKind::Closure(..) |
404+
hir::ExprKind::Lit(..) |
405+
hir::ExprKind::Path(_) => {
406406
self.straightline(expr, pred, None::<hir::Expr>.iter())
407407
}
408408
}

src/librustc/hir/check_attr.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ enum Target {
3838
impl Target {
3939
fn from_item(item: &hir::Item) -> Target {
4040
match item.node {
41-
hir::ItemFn(..) => Target::Fn,
42-
hir::ItemStruct(..) => Target::Struct,
43-
hir::ItemUnion(..) => Target::Union,
44-
hir::ItemEnum(..) => Target::Enum,
45-
hir::ItemConst(..) => Target::Const,
46-
hir::ItemForeignMod(..) => Target::ForeignMod,
47-
hir::ItemStatic(..) => Target::Static,
41+
hir::ItemKind::Fn(..) => Target::Fn,
42+
hir::ItemKind::Struct(..) => Target::Struct,
43+
hir::ItemKind::Union(..) => Target::Union,
44+
hir::ItemKind::Enum(..) => Target::Enum,
45+
hir::ItemKind::Const(..) => Target::Const,
46+
hir::ItemKind::ForeignMod(..) => Target::ForeignMod,
47+
hir::ItemKind::Static(..) => Target::Static,
4848
_ => Target::Other,
4949
}
5050
}
@@ -264,7 +264,7 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> {
264264

265265
fn check_stmt_attributes(&self, stmt: &hir::Stmt) {
266266
// When checking statements ignore expressions, they will be checked later
267-
if let hir::Stmt_::StmtDecl(_, _) = stmt.node {
267+
if let hir::StmtKind::Decl(_, _) = stmt.node {
268268
for attr in stmt.node.attrs() {
269269
if attr.check_name("inline") {
270270
self.check_inline(attr, &stmt.span, Target::Statement);
@@ -283,7 +283,7 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> {
283283

284284
fn check_expr_attributes(&self, expr: &hir::Expr) {
285285
let target = match expr.node {
286-
hir::ExprClosure(..) => Target::Closure,
286+
hir::ExprKind::Closure(..) => Target::Closure,
287287
_ => Target::Expression,
288288
};
289289
for attr in expr.attrs.iter() {
@@ -340,7 +340,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
340340
}
341341

342342
fn is_c_like_enum(item: &hir::Item) -> bool {
343-
if let hir::ItemEnum(ref def, _) = item.node {
343+
if let hir::ItemKind::Enum(ref def, _) = item.node {
344344
for variant in &def.variants {
345345
match variant.node.data {
346346
hir::VariantData::Unit(_) => { /* continue */ }

0 commit comments

Comments
 (0)