Skip to content

Commit 5912a69

Browse files
committed
Auto merge of #56467 - oli-obk:osx_stack_bump, r=nagisa
Bump stack size to 32MB cc #55471 A short term solution (really this time! Full fix being grown in #55617) for stack overflows due to deeply recursive syntax trees. r? @nagisa cc @alexcrichton @eddyb @michaelwoerister @pietroalbini
2 parents c8ae2de + db64f60 commit 5912a69

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/librustc_driver/driver.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub fn spawn_thread_pool<F: FnOnce(config::Options) -> R + sync::Send, R: sync::
9191
let config = ThreadPoolBuilder::new()
9292
.num_threads(Session::query_threads_from_opts(&opts))
9393
.deadlock_handler(|| unsafe { ty::query::handle_deadlock() })
94-
.stack_size(16 * 1024 * 1024);
94+
.stack_size(::STACK_SIZE);
9595

9696
let with_pool = move |pool: &ThreadPool| {
9797
pool.install(move || f(opts))

src/librustc_driver/lib.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,11 @@ fn parse_crate_attrs<'a>(sess: &'a Session, input: &Input) -> PResult<'a, Vec<as
14681468
}
14691469
}
14701470

1471+
// Temporarily have stack size set to 32MB to deal with various crates with long method
1472+
// chains or deep syntax trees.
1473+
// FIXME(oli-obk): get https://github.com/rust-lang/rust/pull/55617 the finish line
1474+
const STACK_SIZE: usize = 32 * 1024 * 1024; // 32MB
1475+
14711476
/// Runs `f` in a suitable thread for running `rustc`; returns a `Result` with either the return
14721477
/// value of `f` or -- if a panic occurs -- the panic value.
14731478
///
@@ -1477,9 +1482,6 @@ pub fn in_named_rustc_thread<F, R>(name: String, f: F) -> Result<R, Box<dyn Any
14771482
where F: FnOnce() -> R + Send + 'static,
14781483
R: Send + 'static,
14791484
{
1480-
// Temporarily have stack size set to 16MB to deal with nom-using crates failing
1481-
const STACK_SIZE: usize = 16 * 1024 * 1024; // 16MB
1482-
14831485
#[cfg(all(unix, not(target_os = "haiku")))]
14841486
let spawn_thread = unsafe {
14851487
// Fetch the current resource limits

0 commit comments

Comments
 (0)