Skip to content

Commit 9cc3d44

Browse files
committed
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.
2 parents 7008a95 + b70305f commit 9cc3d44

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/librustdoc/lib.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,14 @@ struct Output {
103103
}
104104

105105
pub fn main() {
106-
const STACK_SIZE: usize = 32_000_000; // 32MB
106+
let thread_stack_size: usize = if cfg!(target_os = "haiku") {
107+
16_000_000 // 16MB on Haiku
108+
} else {
109+
32_000_000 // 32MB on other platforms
110+
};
107111
rustc_driver::set_sigpipe_handler();
108112
env_logger::init();
109-
let res = std::thread::Builder::new().stack_size(STACK_SIZE).spawn(move || {
113+
let res = std::thread::Builder::new().stack_size(thread_stack_size).spawn(move || {
110114
syntax::with_globals(move || {
111115
get_args().map(|args| main_args(&args)).unwrap_or(1)
112116
})

0 commit comments

Comments
 (0)