diff options
| -rw-r--r-- | src/librustc_mir/util/liveness.rs | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/librustc_mir/util/liveness.rs b/src/librustc_mir/util/liveness.rs index b9d90051b85..d0a37e8a224 100644 --- a/src/librustc_mir/util/liveness.rs +++ b/src/librustc_mir/util/liveness.rs @@ -48,17 +48,12 @@ use std::io::{self, Write}; pub type LocalSet = IdxSetBuf<Local>; #[derive(Eq, PartialEq, Clone)] -struct BlockInfo { +struct DefsUses { defs: LocalSet, uses: LocalSet, } -struct BlockInfoVisitor { - defs: LocalSet, - uses: LocalSet, -} - -impl BlockInfoVisitor { +impl DefsUses { fn add_def(&mut self, index: Local) { // If it was used already in the block, remove that use // now that we found a definition. @@ -89,7 +84,7 @@ impl BlockInfoVisitor { } } -impl<'tcx> Visitor<'tcx> for BlockInfoVisitor { +impl<'tcx> Visitor<'tcx> for DefsUses { fn visit_local(&mut self, &local: &Local, context: LvalueContext<'tcx>, @@ -142,8 +137,8 @@ impl<'tcx> Visitor<'tcx> for BlockInfoVisitor { } } -fn block<'tcx>(b: &BasicBlockData<'tcx>, locals: usize) -> BlockInfo { - let mut visitor = BlockInfoVisitor { +fn block<'tcx>(b: &BasicBlockData<'tcx>, locals: usize) -> DefsUses { + let mut visitor = DefsUses { defs: LocalSet::new_empty(locals), uses: LocalSet::new_empty(locals), }; @@ -157,10 +152,7 @@ fn block<'tcx>(b: &BasicBlockData<'tcx>, locals: usize) -> BlockInfo { visitor.visit_statement(BasicBlock::new(0), statement, dummy_location); } - BlockInfo { - defs: visitor.defs, - uses: visitor.uses, - } + visitor } // This gives the result of the liveness analysis at the boundary of basic blocks |
