From b473ce304f1d59036bc25fe5f65a22817c9d44fe Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Fri, 9 Aug 2013 17:28:27 -0700 Subject: [PATCH] rustc: Obey RUST_MIN_STACK env var A lot of people are hitting stack overflows in rustc. This will make it easier to experiment with stack size. --- src/librustc/rustc.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/librustc/rustc.rs b/src/librustc/rustc.rs index 369045500ad9b..625a4aec544da 100644 --- a/src/librustc/rustc.rs +++ b/src/librustc/rustc.rs @@ -319,7 +319,13 @@ pub fn monitor(f: ~fn(diagnostic::Emitter)) { let ch_capture = ch.clone(); let mut task_builder = task::task(); task_builder.supervised(); - task_builder.opts.stack_size = Some(STACK_SIZE); + + // XXX: Hacks on hacks. If the env is trying to override the stack size + // then *don't* set it explicitly. + if os::getenv("RUST_MIN_STACK").is_none() { + task_builder.opts.stack_size = Some(STACK_SIZE); + } + match do task_builder.try { let ch = ch_capture.clone(); let ch_capture = ch.clone();