Repository: rust
Issue: ICE: `deadlock detected without any query`
Labels: I-ICE,T-compiler,C-bug,WG-compiler-parallel

<!--
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
mod assert {
    use std::mem::{Assume, BikeshedIntrinsicFrom};
    pub struct Context;

    pub fn is_maybe_transmutable<Src, Dst>(&self, cpu: &mut CPU)
    where
        Dst: BikeshedIntrinsicFrom<Src, Context>,
    {
    }
}

fn should_pad_explicitly_packed_field() {
    #[repr(C)]
    struct ExplicitlyPadded(ExplicitlyPadded);

    assert::is_maybe_transmutable::<ExplicitlyPadded, ()>();
}
```


### 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.78.0-nightly (256b6fb19 2024-02-06)
binary: rustc
commit-hash: 256b6fb19a2c018eaad4806d2369d1f6a71fc6ec
commit-date: 2024-02-06
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 17.0.6
```

### Error output
`rustc file.rs  -Zthreads=50 --crate-type lib -Zcrate-attr="feature(transmutability)"`
```
error: `self` parameter is only allowed in associated functions
 --> /home/matthias/vcs/github/glacier2/fixed/icemaker_omni/387A0B1B386A8EE1E6E89CAE9A6D505E849992C352BC3BCFDCBE4700E3140D7A.rs:5:44
  |
5 |     pub fn is_maybe_transmutable<Src, Dst>(&self, cpu: &mut CPU)
  |                                            ^^^^^ not semantically valid as function parameter
  |
  = note: associated functions are those in `impl` or `trait` definitions

error[E0412]: cannot find type `CPU` in this scope
 --> /home/matthias/vcs/github/glacier2/fixed/icemaker_omni/387A0B1B386A8EE1E6E89CAE9A6D505E849992C352BC3BCFDCBE4700E3140D7A.rs:5:61
  |
5 |     pub fn is_maybe_transmutable<Src, Dst>(&self, cpu: &mut CPU)
  |                                                             ^^^ not found in this scope

warning: unused import: `Assume`
 --> /home/matthias/vcs/github/glacier2/fixed/icemaker_omni/387A0B1B386A8EE1E6E89CAE9A6D505E849992C352BC3BCFDCBE4700E3140D7A.rs:2:20
  |
2 |     use std::mem::{Assume, BikeshedIntrinsicFrom};
  |                    ^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error[E0072]: recursive type `ExplicitlyPadded` has infinite size
  --> /home/matthias/vcs/github/glacier2/fixed/icemaker_omni/387A0B1B386A8EE1E6E89CAE9A6D505E849992C352BC3BCFDCBE4700E3140D7A.rs:14:5
   |
14 |     struct ExplicitlyPadded(ExplicitlyPadded);
   |     ^^^^^^^^^^^^^^^^^^^^^^^ ---------------- recursive without indirection
   |
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
   |
14 |     struct ExplicitlyPadded(Box<ExplicitlyPadded>);
   |                             ++++                +
```

<!--
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>

