about summary refs log tree commit diff
diff options
context:
space:
mode:
authorcad97 <cad97@cad97.com>2019-11-24 21:09:37 -0500
committercad97 <cad97@cad97.com>2019-11-29 22:49:39 -0500
commit52426ab42dffadfcaec7d1eb4afa4d63cca11593 (patch)
tree5ab3ff3af2ad6017c1fbfa2cc40ee8a0494e6191
parent9081929d45f12d3f56d43b1d6db7519981580fc9 (diff)
downloadrust-52426ab42dffadfcaec7d1eb4afa4d63cca11593.tar.gz
rust-52426ab42dffadfcaec7d1eb4afa4d63cca11593.zip
Use recursion_limit for const eval stack limit
-rw-r--r--src/librustc/session/mod.rs4
-rw-r--r--src/librustc_mir/interpret/eval_context.rs2
2 files changed, 1 insertions, 5 deletions
diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs
index 0b9d04ca6a3..c6c5f3b68df 100644
--- a/src/librustc/session/mod.rs
+++ b/src/librustc/session/mod.rs
@@ -95,9 +95,6 @@ pub struct Session {
     /// The maximum length of types during monomorphization.
     pub type_length_limit: Once<usize>,
 
-    /// The maximum number of stackframes allowed in const eval.
-    pub const_eval_stack_frame_limit: usize,
-
     /// Map from imported macro spans (which consist of
     /// the localized span for the macro body) to the
     /// macro name and definition span in the source crate.
@@ -1159,7 +1156,6 @@ fn build_session_(
         features: Once::new(),
         recursion_limit: Once::new(),
         type_length_limit: Once::new(),
-        const_eval_stack_frame_limit: 100,
         imported_macro_spans: OneThread::new(RefCell::new(FxHashMap::default())),
         incr_comp_session: OneThread::new(RefCell::new(IncrCompSession::NotInitialized)),
         cgu_reuse_tracker,
diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs
index 626e81fa911..228e5cad4e3 100644
--- a/src/librustc_mir/interpret/eval_context.rs
+++ b/src/librustc_mir/interpret/eval_context.rs
@@ -548,7 +548,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
 
         info!("ENTERING({}) {}", self.cur_frame(), self.frame().instance);
 
-        if self.stack.len() > self.tcx.sess.const_eval_stack_frame_limit {
+        if self.stack.len() > *self.tcx.sess.recursion_limit.get() {
             throw_exhaust!(StackFrameLimitReached)
         } else {
             Ok(())