rustc_driver: get rid of extra thread on Windows

This commit is contained in:
Tatsuyuki Ishi 2018-03-06 13:33:36 +09:00
parent e85c9227c2
commit 1bb89f1b3c
2 changed files with 14 additions and 1 deletions

View File

@ -1488,7 +1488,11 @@ pub fn in_rustc_thread<F, R>(f: F) -> Result<R, Box<Any + Send>>
}
};
#[cfg(not(unix))]
// We set the stack size at link time. See src/rustc/rustc.rs.
#[cfg(windows)]
let spawn_thread = false;
#[cfg(not(any(windows,unix)))]
let spawn_thread = true;
// The or condition is added from backward compatibility.

View File

@ -9,6 +9,15 @@
// except according to those terms.
#![feature(rustc_private)]
#![feature(link_args)]
// Set the stack size at link time on Windows. See rustc_driver::in_rustc_thread
// for the rationale.
#[cfg_attr(all(windows, target_env = "msvc"), link_args = "/STACK:16777216")]
// We only build for msvc and gnu now, but we use a exhaustive condition here
// so we can expect either the stack size to be set or the build fails.
#[cfg_attr(all(windows, not(target_env = "msvc")), link_args = "-Wl,--stack,16777216")]
extern {}
extern crate rustc_driver;