Skip to content

Commit 14893ba

Browse files
csmoeoli-obk
authored andcommitted
DeclKind
1 parent 114314c commit 14893ba

File tree

11 files changed

+36
-37
lines changed

11 files changed

+36
-37
lines changed

src/librustc/cfg/construct.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

src/librustc/hir/intravisit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,8 +949,8 @@ pub fn walk_stmt<'v, V: Visitor<'v>>(visitor: &mut V, statement: &'v Stmt) {
949949

950950
pub fn walk_decl<'v, V: Visitor<'v>>(visitor: &mut V, declaration: &'v Decl) {
951951
match declaration.node {
952-
DeclLocal(ref local) => visitor.visit_local(local),
953-
DeclItem(item) => visitor.visit_nested_item(item),
952+
DeclKind::Local(ref local) => visitor.visit_local(local),
953+
DeclKind::Item(item) => visitor.visit_nested_item(item),
954954
}
955955
}
956956

src/librustc/hir/lowering.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4248,7 +4248,7 @@ impl<'a> LoweringContext<'a> {
42484248
StmtKind::Local(ref l) => Spanned {
42494249
node: hir::StmtKind::Decl(
42504250
P(Spanned {
4251-
node: hir::DeclLocal(self.lower_local(l)),
4251+
node: hir::DeclKind::Local(self.lower_local(l)),
42524252
span: s.span,
42534253
}),
42544254
self.lower_node_id(s.id).node_id,
@@ -4263,7 +4263,7 @@ impl<'a> LoweringContext<'a> {
42634263
.map(|item_id| Spanned {
42644264
node: hir::StmtKind::Decl(
42654265
P(Spanned {
4266-
node: hir::DeclItem(item_id),
4266+
node: hir::DeclKind::Item(item_id),
42674267
span: s.span,
42684268
}),
42694269
id.take()
@@ -4493,7 +4493,7 @@ impl<'a> LoweringContext<'a> {
44934493
attrs: ThinVec::new(),
44944494
source,
44954495
});
4496-
let decl = respan(sp, hir::DeclLocal(local));
4496+
let decl = respan(sp, hir::DeclKind::Local(local));
44974497
respan(sp, hir::StmtKind::Decl(P(decl), self.next_id().node_id))
44984498
}
44994499

src/librustc/hir/mod.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212

1313
pub use self::BlockCheckMode::*;
1414
pub use self::CaptureClause::*;
15-
pub use self::Decl_::*;
16-
pub use self::Expr_::*;
15+
pub use self::ExprKind::*;
1716
pub use self::FunctionRetTy::*;
1817
pub use self::ForeignItem_::*;
1918
pub use self::Item_::*;
@@ -1158,27 +1157,27 @@ pub struct Local {
11581157
pub source: LocalSource,
11591158
}
11601159

1161-
pub type Decl = Spanned<Decl_>;
1160+
pub type Decl = Spanned<DeclKind>;
11621161

11631162
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
1164-
pub enum Decl_ {
1163+
pub enum DeclKind {
11651164
/// A local (let) binding:
1166-
DeclLocal(P<Local>),
1165+
Local(P<Local>),
11671166
/// An item binding:
1168-
DeclItem(ItemId),
1167+
Item(ItemId),
11691168
}
11701169

1171-
impl Decl_ {
1170+
impl DeclKind {
11721171
pub fn attrs(&self) -> &[Attribute] {
11731172
match *self {
1174-
DeclLocal(ref l) => &l.attrs,
1175-
DeclItem(_) => &[]
1173+
DeclKind::Local(ref l) => &l.attrs,
1174+
DeclKind::Item(_) => &[]
11761175
}
11771176
}
11781177

11791178
pub fn is_local(&self) -> bool {
11801179
match *self {
1181-
Decl_::DeclLocal(_) => true,
1180+
DeclKind::Local(_) => true,
11821181
_ => false,
11831182
}
11841183
}

src/librustc/hir/print.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,7 +1575,7 @@ impl<'a> State<'a> {
15751575
pub fn print_decl(&mut self, decl: &hir::Decl) -> io::Result<()> {
15761576
self.maybe_print_comment(decl.span.lo())?;
15771577
match decl.node {
1578-
hir::DeclLocal(ref loc) => {
1578+
hir::DeclKind::Local(ref loc) => {
15791579
self.space_if_not_bol()?;
15801580
self.ibox(indent_unit)?;
15811581
self.word_nbsp("let")?;
@@ -1590,7 +1590,7 @@ impl<'a> State<'a> {
15901590
}
15911591
self.end()
15921592
}
1593-
hir::DeclItem(item) => {
1593+
hir::DeclKind::Item(item) => {
15941594
self.ann.nested(self, Nested::Item(item))
15951595
}
15961596
}
@@ -2400,8 +2400,8 @@ fn stmt_ends_with_semi(stmt: &hir::StmtKind) -> bool {
24002400
match *stmt {
24012401
hir::StmtKind::Decl(ref d, _) => {
24022402
match d.node {
2403-
hir::DeclLocal(_) => true,
2404-
hir::DeclItem(_) => false,
2403+
hir::DeclKind::Local(_) => true,
2404+
hir::DeclKind::Item(_) => false,
24052405
}
24062406
}
24072407
hir::StmtKind::Expr(ref e, _) => {

src/librustc/ich/impls_hir.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,10 +479,10 @@ impl_stable_hash_for!(struct hir::Local {
479479
source
480480
});
481481

482-
impl_stable_hash_for_spanned!(hir::Decl_);
483-
impl_stable_hash_for!(enum hir::Decl_ {
484-
DeclLocal(local),
485-
DeclItem(item_id)
482+
impl_stable_hash_for_spanned!(hir::DeclKind);
483+
impl_stable_hash_for!(enum hir::DeclKind {
484+
Local(local),
485+
Item(item_id)
486486
});
487487

488488
impl_stable_hash_for!(struct hir::Arm {

src/librustc/middle/expr_use_visitor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,11 +588,11 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> {
588588
match stmt.node {
589589
hir::StmtKind::Decl(ref decl, _) => {
590590
match decl.node {
591-
hir::DeclLocal(ref local) => {
591+
hir::DeclKind::Local(ref local) => {
592592
self.walk_local(&local);
593593
}
594594

595-
hir::DeclItem(_) => {
595+
hir::DeclKind::Item(_) => {
596596
// we don't visit nested items in this visitor,
597597
// only the fn body we were given.
598598
}

src/librustc/middle/liveness.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -873,10 +873,10 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
873873
fn propagate_through_decl(&mut self, decl: &hir::Decl, succ: LiveNode)
874874
-> LiveNode {
875875
match decl.node {
876-
hir::DeclLocal(ref local) => {
876+
hir::DeclKind::Local(ref local) => {
877877
self.propagate_through_local(&local, succ)
878878
}
879-
hir::DeclItem(_) => succ,
879+
hir::DeclKind::Item(_) => succ,
880880
}
881881
}
882882

src/librustc_mir/hair/cx/block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ fn mirror_stmts<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
6767
}
6868
hir::StmtKind::Decl(ref decl, _) => {
6969
match decl.node {
70-
hir::DeclItem(..) => {
70+
hir::DeclKind::Item(..) => {
7171
// ignore for purposes of the MIR
7272
}
73-
hir::DeclLocal(ref local) => {
73+
hir::DeclKind::Local(ref local) => {
7474
let remainder_scope = region::Scope::Remainder(BlockRemainder {
7575
block: block_id,
7676
first_statement_index: region::FirstStatementIndex::new(index),

src/librustc_passes/rvalue_promotion.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
263263
match stmt.node {
264264
hir::StmtKind::Decl(ref decl, _node_id) => {
265265
match &decl.node {
266-
hir::DeclLocal(local) => {
266+
hir::DeclKind::Local(local) => {
267267
if self.remove_mut_rvalue_borrow(&local.pat) {
268268
if let Some(init) = &local.init {
269269
self.mut_rvalue_borrows.insert(init.id);
@@ -277,7 +277,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
277277
NotPromotable
278278
}
279279
// Item statements are allowed
280-
hir::DeclItem(_) => Promotable
280+
hir::DeclKind::Item(_) => Promotable
281281
}
282282
}
283283
hir::StmtKind::Expr(ref box_expr, _node_id) |

src/librustc_typeck/check/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4379,8 +4379,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
43794379
match stmt.node {
43804380
hir::StmtKind::Decl(ref decl, _) => {
43814381
match decl.node {
4382-
hir::DeclLocal(_) => {}
4383-
hir::DeclItem(_) => {
4382+
hir::DeclKind::Local(_) => {}
4383+
hir::DeclKind::Item(_) => {
43844384
return;
43854385
}
43864386
}
@@ -4399,10 +4399,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
43994399
match stmt.node {
44004400
hir::StmtKind::Decl(ref decl, _) => {
44014401
match decl.node {
4402-
hir::DeclLocal(ref l) => {
4402+
hir::DeclKind::Local(ref l) => {
44034403
self.check_decl_local(&l);
44044404
}
4405-
hir::DeclItem(_) => {/* ignore for now */}
4405+
hir::DeclKind::Item(_) => {/* ignore for now */}
44064406
}
44074407
}
44084408
hir::StmtKind::Expr(ref expr, _) => {

0 commit comments

Comments
 (0)