rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.51k stars 12.73k forks source link

error: the compiler unexpectedly panicked. this is a bug. #132920

Open malezjaa opened 2 days ago

malezjaa commented 2 days ago

Code

The reproduction is a simple game in bevy: https://github.com/malezjaa/game

Meta

rustc --version --verbose:

rustc 1.84.0-nightly (143ce0920 2024-11-10)
binary: rustc
commit-hash: 143ce0920a2307b19831160a01f06f107610f1b2
commit-date: 2024-11-10
host: x86_64-pc-windows-msvc
release: 1.84.0-nightly
LLVM version: 19.1.3

Error output

thread 'rustc' panicked at compiler\rustc_trait_selection\src\error_reporting\traits\fulfillment_errors.rs:1820:44:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7ffba405c7f1 - std::backtrace_rs::backtrace::dbghelp64::trace
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1:     0x7ffba405c7f1 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ffba405c7f1 - std::sys::backtrace::_print_fmt
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/std\src\sys\backtrace.rs:66
   3:     0x7ffba405c7f1 - std::sys::backtrace::impl$0::print::impl$0::fmt
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/std\src\sys\backtrace.rs:39
   4:     0x7ffba408e51a - core::fmt::rt::Argument::fmt
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/core\src\fmt\rt.rs:177
   5:     0x7ffba408e51a - core::fmt::write
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/core\src\fmt\mod.rs:1189
   6:     0x7ffba40529a7 - std::io::Write::write_fmt<std::sys::pal::windows::stdio::Stderr>
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/std\src\io\mod.rs:1839
   7:     0x7ffba405c635 - std::sys::backtrace::BacktraceLock::print
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/std\src\sys\backtrace.rs:42
   8:     0x7ffba405f523 - std::panicking::default_hook::closure$1
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/std\src\panicking.rs:268
   9:     0x7ffba405f302 - std::panicking::default_hook
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/std\src\panicking.rs:295
  10:     0x7ffba5687737 - memchr
  11:     0x7ffba405fc62 - alloc::boxed::impl$30::call
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/alloc\src\boxed.rs:1981
  12:     0x7ffba405fc62 - std::panicking::rust_panic_with_hook
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/std\src\panicking.rs:809
  13:     0x7ffba405fa72 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/std\src\panicking.rs:667
  14:     0x7ffba405d2af - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/std\src\sys\backtrace.rs:170
  15:     0x7ffba405f6ae - std::panicking::begin_panic_handler
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/std\src\panicking.rs:665
  16:     0x7ffba7093af1 - core::panicking::panic_fmt
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/core\src\panicking.rs:76
  17:     0x7ffba7093bad - core::panicking::panic
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/core\src\panicking.rs:148
  18:     0x7ffba7093a6e - core::option::unwrap_failed
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/core\src\option.rs:2008
  19:     0x7ffba68fcc04 - <rustc_trait_selection[3dbf94cb46f90712]::error_reporting::TypeErrCtxt>::fuzzy_match_tys
  20:     0x7ffba6989ecd - <rustc_trait_selection[3dbf94cb46f90712]::error_reporting::traits::on_unimplemented::WrappedParserError as rustc_errors[9c488d6ae8e44ce4]::diagnostic::LintDiagnostic<()>>::decorate_lint
  21:     0x7ffba694d182 - <rustc_trait_selection[3dbf94cb46f90712]::error_reporting::TypeErrCtxt>::report_fulfillment_errors
  22:     0x7ffba42cb973 - rustc_hir_typeck[a5ddaf2af851908c]::typeck
  23:     0x7ffba4e1accb - rustc_query_impl[1314cfb4603ed7b]::plumbing::query_key_hash_verify_all
  24:     0x7ffba4d66d0a - rustc_ty_utils[c2708c13bfdf2f5f]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  25:     0x7ffba4e23264 - rustc_query_impl[1314cfb4603ed7b]::plumbing::query_key_hash_verify_all
  26:     0x7ffba4340272 - <rustc_hir_typeck[a5ddaf2af851908c]::upvar::InferBorrowKind as rustc_hir_typeck[a5ddaf2af851908c]::expr_use_visitor::Delegate>::borrow
  27:     0x7ffba43bb399 - rustc_hir_analysis[4b8241ff32ff1736]::check_crate
  28:     0x7ffba40d1991 - rustc_interface[a39b52d048a80b08]::passes::resolver_for_lowering_raw
  29:     0x7ffba10a480e - rustc_interface[a39b52d048a80b08]::passes::analysis
  30:     0x7ffba3c53f5b - rustc_ty_utils[c2708c13bfdf2f5f]::ty::adt_sized_constraint
  31:     0x7ffba3b6bcd7 - rustc_ty_utils[c2708c13bfdf2f5f]::ty::adt_sized_constraint
  32:     0x7ffba3c59893 - rustc_query_impl[1314cfb4603ed7b]::query_system
  33:     0x7ffba10634c7 - _rust_alloc_error_handler
  34:     0x7ffba105f19f - _rust_alloc_error_handler
  35:     0x7ffba10690a7 - _rust_alloc_error_handler
  36:     0x7ffba407173d - alloc::boxed::impl$28::call_once
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/alloc\src\boxed.rs:1967
  37:     0x7ffba407173d - alloc::boxed::impl$28::call_once
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/alloc\src\boxed.rs:1967
  38:     0x7ffba407173d - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/143ce0920a2307b19831160a01f06f107610f1b2\library/std\src\sys\pal\windows\thread.rs:55
  39:     0x7ffcafe5257d - BaseThreadInitThunk
  40:     0x7ffcb176af08 - 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: please make sure that you have updated to the latest nightly

