1
Fork 0

Use recursion_limit for const eval stack limit

This commit is contained in:
cad97 2019-11-24 21:09:37 -05:00
parent 9081929d45
commit 52426ab42d
No known key found for this signature in database
GPG key ID: 5DA0F1242D22B9C8
2 changed files with 1 additions and 5 deletions

View file

@ -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,

View file

@ -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(())