Address review comments
This commit is contained in:
parent
1e71862046
commit
8902ce5d84
2 changed files with 11 additions and 7 deletions
|
@ -362,12 +362,16 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
|
||||||
fn gather_terminator(&mut self, term: &Terminator<'tcx>) {
|
fn gather_terminator(&mut self, term: &Terminator<'tcx>) {
|
||||||
match term.kind {
|
match term.kind {
|
||||||
TerminatorKind::Goto { target: _ }
|
TerminatorKind::Goto { target: _ }
|
||||||
|
| TerminatorKind::FalseEdges { .. }
|
||||||
|
| TerminatorKind::FalseUnwind { .. }
|
||||||
|
// In some sense returning moves the return place into the current
|
||||||
|
// call's destination, however, since there are no statements after
|
||||||
|
// this that could possibly access the return place, this doesn't
|
||||||
|
// need recording.
|
||||||
| TerminatorKind::Return
|
| TerminatorKind::Return
|
||||||
| TerminatorKind::Resume
|
| TerminatorKind::Resume
|
||||||
| TerminatorKind::Abort
|
| TerminatorKind::Abort
|
||||||
| TerminatorKind::GeneratorDrop
|
| TerminatorKind::GeneratorDrop
|
||||||
| TerminatorKind::FalseEdge { .. }
|
|
||||||
| TerminatorKind::FalseUnwind { .. }
|
|
||||||
| TerminatorKind::Unreachable => {}
|
| TerminatorKind::Unreachable => {}
|
||||||
|
|
||||||
TerminatorKind::Assert { ref cond, .. } => {
|
TerminatorKind::Assert { ref cond, .. } => {
|
||||||
|
|
|
@ -69,7 +69,7 @@ scheduled in a [DropTree]. Later, before `in_breakable_scope` exits, the drops
|
||||||
will be added to the CFG.
|
will be added to the CFG.
|
||||||
|
|
||||||
Panics are handled in a similar fashion, except that the drops are added to the
|
Panics are handled in a similar fashion, except that the drops are added to the
|
||||||
mir once the rest of the function has finished being lowered. If a terminator
|
MIR once the rest of the function has finished being lowered. If a terminator
|
||||||
can panic, call `diverge_from(block)` with the block containing the terminator
|
can panic, call `diverge_from(block)` with the block containing the terminator
|
||||||
`block`.
|
`block`.
|
||||||
|
|
||||||
|
@ -285,8 +285,8 @@ impl DropTree {
|
||||||
blocks: &mut IndexVec<DropIdx, Option<BasicBlock>>,
|
blocks: &mut IndexVec<DropIdx, Option<BasicBlock>>,
|
||||||
) {
|
) {
|
||||||
// StorageDead statements can share blocks with each other and also with
|
// StorageDead statements can share blocks with each other and also with
|
||||||
// a Drop terminator. We iterate through the blocks to find which blocks
|
// a Drop terminator. We iterate through the drops to find which drops
|
||||||
// need
|
// need their own block.
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
enum Block {
|
enum Block {
|
||||||
// This drop is unreachable
|
// This drop is unreachable
|
||||||
|
@ -295,7 +295,7 @@ impl DropTree {
|
||||||
// specified index.
|
// specified index.
|
||||||
Shares(DropIdx),
|
Shares(DropIdx),
|
||||||
// This drop has more than one way of being reached, or it is
|
// This drop has more than one way of being reached, or it is
|
||||||
// branched to from outside the tree, or it's predecessor is a
|
// branched to from outside the tree, or its predecessor is a
|
||||||
// `Value` drop.
|
// `Value` drop.
|
||||||
Own,
|
Own,
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ impl DropTree {
|
||||||
needs_block[ROOT_NODE] = Block::Own;
|
needs_block[ROOT_NODE] = Block::Own;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort so that we only need to check the last
|
// Sort so that we only need to check the last value.
|
||||||
let entry_points = &mut self.entry_points;
|
let entry_points = &mut self.entry_points;
|
||||||
entry_points.sort();
|
entry_points.sort();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue