Skip to content

Commit 52426ab

Browse files
committed
Use recursion_limit for const eval stack limit
1 parent 9081929 commit 52426ab

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

src/librustc/session/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ pub struct Session {
9595
/// The maximum length of types during monomorphization.
9696
pub type_length_limit: Once<usize>,
9797

98-
/// The maximum number of stackframes allowed in const eval.
99-
pub const_eval_stack_frame_limit: usize,
100-
10198
/// Map from imported macro spans (which consist of
10299
/// the localized span for the macro body) to the
103100
/// macro name and definition span in the source crate.
@@ -1159,7 +1156,6 @@ fn build_session_(
11591156
features: Once::new(),
11601157
recursion_limit: Once::new(),
11611158
type_length_limit: Once::new(),
1162-
const_eval_stack_frame_limit: 100,
11631159
imported_macro_spans: OneThread::new(RefCell::new(FxHashMap::default())),
11641160
incr_comp_session: OneThread::new(RefCell::new(IncrCompSession::NotInitialized)),
11651161
cgu_reuse_tracker,

src/librustc_mir/interpret/eval_context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
548548

549549
info!("ENTERING({}) {}", self.cur_frame(), self.frame().instance);
550550

551-
if self.stack.len() > self.tcx.sess.const_eval_stack_frame_limit {
551+
if self.stack.len() > *self.tcx.sess.recursion_limit.get() {
552552
throw_exhaust!(StackFrameLimitReached)
553553
} else {
554554
Ok(())

0 commit comments

Comments
 (0)