From 4ad22b91fc9811e37359a2024b6df04b6b2d5352 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Thu, 7 Sep 2023 15:45:25 +0000 Subject: [PATCH] Correct comment and assumption. --- compiler/rustc_mir_dataflow/src/value_analysis.rs | 11 +++++------ 1 file 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 b5f39f1a9d547..299bf692307ab 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.