@@ -26,47 +26,52 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Block {
26
26
extent : cx. tcx . region_maps . node_extent ( self . id ) ,
27
27
span : self . span ,
28
28
stmts : stmts,
29
- expr : self . expr . to_ref ( )
29
+ expr : self . expr . to_ref ( ) ,
30
30
}
31
31
}
32
32
}
33
33
34
34
fn mirror_stmts < ' a , ' gcx , ' tcx > ( cx : & mut Cx < ' a , ' gcx , ' tcx > ,
35
35
block_id : ast:: NodeId ,
36
36
stmts : & ' tcx [ hir:: Stmt ] )
37
- -> Vec < StmtRef < ' tcx > >
38
- {
37
+ -> Vec < StmtRef < ' tcx > > {
39
38
let mut result = vec ! [ ] ;
40
39
for ( index, stmt) in stmts. iter ( ) . enumerate ( ) {
41
40
match stmt. node {
42
- hir:: StmtExpr ( ref expr, id) | hir:: StmtSemi ( ref expr, id) =>
41
+ hir:: StmtExpr ( ref expr, id) |
42
+ hir:: StmtSemi ( ref expr, id) => {
43
43
result. push ( StmtRef :: Mirror ( Box :: new ( Stmt {
44
44
span : stmt. span ,
45
45
kind : StmtKind :: Expr {
46
46
scope : cx. tcx . region_maps . node_extent ( id) ,
47
- expr : expr. to_ref ( )
47
+ expr : expr. to_ref ( ) ,
48
+ } ,
49
+ } ) ) )
50
+ }
51
+ hir:: StmtDecl ( ref decl, id) => {
52
+ match decl. node {
53
+ hir:: DeclItem ( ..) => {
54
+ // ignore for purposes of the MIR
48
55
}
49
- } ) ) ) ,
50
- hir:: StmtDecl ( ref decl, id) => match decl. node {
51
- hir:: DeclItem ( ..) => { /* ignore for purposes of the MIR */ }
52
- hir:: DeclLocal ( ref local) => {
53
- let remainder_extent = CodeExtentData :: Remainder ( BlockRemainder {
54
- block : block_id,
55
- first_statement_index : index as u32 ,
56
- } ) ;
57
- let remainder_extent =
58
- cx. tcx . region_maps . lookup_code_extent ( remainder_extent) ;
56
+ hir:: DeclLocal ( ref local) => {
57
+ let remainder_extent = CodeExtentData :: Remainder ( BlockRemainder {
58
+ block : block_id,
59
+ first_statement_index : index as u32 ,
60
+ } ) ;
61
+ let remainder_extent =
62
+ cx. tcx . region_maps . lookup_code_extent ( remainder_extent) ;
59
63
60
- let pattern = Pattern :: from_hir ( cx. tcx , & local. pat ) ;
61
- result. push ( StmtRef :: Mirror ( Box :: new ( Stmt {
62
- span : stmt. span ,
63
- kind : StmtKind :: Let {
64
- remainder_scope : remainder_extent,
65
- init_scope : cx. tcx . region_maps . node_extent ( id) ,
66
- pattern : pattern,
67
- initializer : local. init . to_ref ( ) ,
68
- } ,
69
- } ) ) ) ;
64
+ let pattern = Pattern :: from_hir ( cx. tcx , & local. pat ) ;
65
+ result. push ( StmtRef :: Mirror ( Box :: new ( Stmt {
66
+ span : stmt. span ,
67
+ kind : StmtKind :: Let {
68
+ remainder_scope : remainder_extent,
69
+ init_scope : cx. tcx . region_maps . node_extent ( id) ,
70
+ pattern : pattern,
71
+ initializer : local. init . to_ref ( ) ,
72
+ } ,
73
+ } ) ) ) ;
74
+ }
70
75
}
71
76
}
72
77
}
0 commit comments