Skip to content

Commit 5aa2a90

Browse files
committed
Improve diagnose for unconditional panic when resource limit
1 parent c6d42d7 commit 5aa2a90

File tree

1 file changed

+9
-1
lines changed
  • compiler/rustc_interface/src

1 file changed

+9
-1
lines changed

compiler/rustc_interface/src/util.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,15 @@ pub(crate) fn run_in_thread_pool_with_globals<
287287
pool.install(|| f(current_gcx.into_inner(), proxy))
288288
},
289289
)
290-
.unwrap()
290+
.unwrap_or_else(|err| {
291+
let mut diag = thread_builder_diag.early_struct_fatal(format!(
292+
"failed to spawn compiler thread pool: could not create {threads} threads ({err})",
293+
));
294+
diag.help(
295+
"try lowering `-Z threads` or checking the operating system's resource limits",
296+
);
297+
diag.emit();
298+
})
291299
})
292300
})
293301
}

0 commit comments

Comments
 (0)