Repository: rust
Issue: Triple panic when no space left on device
Labels: I-ICE,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/

-->

### Code

```Rust
// I don't think the code is relevant.
```


### 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`:
```
rustc 1.57.0 (f1edd0429 2021-11-29)
binary: rustc
commit-hash: f1edd0429582dd29cccacaf50fd134b05593bd9c
commit-date: 2021-11-29
host: x86_64-unknown-linux-gnu
release: 1.57.0
LLVM version: 13.0.0
<version>

Afraid I can't test this on another version as I have already recovered the disk space. FYI this happened on AWS.
```



```
thread 'opt 44x51xau9vv6hyly' panicked at 'Error writing pre-lto-bitcode file `/home/ec2-user/ttgv/target/release/incremental/ttgv-3s7phrfcq65zj/s-g5x0a8jcj3-b6wxlq-working/44x51xau9vv6hyly.pre-lto.bc`: No space left on device (os error 28)', /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/compiler/rustc_codegen_ssa/src/back/write.rs:831:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.57.0 (f1edd0429 2021-11-29) running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 -C embed-bitcode=no -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
thread '<unnamed>' panicked at '/rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/compiler/rustc_codegen_ssa/src/back/write.rs:1509:21: worker thread panicked', compiler/rustc_middle/src/util/bug.rs:35:26

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.57.0 (f1edd0429 2021-11-29) running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 -C embed-bitcode=no -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: failed to write query cache to `/home/ec2-user/ttgv/target/release/incremental/ttgv-3s7phrfcq65zj/s-g5x0a8jcj3-b6wxlq-working/query-cache.bin`: No space left on device (os error 28)

error: failed to write dependency graph to `/home/ec2-user/ttgv/target/release/incremental/ttgv-3s7phrfcq65zj/s-g5x0a8jcj3-b6wxlq-working/dep-graph.part.bin`: No space left on device (os error 28)

thread 'rustc' panicked at '/rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/compiler/rustc_codegen_ssa/src/back/write.rs:1824:17: panic during codegen/LLVM phase', compiler/rustc_middle/src/util/bug.rs:35:26

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.57.0 (f1edd0429 2021-11-29) running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 -C embed-bitcode=no -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
```

<!--
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>

```
not available for this problem
```

</p>
</details>