Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub struct Session {
pub type_length_limit: Once<usize>,

/// The maximum number of stackframes allowed in const eval
pub const_eval_stack_frame_limit: usize,
pub const_eval_stack_frame_limit: LockCell<usize>,

/// The metadata::creader module may inject an allocator/panic_runtime
/// dependency if it didn't already find one, and this tracks what was
Expand Down Expand Up @@ -1159,7 +1159,7 @@ pub fn build_session_(
features: Once::new(),
recursion_limit: Once::new(),
type_length_limit: Once::new(),
const_eval_stack_frame_limit: 100,
const_eval_stack_frame_limit: LockCell::new(100),
next_node_id: OneThread::new(Cell::new(NodeId::from_u32(1))),
allocator_kind: Once::new(),
injected_panic_runtime: Once::new(),
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/interpret/eval_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc
debug!("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.const_eval_stack_frame_limit.get() {
err!(StackFrameLimitReached)
} else {
Ok(())
Expand Down