about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2020-05-08 20:00:32 +0100
committerAaron Hill <aa1ronham@gmail.com>2020-10-04 07:54:02 -0400
commit8902ce5d848f0b58f02b72725f195ec9022449a6 (patch)
treea30022894bb299e866173b1133be86c6a3a5b957 /compiler
parent1e71862046bdea989e4a25c266b2df768cb4f0bb (diff)
downloadrust-8902ce5d848f0b58f02b72725f195ec9022449a6.tar.gz
rust-8902ce5d848f0b58f02b72725f195ec9022449a6.zip
Address review comments
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_mir/src/dataflow/move_paths/builder.rs8
-rw-r--r--compiler/rustc_mir_build/src/build/scope.rs10
2 files changed, 11 insertions, 7 deletions
diff --git a/compiler/rustc_mir/src/dataflow/move_paths/builder.rs b/compiler/rustc_mir/src/dataflow/move_paths/builder.rs
index 1f232554bf1..3e45061a9cd 100644
--- a/compiler/rustc_mir/src/dataflow/move_paths/builder.rs
+++ b/compiler/rustc_mir/src/dataflow/move_paths/builder.rs
@@ -362,12 +362,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::FalseEdge { .. }
-            | TerminatorKind::FalseUnwind { .. }
             | TerminatorKind::Unreachable => {}
 
             TerminatorKind::Assert { ref cond, .. } => {
diff --git a/compiler/rustc_mir_build/src/build/scope.rs b/compiler/rustc_mir_build/src/build/scope.rs
index 4cb4b5e3f9d..65d3d2595a5 100644
--- a/compiler/rustc_mir_build/src/build/scope.rs
+++ b/compiler/rustc_mir_build/src/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`.
 
@@ -285,8 +285,8 @@ impl DropTree {
         blocks: &mut IndexVec<DropIdx, Option<BasicBlock>>,
     ) {
         // 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
@@ -295,7 +295,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,
         }
@@ -308,7 +308,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();