Repository: rust
Issue: ICE: worker thread panicked
Labels: A-codegen,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
<code>
```


### 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`:
```
<version>
```

### Error output

```
<output>
```

<!--
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>

```
/rustc/478cbb42b730ba4739351b72ce2aa928e78e2f81\compiler\rustc_codegen_ssa\src\back\write.rs:895:45
   0:     0x7ffe70b96c12 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd75c3f04cc3d2edf
   1:     0x7ffe70bd50db - core::fmt::write::h6fb46417812deaa1
   2:     0x7ffe70b8be0a - <std::io::IoSlice as core::fmt::Debug>::fmt::h6c53e9540981061a
   3:     0x7ffe70b9695b - std::sys::common::alloc::realloc_fallback::h13645655f7eb0e11
   4:     0x7ffe70b9a2ea - std::panicking::default_hook::hc3275e3c5013d8e7
   5:     0x7ffe70b99f50 - std::panicking::default_hook::hc3275e3c5013d8e7
   6:     0x7ffe19f718fe - rustc_driver_impl[3d9e4f6ecc33343e]::describe_lints
   7:     0x7ffe70b9abff - std::panicking::rust_panic_with_hook::h2192e5b590c4ddf1
   8:     0x7ffe70b9a95e - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::hecff3939183418be
   9:     0x7ffe70b978b9 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd75c3f04cc3d2edf
  10:     0x7ffe70b9a670 - rust_begin_unwind
  11:     0x7ffe70c09105 - core::panicking::panic_fmt::h8f4a81d083fb03b9
  12:     0x7ffe70c090c2 - core::option::expect_failed::h26ac361666593f8e
  13:     0x7ffe178387aa - <rustc_codegen_llvm[44c0b767fe3c7edd]::ModuleLlvm as core[679fd38775683198]::ops::drop::Drop>::drop
  14:     0x7ffe1784bebd - <rustc_codegen_llvm[44c0b767fe3c7edd]::llvm_::ffi::Type>::i8p_llcx
  15:     0x7ffe70bacb4c - std::sys::windows::thread::Thread::new::ha9b577ebad399c47
  16:     0x7ffea1fc7614 - BaseThreadInitThunk
  17:     0x7ffea3d826a1 - RtlUserThreadStart

stack backtrace:
   0:     0x7ffe70b96c12 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd75c3f04cc3d2edf
   1:     0x7ffe70bd50db - core::fmt::write::h6fb46417812deaa1
   2:     0x7ffe70b8be0a - <std::io::IoSlice as core::fmt::Debug>::fmt::h6c53e9540981061a
   3:     0x7ffe70b9695b - std::sys::common::alloc::realloc_fallback::h13645655f7eb0e11
   4:     0x7ffe70b9a2ea - std::panicking::default_hook::hc3275e3c5013d8e7
   5:     0x7ffe70b99f50 - std::panicking::default_hook::hc3275e3c5013d8e7
   6:     0x7ffe19f718fe - rustc_driver_impl[3d9e4f6ecc33343e]::describe_lints
   7:     0x7ffe70b9abff - std::panicking::rust_panic_with_hook::h2192e5b590c4ddf1
   8:     0x7ffe70b9a95e - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::hecff3939183418be
   9:     0x7ffe70b978b9 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd75c3f04cc3d2edf
  10:     0x7ffe70b9a670 - rust_begin_unwind
  11:     0x7ffe70c09105 - core::panicking::panic_fmt::h8f4a81d083fb03b9
  12:     0x7ffe70c090c2 - core::option::expect_failed::h26ac361666593f8e
  13:     0x7ffe178387aa - <rustc_codegen_llvm[44c0b767fe3c7edd]::ModuleLlvm as core[679fd38775683198]::ops::drop::Drop>::drop
  14:     0x7ffe1784bebd - <rustc_codegen_llvm[44c0b767fe3c7edd]::llvm_::ffi::Type>::i8p_llcx
  15:     0x7ffe70bacb4c - std::sys::windows::thread::Thread::new::ha9b577ebad399c47
  16:     0x7ffea1fc7614 - BaseThreadInitThunk
  17:     0x7ffea3d826a1 - RtlUserThreadStart

error: 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.70.0-nightly (478cbb42b 2023-03-28) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
thread 'error<unnamed>' panicked at '/rustc/478cbb42b730ba4739351b72ce2aa928e78e2f81\compiler\rustc_codegen_ssa\src\back\write.rs:1535:21: worker thread panicked', compiler\rustc_middle\src\util\bug.rs: the compiler unexpectedly panicked. this is a bug.:
36:26

stack backtrace:
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

 0:    note : rustc 1.70.0-nightly (478cbb42b 2023-03-28) running on x86_64-pc-windows-msvc0x
7ffe70b96c12
 - <std::sys_common::backtrace::_print::DisplayBacktracenote: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]
 as core
::fmt::Displaynote>: some of the compiler flags provided by cargo are hidden::fmt::hd75c3f04cc3d2edf


query stack during panic:
end of query stack
   1:     0x7ffe70bd50db - core::fmt::write::h6fb46417812deaa1
   2:     0x7ffe70b8be0a - <std::io::IoSlice as core::fmt::Debug>::fmt::h6c53e9540981061a
   3:     0x7ffe70b9695b - std::sys::common::alloc::realloc_fallback::h13645655f7eb0e11
   4:     0x7ffe70b9a2ea - std::panicking::default_hook::hc3275e3c5013d8e7
   5:     0x7ffe70b99f50 - std::panicking::default_hook::hc3275e3c5013d8e7
   6:     0x7ffe19f718fe - rustc_driver_impl[3d9e4f6ecc33343e]::describe_lints
   7:     0x7ffe70b9abff - std::panicking::rust_panic_with_hook::h2192e5b590c4ddf1
   8:     0x7ffe1c496e9f - <rustc_middle[c88e177c6c40cbb5]::ty::print::pretty::ForceTrimmedGuard as core[679fd38775683198]::ops::drop::Drop>::drop
   9:     0x7ffe1c493e29 - <rustc_middle[c88e177c6c40cbb5]::ty::print::pretty::ForceTrimmedGuard as core[679fd38775683198]::ops::drop::Drop>::drop
  10:     0x7ffe1c493de3 - <rustc_middle[c88e177c6c40cbb5]::ty::print::pretty::ForceTrimmedGuard as core[679fd38775683198]::ops::drop::Drop>::drop
  11:     0x7ffe1c4898cd - rustc_middle[c88e177c6c40cbb5]::util::bug::bug_fmt
  12:     0x7ffe1c488c0d - <rustc_middle[c88e177c6c40cbb5]::ty::consts::kind::UnevaluatedConst as rustc_errors[3049d30e835b7e1]::diagnostic::IntoDiagnosticArg>::into_diagnostic_arg
  13:     0x7ffe1c488bb4 - <rustc_middle[c88e177c6c40cbb5]::ty::consts::kind::UnevaluatedConst as rustc_errors[3049d30e835b7e1]::diagnostic::IntoDiagnosticArg>::into_diagnostic_arg
  14:     0x7ffe1c489828 - rustc_middle[c88e177c6c40cbb5]::util::bug::bug_fmt
  15:     0x7ffe1c4897a5 - rustc_middle[c88e177c6c40cbb5]::util::bug::bug_fmt
  16:     0x7ffe17835a84 - <rustc_codegen_llvm[44c0b767fe3c7edd]::ModuleLlvm as core[679fd38775683198]::ops::drop::Drop>::drop
  17:     0x7ffe1784b97a - <rustc_codegen_llvm[44c0b767fe3c7edd]::llvm_::ffi::Type>::i8p_llcx
  18:     0x7ffe70bacb4c - std::sys::windows::thread::Thread::new::ha9b577ebad399c47
  19:     0x7ffea1fc7614 - BaseThreadInitThunk
  20:     0x7ffea3d826a1 - RtlUserThreadStart

error: 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.70.0-nightly (478cbb42b 2023-03-28) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
thread 'rustc' panicked at '/rustc/478cbb42b730ba4739351b72ce2aa928e78e2f81\compiler\rustc_codegen_ssa\src\back\write.rs:1893:17: panic during codegen/LLVM phase', compiler\rustc_middle\src\util\bug.rs:36:26
stack backtrace:
   0:     0x7ffe70b96c12 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd75c3f04cc3d2edf
   1:     0x7ffe70bd50db - core::fmt::write::h6fb46417812deaa1
   2:     0x7ffe70b8be0a - <std::io::IoSlice as core::fmt::Debug>::fmt::h6c53e9540981061a
   3:     0x7ffe70b9695b - std::sys::common::alloc::realloc_fallback::h13645655f7eb0e11
   4:     0x7ffe70b9a2ea - std::panicking::default_hook::hc3275e3c5013d8e7
   5:     0x7ffe70b99f50 - std::panicking::default_hook::hc3275e3c5013d8e7
   6:     0x7ffe19f718fe - rustc_driver_impl[3d9e4f6ecc33343e]::describe_lints
   7:     0x7ffe70b9abff - std::panicking::rust_panic_with_hook::h2192e5b590c4ddf1
   8:     0x7ffe1c496e9f - <rustc_middle[c88e177c6c40cbb5]::ty::print::pretty::ForceTrimmedGuard as core[679fd38775683198]::ops::drop::Drop>::drop
   9:     0x7ffe1c493e29 - <rustc_middle[c88e177c6c40cbb5]::ty::print::pretty::ForceTrimmedGuard as core[679fd38775683198]::ops::drop::Drop>::drop
  10:     0x7ffe1c493de3 - <rustc_middle[c88e177c6c40cbb5]::ty::print::pretty::ForceTrimmedGuard as core[679fd38775683198]::ops::drop::Drop>::drop
  11:     0x7ffe1c4898cd - rustc_middle[c88e177c6c40cbb5]::util::bug::bug_fmt
  12:     0x7ffe1c488c0d - <rustc_middle[c88e177c6c40cbb5]::ty::consts::kind::UnevaluatedConst as rustc_errors[3049d30e835b7e1]::diagnostic::IntoDiagnosticArg>::into_diagnostic_arg
  13:     0x7ffe1c488bb4 - <rustc_middle[c88e177c6c40cbb5]::ty::consts::kind::UnevaluatedConst as rustc_errors[3049d30e835b7e1]::diagnostic::IntoDiagnosticArg>::into_diagnostic_arg
  14:     0x7ffe1c489828 - rustc_middle[c88e177c6c40cbb5]::util::bug::bug_fmt
  15:     0x7ffe1c4897a5 - rustc_middle[c88e177c6c40cbb5]::util::bug::bug_fmt
  16:     0x7ffe1785e32a - <rustc_target[974bddc88c5a8d42]::abi::call::FnAbi<rustc_middle[c88e177c6c40cbb5]::ty::Ty> as rustc_codegen_llvm[44c0b767fe3c7edd]::abi::FnAbiLlvmExt>::ptr_to_llvm_type
  17:     0x7ffe1784577b - <rustc_codegen_llvm[44c0b767fe3c7edd]::ModuleLlvm as core[679fd38775683198]::ops::drop::Drop>::drop
  18:     0x7ffe178310d7 - <rustc_codegen_llvm[44c0b767fe3c7edd]::LlvmCodegenBackend as rustc_codegen_ssa[db47916f468474a9]::traits::backend::CodegenBackend>::join_codegen
  19:     0x7ffe177e874c - <rustc_interface[f87c1f15698afcab]::queries::Linker>::link
  20:     0x7ffe177b1e68 - rustc_driver_impl[3d9e4f6ecc33343e]::args::arg_expand_all
  21:     0x7ffe177a8563 - rustc_driver_impl[3d9e4f6ecc33343e]::main
  22:     0x7ffe177ce263 - rustc_driver_impl[3d9e4f6ecc33343e]::args::arg_expand_all
  23:     0x7ffe70bacb4c - std::sys::windows::thread::Thread::new::ha9b577ebad399c47
  24:     0x7ffea1fc7614 - BaseThreadInitThunk
  25:     0x7ffea3d826a1 - RtlUserThreadStart

error: 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.70.0-nightly (478cbb42b 2023-03-28) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

```

</p>
</details>