```
thread '<unnamed>' panicked at compiler/rustc_query_system/src/query/job.rs:543:13:
deadlock detected without any query!
stack backtrace:
   0:     0x7f5ac918bdd6 - std::backtrace_rs::backtrace::libunwind::trace::h22f05e58caa9ff59
                               at /rustc/256b6fb19a2c018eaad4806d2369d1f6a71fc6ec/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f5ac918bdd6 - std::backtrace_rs::backtrace::trace_unsynchronized::h7906e327863d4861
                               at /rustc/256b6fb19a2c018eaad4806d2369d1f6a71fc6ec/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f5ac918bdd6 - std::sys_common::backtrace::_print_fmt::h776159615a49cfcd
                               at /rustc/256b6fb19a2c018eaad4806d2369d1f6a71fc6ec/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f5ac918bdd6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf2c228a340a82885
                               at /rustc/256b6fb19a2c018eaad4806d2369d1f6a71fc6ec/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f5ac91de830 - core::fmt::rt::Argument::fmt::he6c0cd9f6c3278a7
                               at /rustc/256b6fb19a2c018eaad4806d2369d1f6a71fc6ec/library/core/src/fmt/rt.rs:142:9
   5:     0x7f5ac91de830 - core::fmt::write::h5303f05f4c809b64
                               at /rustc/256b6fb19a2c018eaad4806d2369d1f6a71fc6ec/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f5ac917f6df - std::io::Write::write_fmt::hd183c8fcfd5e6b45
                               at /rustc/256b6fb19a2c018eaad4806d2369d1f6a71fc6ec/library/std/src/io/mod.rs:1854:15
   7:     0x7f5ac918bbb4 - std::sys_common::backtrace::_print::hf4de1e64fbf090a3
                               at /rustc/256b6fb19a2c018eaad4806d2369d1f6a71fc6ec/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f5ac918bbb4 - std::sys_common::backtrace::print::hb77b4a0f8f584264
                               at /rustc/256b6fb19a2c018eaad4806d2369d1f6a71fc6ec/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f5ac918e947 - std::panicking::default_hook::{{closure}}::hc42fc7e3b5f6cdbd
  10:     0x7f5ac918e6a9 - std::panicking::default_hook::hff91b86d193565d4
                               at /rustc/256b6fb19a2c018eaad4806d2369d1f6a71fc6ec/library/std/src/panicking.rs:292:9
  11:     0x7f5acbf443bc - std[2c17c6fbbbf20bd]::panicking::update_hook::<alloc[9c1d3d296df120ce]::boxed::Box<rustc_driver_impl[183d3f9280fb921b]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f5ac918f096 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h55e149fb63b6b4c2
                               at /rustc/256b6fb19a2c018eaad4806d2369d1f6a71fc6ec/library/alloc/src/boxed.rs:2029:9
  13:     0x7f5ac918f096 - std::panicking::rust_panic_with_hook::h48d80c235e73e1c1
                               at /rustc/256b6fb19a2c018eaad4806d2369d1f6a71fc6ec/library/std/src/panicking.rs:785:13
  14:     0x7f5ac918eda9 - std::panicking::begin_panic_handler::{{closure}}::h5098457d512ce7c7
                               at /rustc/256b6fb19a2c018eaad4806d2369d1f6a71fc6ec/library/std/src/panicking.rs:651:13
  15:     0x7f5ac918c2d6 - std::sys_common::backtrace::__rust_end_short_backtrace::h88cf4f2b5332de72
                               at /rustc/256b6fb19a2c018eaad4806d2369d1f6a71fc6ec/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f5ac918eb34 - rust_begin_unwind
                               at /rustc/256b6fb19a2c018eaad4806d2369d1f6a71fc6ec/library/std/src/panicking.rs:647:5
  17:     0x7f5ac91daf35 - core::panicking::panic_fmt::h673dad205e446227
                               at /rustc/256b6fb19a2c018eaad4806d2369d1f6a71fc6ec/library/core/src/panicking.rs:72:14
  18:     0x7f5acc79caa6 - rustc_query_system[beb9a530d6f0ac5c]::query::job::deadlock
  19:     0x7f5acbf3b9ac - std[2c17c6fbbbf20bd]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[44fac7103cf6efb4]::util::run_in_thread_pool_with_globals<rustc_interface[44fac7103cf6efb4]::interface::run_compiler<core[f5e9b552e9b5c0f8]::result::Result<(), rustc_span[4b66b6657a2798ee]::ErrorGuaranteed>, rustc_driver_impl[183d3f9280fb921b]::run_compiler::{closure#0}>::{closure#0}, core[f5e9b552e9b5c0f8]::result::Result<(), rustc_span[4b66b6657a2798ee]::ErrorGuaranteed>>::{closure#2}::{closure#1}, ()>
  20:     0x7f5acbf46011 - <<std[2c17c6fbbbf20bd]::thread::Builder>::spawn_unchecked_<rustc_interface[44fac7103cf6efb4]::util::run_in_thread_pool_with_globals<rustc_interface[44fac7103cf6efb4]::interface::run_compiler<core[f5e9b552e9b5c0f8]::result::Result<(), rustc_span[4b66b6657a2798ee]::ErrorGuaranteed>, rustc_driver_impl[183d3f9280fb921b]::run_compiler::{closure#0}>::{closure#0}, core[f5e9b552e9b5c0f8]::result::Result<(), rustc_span[4b66b6657a2798ee]::ErrorGuaranteed>>::{closure#2}::{closure#1}, ()>::{closure#1} as core[f5e9b552e9b5c0f8]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  21:     0x7f5ac9198735 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8542b097259e0b43
                               at /rustc/256b6fb19a2c018eaad4806d2369d1f6a71fc6ec/library/alloc/src/boxed.rs:2015:9
  22:     0x7f5ac9198735 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he185b299f65ba456
                               at /rustc/256b6fb19a2c018eaad4806d2369d1f6a71fc6ec/library/alloc/src/boxed.rs:2015:9
  23:     0x7f5ac9198735 - std::sys::pal::unix::thread::Thread::new::thread_start::h12307a2d2012c952
                               at /rustc/256b6fb19a2c018eaad4806d2369d1f6a71fc6ec/library/std/src/sys/pal/unix/thread.rs:108:17
  24:     0x7f5ac8f839eb - <unknown>
  25:     0x7f5ac90077cc - <unknown>
  26:                0x0 - <unknown>

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: please attach the file at `/home/matthias/vcs/github/glacier2/fixed/rustc-ice-2024-02-07T23_35_31-470145.txt` to your bug report

note: compiler flags: -Z threads=50 --crate-type lib -Z crate-attr=feature(transmutability)

query stack during panic:
end of query stack
deadlock handler panicked, aborting process
[1]    470145 IOT instruction  rustc  -Zthreads=50 --crate-type lib -Zcrate-attr="feature(transmutability)"
```

</p>
</details>