Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 25d8366

Browse files
committed
Limit recursion in terms of places.
1 parent 25f8d01 commit 25d8366

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

compiler/rustc_mir_dataflow/src/value_analysis.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ impl Map {
720720
/// This is currently the only way to create a [`Map`]. The way in which the tracked places are
721721
/// chosen is an implementation detail and may not be relied upon (other than that their type
722722
/// are scalars).
723-
pub fn new<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>, value_limit: Option<usize>) -> Self {
723+
pub fn new<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>, place_limit: Option<usize>) -> Self {
724724
let mut map = Self {
725725
locals: IndexVec::new(),
726726
projections: FxHashMap::default(),
@@ -730,7 +730,7 @@ impl Map {
730730
inner_values_buffer: Vec::new(),
731731
};
732732
let exclude = excluded_locals(body);
733-
map.register(tcx, body, exclude, value_limit);
733+
map.register(tcx, body, exclude, place_limit);
734734
debug!("registered {} places ({} nodes in total)", map.value_count, map.places.len());
735735
map
736736
}
@@ -741,9 +741,9 @@ impl Map {
741741
tcx: TyCtxt<'tcx>,
742742
body: &Body<'tcx>,
743743
exclude: BitSet<Local>,
744-
value_limit: Option<usize>,
744+
place_limit: Option<usize>,
745745
) {
746-
let mut worklist = VecDeque::with_capacity(value_limit.unwrap_or(body.local_decls.len()));
746+
let mut worklist = VecDeque::with_capacity(place_limit.unwrap_or(body.local_decls.len()));
747747
let param_env = tcx.param_env_reveal_all_normalized(body.source.def_id());
748748

749749
// Start by constructing the places for each bare local.
@@ -766,8 +766,8 @@ impl Map {
766766
// `elem1` is either `Some(Variant(i))` or `None`.
767767
while let Some((mut place, elem1, elem2, ty)) = worklist.pop_front() {
768768
// The user requires a bound on the number of created values.
769-
if let Some(value_limit) = value_limit
770-
&& self.value_count >= value_limit
769+
if let Some(place_limit) = place_limit
770+
&& self.places.len() >= place_limit
771771
{
772772
break;
773773
}

0 commit comments

Comments
 (0)