about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-09-07 15:45:25 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-09-07 15:45:25 +0000
commit4ad22b91fc9811e37359a2024b6df04b6b2d5352 (patch)
tree1408c7d910394606d2234bfd2dcf1a533d4fd497
parentf96c6e04cb93459513e3d10626e4a3290fb6e8a0 (diff)
downloadrust-4ad22b91fc9811e37359a2024b6df04b6b2d5352.tar.gz
rust-4ad22b91fc9811e37359a2024b6df04b6b2d5352.zip
Correct comment and assumption.
-rw-r--r--compiler/rustc_mir_dataflow/src/value_analysis.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/compiler/rustc_mir_dataflow/src/value_analysis.rs b/compiler/rustc_mir_dataflow/src/value_analysis.rs
index b5f39f1a9d5..299bf692307 100644
--- a/compiler/rustc_mir_dataflow/src/value_analysis.rs
+++ b/compiler/rustc_mir_dataflow/src/value_analysis.rs
@@ -752,7 +752,7 @@ impl Map {
             let old = self.projections.insert((place, TrackElem::Discriminant), discr);
             assert!(old.is_none());
 
-            // Allocate a value slot if it doesn't have one.
+            // Allocate a value slot since it doesn't have one.
             assert!(self.places[discr].value_index.is_none());
             self.places[discr].value_index = Some(self.value_count.into());
             self.value_count += 1;
@@ -769,11 +769,10 @@ impl Map {
             let old = self.projections.insert((place, TrackElem::DerefLen), len);
             assert!(old.is_none());
 
-            // Allocate a value slot if it doesn't have one.
-            if self.places[len].value_index.is_none() {
-                self.places[len].value_index = Some(self.value_count.into());
-                self.value_count += 1;
-            }
+            // Allocate a value slot since it doesn't have one.
+            assert!( self.places[len].value_index.is_none() );
+            self.places[len].value_index = Some(self.value_count.into());
+            self.value_count += 1;
         }
 
         // Recurse with all fields of this place.