Skip to content

Commit 16b5f24

Browse files
committed
rename BlockInfo and BlockInfoVisitor to DefsUses
1 parent 9a47fd2 commit 16b5f24

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/librustc_mir/util/liveness.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,12 @@ use std::io::{self, Write};
4848
pub type LocalSet = IdxSetBuf<Local>;
4949

5050
#[derive(Eq, PartialEq, Clone)]
51-
struct BlockInfo {
51+
struct DefsUses {
5252
defs: LocalSet,
5353
uses: LocalSet,
5454
}
5555

56-
struct BlockInfoVisitor {
57-
defs: LocalSet,
58-
uses: LocalSet,
59-
}
60-
61-
impl BlockInfoVisitor {
56+
impl DefsUses {
6257
fn add_def(&mut self, index: Local) {
6358
// If it was used already in the block, remove that use
6459
// now that we found a definition.
@@ -89,7 +84,7 @@ impl BlockInfoVisitor {
8984
}
9085
}
9186

92-
impl<'tcx> Visitor<'tcx> for BlockInfoVisitor {
87+
impl<'tcx> Visitor<'tcx> for DefsUses {
9388
fn visit_local(&mut self,
9489
&local: &Local,
9590
context: LvalueContext<'tcx>,
@@ -142,8 +137,8 @@ impl<'tcx> Visitor<'tcx> for BlockInfoVisitor {
142137
}
143138
}
144139

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 {
147142
defs: LocalSet::new_empty(locals),
148143
uses: LocalSet::new_empty(locals),
149144
};
@@ -157,10 +152,7 @@ fn block<'tcx>(b: &BasicBlockData<'tcx>, locals: usize) -> BlockInfo {
157152
visitor.visit_statement(BasicBlock::new(0), statement, dummy_location);
158153
}
159154

160-
BlockInfo {
161-
defs: visitor.defs,
162-
uses: visitor.uses,
163-
}
155+
visitor
164156
}
165157

166158
// This gives the result of the liveness analysis at the boundary of basic blocks

0 commit comments

Comments
 (0)