about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-06-26 18:55:09 +0000
committerbors <bors@rust-lang.org>2018-06-26 18:55:09 +0000
commit9cc3d44b935fb97f19fed4395861cbc8d6bba0e4 (patch)
tree4504cdd01ac33a7d9107ca5fc19c101c7f5deaa7 /src
parent7008a953ebb0114ceeb16f4a08177dc7c92c5d42 (diff)
parentb70305fc32ed92995c5be0937df864c2c5eae5f6 (diff)
downloadrust-9cc3d44b935fb97f19fed4395861cbc8d6bba0e4.tar.gz
rust-9cc3d44b935fb97f19fed4395861cbc8d6bba0e4.zip
Auto merge of #51756 - nielx:fix/librustdoc, r=GuillaumeGomez
Haiku: set stack size to 16 MB on Haiku, use 32 MB on other platforms

The maximum stack size on Haiku is set to 16 MB (see [the Haiku source](https://git.haiku-os.org/haiku/tree/headers/private/system/thread_defs.h#n17)). With this change rustdoc will also work on Haiku.
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/lib.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 566e2f1ed49..284406589b3 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -103,10 +103,14 @@ struct Output {
 }
 
 pub fn main() {
-    const STACK_SIZE: usize = 32_000_000; // 32MB
+    let thread_stack_size: usize = if cfg!(target_os = "haiku") {
+        16_000_000 // 16MB on Haiku
+    } else {
+        32_000_000 // 32MB on other platforms
+    };
     rustc_driver::set_sigpipe_handler();
     env_logger::init();
-    let res = std::thread::Builder::new().stack_size(STACK_SIZE).spawn(move || {
+    let res = std::thread::Builder::new().stack_size(thread_stack_size).spawn(move || {
         syntax::with_globals(move || {
             get_args().map(|args| main_args(&args)).unwrap_or(1)
         })