Improve diagnose for unconditional panic when resource limit

This commit is contained in:
Binlogo
2025-10-29 21:21:25 +08:00
parent c6d42d774d
commit 5aa2a90724

View File

@@ -287,7 +287,15 @@ pub(crate) fn run_in_thread_pool_with_globals<
pool.install(|| f(current_gcx.into_inner(), proxy))
},
)
.unwrap()
.unwrap_or_else(|err| {
let mut diag = thread_builder_diag.early_struct_fatal(format!(
"failed to spawn compiler thread pool: could not create {threads} threads ({err})",
));
diag.help(
"try lowering `-Z threads` or checking the operating system's resource limits",
);
diag.emit();
})
})
})
}