Repository: rust
Issue: the compiler unexpectedly panicked
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
github.com/winliyou/danmu
```


### 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.80.1 (3f5fd8dd4 2024-08-06) running on x86_64-unknown-linux-gnu
compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C linker=clang -C link-arg=-fuse-ld=mold

```

### Error output

```
   Compiling proc-macro2 v1.0.86
   Compiling unicode-ident v1.0.12
   Compiling version_check v0.9.5
   Compiling cfg-if v1.0.0
   Compiling libc v0.2.155
   Compiling autocfg v1.3.0
   Compiling once_cell v1.19.0
   Compiling vcpkg v0.2.15
   Compiling pkg-config v0.3.30
   Compiling byteorder v1.5.0
   Compiling itoa v1.0.11
   Compiling cc v1.1.10
   Compiling bytes v1.7.1
   Compiling parking_lot_core v0.9.10
   Compiling pin-project-lite v0.2.14
   Compiling smallvec v1.13.2
   Compiling scopeguard v1.2.0
   Compiling typenum v1.17.0
   Compiling fnv v1.0.7
   Compiling log v0.4.22
   Compiling tinyvec_macros v0.1.1
   Compiling memchr v2.7.4
   Compiling futures-core v0.3.30
   Compiling bitflags v2.6.0
   Compiling openssl v0.10.66
   Compiling foreign-types-shared v0.1.1
   Compiling foreign-types v0.3.2
   Compiling tinyvec v1.8.0
   Compiling futures-sink v0.3.30
   Compiling httparse v1.9.4
   Compiling ahash v0.8.11
   Compiling generic-array v0.14.7
   Compiling native-tls v0.2.12
   Compiling lock_api v0.4.12
   Compiling slab v0.4.9
   Compiling percent-encoding v2.3.1
   Compiling unicode-bidi v0.3.15
   Compiling futures-task v0.3.30
   Compiling openssl-probe v0.1.5
thread 'rustc' panicked at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/compiler/rustc_hir/src/definitions.rs:81:26:
index out of bounds: the len is 8354 but the index is 4294442753
stack backtrace:

```

<!--
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 'rustc' panicked at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/compiler/rustc_hir/src/definitions.rs:81:26:
index out of bounds: the len is 8354 but the index is 4294442753
stack backtrace:
   Compiling serde v1.0.206
   0:     0x7ac52d4fff05 - std::backtrace_rs::backtrace::libunwind::trace::h23054e327d0d4b55
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x7ac52d4fff05 - std::backtrace_rs::backtrace::trace_unsynchronized::h0cc587407d7f7f64
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ac52d4fff05 - std::sys_common::backtrace::_print_fmt::h4feeb59774730d6b
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7ac52d4fff05 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd736fd5964392270
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7ac52d550c4b - core::fmt::rt::Argument::fmt::h105051d8ea1ade1e
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/fmt/rt.rs:165:63
   5:     0x7ac52d550c4b - core::fmt::write::hc6043626647b98ea
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/fmt/mod.rs:1168:21
   6:     0x7ac52d4f4bdf - std::io::Write::write_fmt::h0d24b3e0473045db
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/io/mod.rs:1835:15
   7:     0x7ac52d4ffcde - std::sys_common::backtrace::_print::h62df6fc36dcebfc8
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7ac52d4ffcde - std::sys_common::backtrace::print::h45eb8174d25a1e76
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7ac52d502719 - std::panicking::default_hook::{{closure}}::haf3f0170eb4f3b53
  10:     0x7ac52d5024ba - std::panicking::default_hook::hb5d3b27aa9f6dcda
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:298:9
  11:     0x7ac529e150c1 - std[fba9fafec3bdacf8]::panicking::update_hook::<alloc[a325a9cea6fa5e89]::boxed::Box<rustc_driver_impl[ce01f96e2e949677]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7ac52d502e4b - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h2026a29033a1b9f6
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/alloc/src/boxed.rs:2077:9
  13:     0x7ac52d502e4b - std::panicking::rust_panic_with_hook::h6b49d59f86ee588c
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:799:13
  14:     0x7ac52d502bc4 - std::panicking::begin_panic_handler::{{closure}}::hd4c2f7ed79b82b70
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:664:13
  15:     0x7ac52d5003c9 - std::sys_common::backtrace::__rust_end_short_backtrace::h2946d6d32d7ea1ad
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7ac52d5028f7 - rust_begin_unwind
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:652:5
  17:     0x7ac52d54d1e3 - core::panicking::panic_fmt::ha02418e5cd774672
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/panicking.rs:72:14
  18:     0x7ac52d54d3f7 - core::panicking::panic_bounds_check::hc4af019f20d205d1
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/panicking.rs:274:5
  19:     0x7ac52bdeabb6 - <rustc_resolve[34adc92c5bb8840b]::effective_visibilities::EffectiveVisibilitiesVisitor>::set_bindings_effective_visibilities
  20:     0x7ac52b947048 - <rustc_resolve[34adc92c5bb8840b]::effective_visibilities::EffectiveVisibilitiesVisitor as rustc_ast[3acccd48000a702]::visit::Visitor>::visit_item
  21:     0x7ac52b947081 - <rustc_resolve[34adc92c5bb8840b]::effective_visibilities::EffectiveVisibilitiesVisitor as rustc_ast[3acccd48000a702]::visit::Visitor>::visit_item
  22:     0x7ac52b94b11c - <rustc_resolve[34adc92c5bb8840b]::Resolver>::resolve_crate::{closure#0}
  23:     0x7ac52b954e1c - <rustc_resolve[34adc92c5bb8840b]::Resolver>::resolve_crate
  24:     0x7ac52b7d0f08 - rustc_interface[c31201428b712578]::passes::resolver_for_lowering_raw
  25:     0x7ac52b7d010d - rustc_query_impl[c1633093ec927e0e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c1633093ec927e0e]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ecc07153edf3c281]::query::erase::Erased<[u8; 16usize]>>
  26:     0x7ac52b7d00e7 - <rustc_query_impl[c1633093ec927e0e]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[1a380081440346cb]::ops::function::FnOnce<(rustc_middle[ecc07153edf3c281]::ty::context::TyCtxt, ())>>::call_once
  27:     0x7ac52bf63393 - rustc_query_system[b257ee99c2874caa]::query::plumbing::try_execute_query::<rustc_query_impl[c1633093ec927e0e]::DynamicConfig<rustc_query_system[b257ee99c2874caa]::query::caches::SingleCache<rustc_middle[ecc07153edf3c281]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[c1633093ec927e0e]::plumbing::QueryCtxt, false>
  28:     0x7ac52bf63079 - rustc_query_impl[c1633093ec927e0e]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
  29:     0x7ac52be120be - rustc_interface[c31201428b712578]::interface::run_compiler::<core[1a380081440346cb]::result::Result<(), rustc_span[4d50fd03223eefaa]::ErrorGuaranteed>, rustc_driver_impl[ce01f96e2e949677]::run_compiler::{closure#0}>::{closure#1}
  30:     0x7ac52bf47869 - std[fba9fafec3bdacf8]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[c31201428b712578]::util::run_in_thread_with_globals<rustc_interface[c31201428b712578]::interface::run_compiler<core[1a380081440346cb]::result::Result<(), rustc_span[4d50fd03223eefaa]::ErrorGuaranteed>, rustc_driver_impl[ce01f96e2e949677]::run_compiler::{closure#0}>::{closure#1}, core[1a380081440346cb]::result::Result<(), rustc_span[4d50fd03223eefaa]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1a380081440346cb]::result::Result<(), rustc_span[4d50fd03223eefaa]::ErrorGuaranteed>>
  31:     0x7ac52bf4766a - <<std[fba9fafec3bdacf8]::thread::Builder>::spawn_unchecked_<rustc_interface[c31201428b712578]::util::run_in_thread_with_globals<rustc_interface[c31201428b712578]::interface::run_compiler<core[1a380081440346cb]::result::Result<(), rustc_span[4d50fd03223eefaa]::ErrorGuaranteed>, rustc_driver_impl[ce01f96e2e949677]::run_compiler::{closure#0}>::{closure#1}, core[1a380081440346cb]::result::Result<(), rustc_span[4d50fd03223eefaa]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1a380081440346cb]::result::Result<(), rustc_span[4d50fd03223eefaa]::ErrorGuaranteed>>::{closure#2} as core[1a380081440346cb]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  32:     0x7ac52d50ce3b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hdf5fcef8be77a431
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/alloc/src/boxed.rs:2063:9
  33:     0x7ac52d50ce3b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8e8c5ceee46ee198
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/alloc/src/boxed.rs:2063:9
  34:     0x7ac52d50ce3b - std::sys::pal::unix::thread::Thread::new::thread_start::hb85dbfa54ba503d6
                               at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/sys/pal/unix/thread.rs:108:17
  35:     0x7ac52d2b539d - <unknown>
  36:     0x7ac52d33a49c - <unknown>
  37:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

```

</p>
</details>