From b998497bd41d6de71ec035433247dee856d1f3a5 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Fri, 8 May 2020 20:00:32 +0100 Subject: [PATCH] Address review comments --- src/librustc_mir/dataflow/move_paths/builder.rs | 8 ++++++-- src/librustc_mir_build/build/scope.rs | 10 +++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/librustc_mir/dataflow/move_paths/builder.rs b/src/librustc_mir/dataflow/move_paths/builder.rs index 8f14c48e6dd00..ffe84e9b65512 100644 --- a/src/librustc_mir/dataflow/move_paths/builder.rs +++ b/src/librustc_mir/dataflow/move_paths/builder.rs @@ -361,12 +361,16 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> { fn gather_terminator(&mut self, term: &Terminator<'tcx>) { match term.kind { 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::Resume | TerminatorKind::Abort | TerminatorKind::GeneratorDrop - | TerminatorKind::FalseEdges { .. } - | TerminatorKind::FalseUnwind { .. } | TerminatorKind::Unreachable => {} TerminatorKind::Assert { ref cond, .. } => { diff --git a/src/librustc_mir_build/build/scope.rs b/src/librustc_mir_build/build/scope.rs index a3953d4ace3ed..710a41bc8fdb5 100644 --- a/src/librustc_mir_build/build/scope.rs +++ b/src/librustc_mir_build/build/scope.rs @@ -69,7 +69,7 @@ scheduled in a [DropTree]. Later, before `in_breakable_scope` exits, the drops will be added to the CFG. 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 `block`. @@ -284,8 +284,8 @@ impl DropTree { blocks: &mut IndexVec>, ) { // StorageDead statements can share blocks with each other and also with - // a Drop terminator. We iterate through the blocks to find which blocks - // need + // a Drop terminator. We iterate through the drops to find which drops + // need their own block. #[derive(Clone, Copy)] enum Block { // This drop is unreachable @@ -294,7 +294,7 @@ impl DropTree { // specified index. Shares(DropIdx), // 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. Own, } @@ -307,7 +307,7 @@ impl DropTree { 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; entry_points.sort();