Skip to content

rustc panics #141052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tmakatos opened this issue May 15, 2025 · 2 comments
Open

rustc panics #141052

tmakatos opened this issue May 15, 2025 · 2 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@tmakatos
Copy link

tmakatos commented May 15, 2025

rustc-ice-2025-05-15T20_43_44-856615.txt

Code

Haven't figured out a minimal repro yet.

Meta

rustc --version --verbose:

rustc 1.89.0-nightly (414482f6a 2025-05-13)
binary: rustc
commit-hash: 414482f6a0d4e7290f614300581a0b55442552a3
commit-date: 2025-05-13
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.4

Error output

   Compiling XXX v0.1.0 (XXX)

// a few warnings

thread 'rustc' panicked at compiler/rustc_middle/src/ty/assoc.rs:43:25:
name of non-Rpitit assoc item
stack backtrace:
   0:     0x7f0159f58c93 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h2f02338d4ae6d8b0
   1:     0x7f015a605987 - core::fmt::write::h5e77c22335cabc7f
   2:     0x7f015b6bf611 - std::io::Write::write_fmt::hccf7b69d0b3d44cc
   3:     0x7f0159f58af2 - std::sys::backtrace::BacktraceLock::print::hb22254026b13323e
   4:     0x7f0159f5c6ea - std::panicking::default_hook::{{closure}}::h15ac4e3ee7801be5
   5:     0x7f0159f5c26f - std::panicking::default_hook::h15db2a3343942a16
   6:     0x7f0158f8ba03 - std[7cad246a9e76d988]::panicking::update_hook::<alloc[7a88f824ccc9bf63]::boxed::Box<rustc_driver_impl[817478e824aa827]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x7f0159f5cf63 - std::panicking::rust_panic_with_hook::h67f3fa85499b6cf9
   8:     0x7f0159f5cc5a - std::panicking::begin_panic_handler::{{closure}}::h40a30e994b26720e
   9:     0x7f0159f59169 - std::sys::backtrace::__rust_end_short_backtrace::hb5bcb2f6ea295c8b
  10:     0x7f0159f5c91d - __rustc[bf3627c2b8b7eae9]::rust_begin_unwind
  11:     0x7f01568874e0 - core::panicking::panic_fmt::h20722ae9d0312a90
  12:     0x7f01578f6feb - core::option::expect_failed::h697e98ff877a2898
  13:     0x7f0159da61fb - <rustc_trait_selection[b001b6d631c9eef9]::error_reporting::TypeErrCtxt>::suggest_fully_qualified_path
  14:     0x7f0159e0a135 - <rustc_trait_selection[b001b6d631c9eef9]::error_reporting::TypeErrCtxt>::maybe_report_ambiguity
  15:     0x7f0159dd3928 - <rustc_trait_selection[b001b6d631c9eef9]::error_reporting::TypeErrCtxt>::report_fulfillment_errors
  16:     0x7f015af0c0be - rustc_hir_typeck[e2329ef9ec23fed]::typeck_with_inspect::{closure#0}
  17:     0x7f015af057f6 - rustc_query_impl[c116a7b28af8393]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c116a7b28af8393]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8f648b1898e8f992]::query::erase::Erased<[u8; 8usize]>>
  18:     0x7f015a8d98da - rustc_query_system[341f49cf1150f7a3]::query::plumbing::try_execute_query::<rustc_query_impl[c116a7b28af8393]::DynamicConfig<rustc_data_structures[a0ae7bd4be3b1039]::vec_cache::VecCache<rustc_span[81f30c4e05e9bbfa]::def_id::LocalDefId, rustc_middle[8f648b1898e8f992]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[341f49cf1150f7a3]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[c116a7b28af8393]::plumbing::QueryCtxt, true>
  19:     0x7f015a8d5448 - rustc_query_impl[c116a7b28af8393]::query_impl::typeck::get_query_incr::__rust_end_short_backtrace
  20:     0x7f015a8d4749 - rustc_hir_analysis[4f841bd3f24bbd33]::check_crate
  21:     0x7f015af1eab7 - rustc_interface[2a1066e4df123d40]::passes::run_required_analyses
  22:     0x7f015b5ab99e - rustc_interface[2a1066e4df123d40]::passes::analysis
  23:     0x7f015b5ab975 - rustc_query_impl[c116a7b28af8393]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c116a7b28af8393]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8f648b1898e8f992]::query::erase::Erased<[u8; 0usize]>>
  24:     0x7f015b5a6584 - rustc_query_system[341f49cf1150f7a3]::query::plumbing::try_execute_query::<rustc_query_impl[c116a7b28af8393]::DynamicConfig<rustc_query_system[341f49cf1150f7a3]::query::caches::SingleCache<rustc_middle[8f648b1898e8f992]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[c116a7b28af8393]::plumbing::QueryCtxt, true>
  25:     0x7f015b5a5ea8 - rustc_query_impl[c116a7b28af8393]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  26:     0x7f015b8149c7 - rustc_interface[2a1066e4df123d40]::passes::create_and_enter_global_ctxt::<core[ee896a018689144d]::option::Option<rustc_interface[2a1066e4df123d40]::queries::Linker>, rustc_driver_impl[817478e824aa827]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  27:     0x7f015b701ea6 - rustc_interface[2a1066e4df123d40]::interface::run_compiler::<(), rustc_driver_impl[817478e824aa827]::run_compiler::{closure#0}>::{closure#1}
  28:     0x7f015b6b62be - std[7cad246a9e76d988]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2a1066e4df123d40]::util::run_in_thread_with_globals<rustc_interface[2a1066e4df123d40]::util::run_in_thread_pool_with_globals<rustc_interface[2a1066e4df123d40]::interface::run_compiler<(), rustc_driver_impl[817478e824aa827]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  29:     0x7f015b6b672b - <<std[7cad246a9e76d988]::thread::Builder>::spawn_unchecked_<rustc_interface[2a1066e4df123d40]::util::run_in_thread_with_globals<rustc_interface[2a1066e4df123d40]::util::run_in_thread_pool_with_globals<rustc_interface[2a1066e4df123d40]::interface::run_compiler<(), rustc_driver_impl[817478e824aa827]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[ee896a018689144d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  30:     0x7f015b6b7b2b - std::sys::pal::unix::thread::Thread::new::thread_start::h211a36f354245501
  31:     0x7f015548aaa4 - start_thread
                               at ./nptl/pthread_create.c:447:8
  32:     0x7f0155517c3c - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0
  33:                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 make sure that you have updated to the latest nightly

note: please attach the file at `XXX/rustc-ice-2025-05-15T20_46_47-857274.txt` to your bug report

note: compiler flags: -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:
#0 [typeck] type-checking `XXX::tests::test_XXX`
#1 [analysis] running analysis passes on this crate
end of query stack
warning: `XXX` (bin "XXX" test) generated 6 warnings (run `cargo fix --bin "XXX" --tests` to apply 4 suggestions)
error: could not compile `XXX` (bin "XXX" test); 6 warnings emitted

Caused by:
  process didn't exit successfully: `XXX/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name XXX --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --test --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=b7015ecc3d26f6c4 -C extra-filename=-4aed5e0ea9d9cbe9 --out-dir XXX/target/debug/deps -C incremental=XXX/target/debug/incremental -L dependency=XXX/target/debug/deps --extern XXX=XXX/target/debug/deps/lahibXXX-07c557093e09403c.rlib --extern anyhow=XXX/target/debug/deps/libanyhow-87eb677ced087e6c.rlib --extern glob=XXX/target/debug/deps/libglob-f6754c556ab0cb7d.rlib --extern http=XXX/target/debug/deps/libhttp-cd00c308c79f1f07.rlib --extern krates=XXX/target/debug/deps/libkrates-723bf8f14225164f.rlib --extern lazy_static=XXX/target/debug/deps/liblazy_static-87c02066b6621a70.rlib --extern macaddr=XXX/target/debug/deps/libmacaddr-2b731ad422b197a2.rlib --extern mockall=XXX/target/debug/deps/libmockall-387889c992f49458.rlib --extern rand=XXX/target/debug/deps/librand-f3ebb57cbf5bfb54.rlib --extern rstest=XXX/target/debug/deps/librstest-07986b4be8b48e67.rlib --extern semver=XXX/target/debug/deps/libsemver-b78fdaf02b51ca49.rlib --extern serde=XXX/target/debug/deps/libserde-7673185f7c639f75.rlib --extern serde_ignored_fields=XXX/target/debug/deps/libserde_ignored_fields-1c52802b16cd9e3d.rlib --extern serde_semver=XXX/target/debug/deps/libserde_semver-ebb01610f5d41e1b.rlib --extern serde_json=XXX/target/debug/deps/libserde_json-1046b8eb988620f5.rlib --extern strum=XXX/target/debug/deps/libstrum-b2d02edf2c4f2c9c.rlib --extern strum_macros=XXX/target/debug/deps/libstrum_macros-030b6838cb7f05fb.so --extern systemd_directories=XXX/target/debug/deps/libsystemd_directories-ed738cda13df3330.rlib --extern tempdir=XXX/target/debug/deps/libtempdir-8f40b284ff581e3f.rlib --extern tempfile=XXX/target/debug/deps/libtempfile-5041a8612a119d59.rlib --extern test_log=XXX/target/debug/deps/libtest_log-b9148ffc47b6a893.rlib --extern tokio=XXX/target/debug/deps/libtokio-15d1f9d7e8fbe38a.rlib --extern tracing=XXX/target/debug/deps/libtracing-18498455bfc7007a.rlib --extern tracing_subscriber=XXX/target/debug/deps/libtracing_subscriber-eb7cb3636e7dfcb5.rlib --extern uuid=XXX/target/debug/deps/libuuid-2671c0381fead8c5.rlib --extern zbus=XXX/target/debug/deps/libzbus-6f3c6752a59ecea7.rlib` (exit status: 101)

@tmakatos tmakatos added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels May 15, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 15, 2025
@tmakatos
Copy link
Author

tmakatos commented May 15, 2025

Some additional information:

I added a dummy function to my trait and call it in the unit test code:

fn foo<T, D, S, Q, C, R>(self) -> impl Future<Output = Result<Enabled>> + Send
where
    ...

I made it non-async and compilation failed with (which previously didn't):

error[E0284]: type annotations needed
   --> src/state/iser_state.rs:839:15
    |
839 |         state.foo().unwrap();
    |               ^^^ cannot infer type of the type parameter `D` declared on the method `foo`
    |
    = note: cannot satisfy `<_ as typestate::DisabledTypeTrait>::DisabledType == _`
help: consider specifying the generic arguments
    |
839 |         state.foo::<T, D, S, Q, C, R>().unwrap();
    |                  ++++++++++++++++++++

I fixed the error and now the compiler doesn't panic.

FWIW the trait bounds are something like the following:

    T: TraitA + 'static + Debug,
    D: BTypeTrait + 'static + Debug + Send,
    <D as BTypeTrait>::BType: for<'de> Deserialize<'de>,
    <D as BTypeTrait>::BType: Send,
    S: CTrait + 'static + Debug + Send,
    <S as CTrait>::C: Send,
    for<'de> <S as CTrait>::C: Deserialize<'de>,
    <S as CTrait>::C: From<
        <<D as BTypeTrait>::BType as BTypeTrait>::C,
    >,
    Q: DTypeTrait + 'static + Debug + Send,
    <Q as DTypeTrait>::DType: for<'de> Deserialize<'de>,
    <Q as DTypeTrait>::DType: Send,
    <Q as DTypeTrait>::DType: From<<<S as CTrait>::C as CTrait>::DType>,
    C: ETypeTrait + 'static + Debug + Send,
    <C as ETypeTrait>::EType: Send,
    <C as ETypeTrait>::EType: From<<<Q as DTypeTrait>::DType as DTypeTrait>::EType>,
    R: FTypeTrait + 'static + Debug + Send,
    <R as FTypeTrait>::FType: Send,
    <R as FTypeTrait>::FType: From<<<C as ETypeTrait>::EType as ETypeTrait>::FType>,
    Self: Sized;

@moxian
Copy link
Contributor

moxian commented May 15, 2025

Please provide a reproduction (not neccessarily minimal). It is usually very hard to debug internal compiler errors from the stack trace alone, without having the code on hand that triggers said stack trace.

That said, if you want you can use something like https://github.com/Noratrieb/cargo-minimize to trim a big repro down to something smaller in size (do note that cargo-minimize actively removes "unneccessary" code, so it is advisable to make a backup of your project before running it)

@rustbot label: +S-needs-repro

@rustbot rustbot added the S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. label May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants