From ccc1da247bf3be7e71932844484847da6e35f185 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Mon, 8 May 2023 08:48:16 +0000 Subject: [PATCH] Prevent stack overflow. --- compiler/rustc_mir_dataflow/src/value_analysis.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_mir_dataflow/src/value_analysis.rs b/compiler/rustc_mir_dataflow/src/value_analysis.rs index 9232ea74d3692..b74d06e5ae8dd 100644 --- a/compiler/rustc_mir_dataflow/src/value_analysis.rs +++ b/compiler/rustc_mir_dataflow/src/value_analysis.rs @@ -37,6 +37,7 @@ use std::fmt::{Debug, Formatter}; use std::ops::Range; use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_index::bit_set::BitSet; use rustc_index::{IndexSlice, IndexVec}; use rustc_middle::mir::visit::{MutatingUseContext, PlaceContext, Visitor}; @@ -774,7 +775,7 @@ impl Map { // We manually iterate instead of using `children` as we need to mutate `self`. let mut next_child = self.places[root].first_child; while let Some(child) = next_child { - self.cache_preorder_invoke(child); + ensure_sufficient_stack(|| self.cache_preorder_invoke(child)); next_child = self.places[child].next_sibling; }