note: please attach the file at `C:\dev\chronos-game\rustc-ice-2024-11-11T21_20_32-29384.txt` to your bug report

note: compiler flags: --crate-type bin -C opt-level=1 -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=on -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [typeck] type-checking `cursor::setup_cursor`
#1 [analysis] running analysis passes on this crate
end of query stack
warning: `chronos-game` (bin "chronos-game") generated 6 warnings (run `cargo fix --bin "chronos-game"` to apply 6 suggestions)
error: could not compile `chronos-game` (bin "chronos-game"); 6 warnings emitted

Caused by:
  process didn't exit successfully: `C:\Users\PC\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin\rustc.exe --crate-name chronos_game --edition=2021 src\main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=119 --crate-type bin --emit=dep-info,link -C opt-level=1 -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=on --check-cfg cfg(docsrs) --check-cfg "cfg(feature, values())" -C metadata=fa87857d082ffa4c --out-dir C:\dev\chronos-game\target\debug\deps -C incremental=C:\dev\chronos-game\target\debug\incremental -L dependency=C:\dev\chronos-game\target\debug\deps --extern bevy=C:\dev\chronos-game\target\debug\deps\libbevy-129f64a0b607358e.rlib --extern bevy_rapier2d=C:\dev\chronos-game\target\debug\deps\libbevy_rapier2d-8cf2e77811aeb84a.rlib -L native=C:\Users\PC\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows_x86_64_msvc-0.52.6\lib -L "native=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\atlmfc\lib\x64" -L native=C:\dev\chronos-game\target\debug\build\blake3-c1b15bbd03f1ca9d\out -L "native=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\atlmfc\lib\x64" -L native=C:\dev\chronos-game\target\debug\build\blake3-c1b15bbd03f1ca9d\out` (exit code: 101)

rustc-ice-2024-11-11T21_25_06-29784.txt

compiler-errors commented 2 days ago

An unwrap added in #128849 cc @estebank

cyrgani commented 1 day ago

The linked reproduction repo appears to no longer exist.

malezjaa commented 1 day ago

I'm sorry. I changed the visibility because I thought you had already found the issue. I had already modified the code to not cause a compiler error.

malezjaa commented 1 day ago

Made it public again. https://github.com/malezjaa/game/commit/7fa40a6b810177ea79c6ace036dd615358976ce8 this commit contains old code in src/cursor.rs

cyrgani commented 1 day ago

Thanks for making it public again. Here is a reduced example of the ICE: https://github.com/cyrgani/rustc-ice-version-conflict The issue why the compiler panics is that rapier depends on bevy 0.14, but the game crate depends on bevy 0.15. When importing a type from rapier in game, the ICE occurs.

@rustbot label: +S-has-mcve -E-needs-mcve +regression-from-stable-to-nightly