Repository: rust
Issue: Low nproc ulimit causes compiler to crash
Labels: I-ICE,P-medium,T-compiler,C-bug

<!--
Thank you for finding an Internal Compiler Error! 🧊  If possible, try to provide
a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for
how to create smaller examples.

http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/

-->

### System
edit: I believe the core problem
```
-bash-4.2$ ulimit -u
100
```

CentOS Linux release 7.7.1908 (Core)

### Code
```rust
fn main() {
    println!("Hello, world!");
}
```

Fresh project, failing to build with dependency `mini-redis = "0.2.0"`

edit: this happens on any medium sized project. 

I've tried this fix from #69140 to no avail
```
[profile.dev]
codegen-units = 1

[profile.release]
codegen-units = 1
```



### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version --verbose`: 
```
-bash-4.2$ rustc --version --verbose
rustc 1.39.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.39.0
LLVM version: 7.0
```

### Error output

```
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }', src/libcore/result.rs:1165:5
```
Full error log (there's a lot of these errors https://pastebin.com/raw/j884m0Y9)

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Backtrace</strong></summary>
<p>

```
Caused by:
  Resource temporarily unavailable (os error 11)
warning: build failed, waiting for other jobs to finish...
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }', src/libcore/result.rs:1165:5
stack backtrace:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }', src/libcore/result.rs:1165:5
stack backtrace:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }', src/libcore/result.rs:1165:5
stack backtrace:
error: failed to run custom build command for `ryu v1.0.5`

Caused by:
  could not execute process `/home/simonc99/cs3700/mini_redis/target/debug/build/ryu-c5c767e5e3581cb1/build-script-build` (never executed)

Caused by:
  Resource temporarily unavailable (os error 11)
warning: build failed, waiting for other jobs to finish...
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: rustc_driver::report_ice
   6: std::panicking::rust_panic_with_hook
   7: std::panicking::continue_panic_fmt
   8: rust_begin_unwind
   9: core::panicking::panic_fmt
  10: core::result::unwrap_failed
  11: rustc_interface::util::spawn_thread_pool
  12: rustc_driver::run_compiler
  13: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  14: std::panicking::try::do_call
  15: __rust_maybe_catch_panic
  16: rustc_driver::catch_fatal_errors
  17: rustc_driver::main
  18: std::rt::lang_start::{{closure}}
  19: std::panicking::try::do_call
  20: __rust_maybe_catch_panic
  21: std::rt::lang_start_internal
  22: main
  23: __libc_start_main
  24: <unknown>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
```
Full backtrace https://pastebin.com/raw/nAKJNY44
</p>
</details>