@@ -48,17 +48,12 @@ use std::io::{self, Write};
48
48
pub type LocalSet = IdxSetBuf < Local > ;
49
49
50
50
#[ derive( Eq , PartialEq , Clone ) ]
51
- struct BlockInfo {
51
+ struct DefsUses {
52
52
defs : LocalSet ,
53
53
uses : LocalSet ,
54
54
}
55
55
56
- struct BlockInfoVisitor {
57
- defs : LocalSet ,
58
- uses : LocalSet ,
59
- }
60
-
61
- impl BlockInfoVisitor {
56
+ impl DefsUses {
62
57
fn add_def ( & mut self , index : Local ) {
63
58
// If it was used already in the block, remove that use
64
59
// now that we found a definition.
@@ -89,7 +84,7 @@ impl BlockInfoVisitor {
89
84
}
90
85
}
91
86
92
- impl < ' tcx > Visitor < ' tcx > for BlockInfoVisitor {
87
+ impl < ' tcx > Visitor < ' tcx > for DefsUses {
93
88
fn visit_local ( & mut self ,
94
89
& local: & Local ,
95
90
context : LvalueContext < ' tcx > ,
@@ -142,8 +137,8 @@ impl<'tcx> Visitor<'tcx> for BlockInfoVisitor {
142
137
}
143
138
}
144
139
145
- fn block < ' tcx > ( b : & BasicBlockData < ' tcx > , locals : usize ) -> BlockInfo {
146
- let mut visitor = BlockInfoVisitor {
140
+ fn block < ' tcx > ( b : & BasicBlockData < ' tcx > , locals : usize ) -> DefsUses {
141
+ let mut visitor = DefsUses {
147
142
defs : LocalSet :: new_empty ( locals) ,
148
143
uses : LocalSet :: new_empty ( locals) ,
149
144
} ;
@@ -157,10 +152,7 @@ fn block<'tcx>(b: &BasicBlockData<'tcx>, locals: usize) -> BlockInfo {
157
152
visitor. visit_statement ( BasicBlock :: new ( 0 ) , statement, dummy_location) ;
158
153
}
159
154
160
- BlockInfo {
161
- defs : visitor. defs ,
162
- uses : visitor. uses ,
163
- }
155
+ visitor
164
156
}
165
157
166
158
// This gives the result of the liveness analysis at the boundary of basic blocks
0 commit comments