Skip to content
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

[Nightly ICE] double panic / DefIf does not have a "type_of" / method resolution should've emitted an error #129616

Open
LunarLambda opened this issue Aug 26, 2024 · 4 comments
Labels
C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-bisection Status: a bisection has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@LunarLambda
Copy link

Code

fn main() {
    println!("{:?}", <md5::Md5 as md5::digest::OutputSizeUser>::OutputSize::USIZE);
}
[dependencies]
md-5 = "=0.10.6"

Meta

rustc --version --verbose:

rustc 1.82.0-nightly (c6db1ca3c 2024-08-25)
binary: rustc
commit-hash: c6db1ca3c93ad69692a4c4b5542f26fda4bf3aec
commit-date: 2024-08-25
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0

Error output

thread 'rustc' panicked at compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:214:1:
DefId(22:34 ~ crypto_common[1bc4]::OutputSizeUser::OutputSize) does not have a "type_of"

[Backtrace output, see below]

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 `/home/lambda/ice/rustc-ice-2024-08-26T15_33_42-3644.txt` to your bug report

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:
#0 [type_of] computing type of `crypto_common::OutputSizeUser::OutputSize`
#1 [typeck] type-checking `main`
end of query stack
note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: method resolution should've emitted an error
 --> src/main.rs:2:22
  |
2 |     println!("{:?}", <md5::Md5 as md5::digest::OutputSizeUser>::OutputSize::USIZE);
  |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:837:22 - disabled backtrace
 --> src/main.rs:2:22
  |
2 |     println!("{:?}", <md5::Md5 as md5::digest::OutputSizeUser>::OutputSize::USIZE);
  |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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 `/home/lambda/ice/rustc-ice-2024-08-26T15_33_42-3644.txt` to your bug report

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 core/src/panicking.rs:229:5:
panic in a destructor during cleanup

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 `/home/lambda/ice/rustc-ice-2024-08-26T15_33_42-3644.txt` to your bug report

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 caused non-unwinding panic. aborting.
error: could not compile `ice` (bin "ice")

Caused by:
  process didn't exit successfully: `/home/lambda/.local/share/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name ice --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=157 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values())' -C metadata=9203647a68f5151c -C extra-filename=-9203647a68f5151c --out-dir /home/lambda/ice/target/debug/deps -C incremental=/home/lambda/ice/target/debug/incremental -L dependency=/home/lambda/ice/target/debug/deps --extern md5=/home/lambda/ice/target/debug/deps/libmd5-86a47fe7a9060491.rlib` (signal: 6, SIGABRT: process abort signal)
Backtrace

stack backtrace:
   0:     0x7a298c3b327d - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h08c68512b2311366
   1:     0x7a298cc04c97 - core::fmt::write::h6e3f8345ff37039b
   2:     0x7a298dba0e91 - std::io::Write::write_fmt::hc6823578ffc00004
   3:     0x7a298c3b595b - std::panicking::default_hook::{{closure}}::hee63056ca50632bf
   4:     0x7a298c3b55ce - std::panicking::default_hook::hf7cfdbe4468ff824
   5:     0x7a298b52ee19 - std[bb0a3357faafffca]::panicking::update_hook::<alloc[c880ca6818e137dd]::boxed::Box<rustc_driver_impl[dbde3d5700ccbd28]::install_ice_hook::{closure#0}>>::{closure#0}
   6:     0x7a298c3b6277 - std::panicking::rust_panic_with_hook::hdfce2b8bd7fc4cbd
   7:     0x7a298c3b5f37 - std::panicking::begin_panic_handler::{{closure}}::h1fea56f9bbc92609
   8:     0x7a298c3b3739 - std::sys::backtrace::__rust_end_short_backtrace::h60ce9d111c920856
   9:     0x7a298c3b5c04 - rust_begin_unwind
  10:     0x7a298928fe93 - core::panicking::panic_fmt::hca2ff70b38236a4a
  11:     0x7a298ba8dfa2 - rustc_metadata[ae979ed0731722c8]::rmeta::decoder::cstore_impl::provide_extern::type_of::{closure#2}
  12:     0x7a298cc282f7 - rustc_query_impl[bd1d0c2d52a1173]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bd1d0c2d52a1173]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a76a08f9151f3d73]::query::erase::Erased<[u8; 8usize]>>
  13:     0x7a298d01d2a3 - rustc_query_system[cf6f668eb9b403cb]::query::plumbing::try_execute_query::<rustc_query_impl[bd1d0c2d52a1173]::DynamicConfig<rustc_query_system[cf6f668eb9b403cb]::query::caches::DefIdCache<rustc_middle[a76a08f9151f3d73]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[bd1d0c2d52a1173]::plumbing::QueryCtxt, true>
  14:     0x7a298d01ac9a - rustc_query_impl[bd1d0c2d52a1173]::query_impl::type_of::get_query_incr::__rust_end_short_backtrace
  15:     0x7a298d362915 - rustc_middle[a76a08f9151f3d73]::query::plumbing::query_get_at::<rustc_query_system[cf6f668eb9b403cb]::query::caches::DefIdCache<rustc_middle[a76a08f9151f3d73]::query::erase::Erased<[u8; 8usize]>>>
  16:     0x7a298b873ed3 - <rustc_hir_typeck[690d2b981901c23e]::fn_ctxt::FnCtxt>::suggest_traits_to_import
  17:     0x7a298b860fea - <rustc_hir_typeck[690d2b981901c23e]::fn_ctxt::FnCtxt>::report_no_match_method_error
  18:     0x7a298b89598a - <rustc_hir_typeck[690d2b981901c23e]::fn_ctxt::FnCtxt>::report_method_error
  19:     0x7a298d6f3688 - <rustc_hir_typeck[690d2b981901c23e]::fn_ctxt::FnCtxt>::check_expr_path
  20:     0x7a298d5f3398 - <rustc_hir_typeck[690d2b981901c23e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  21:     0x7a298d5f5ba7 - <rustc_hir_typeck[690d2b981901c23e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  22:     0x7a298982c28d - <rustc_hir_typeck[690d2b981901c23e]::fn_ctxt::FnCtxt>::confirm_builtin_call
  23:     0x7a298d5f4e68 - <rustc_hir_typeck[690d2b981901c23e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  24:     0x7a298d5f7997 - <rustc_hir_typeck[690d2b981901c23e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  25:     0x7a298d5f5ba7 - <rustc_hir_typeck[690d2b981901c23e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  26:     0x7a298982c28d - <rustc_hir_typeck[690d2b981901c23e]::fn_ctxt::FnCtxt>::confirm_builtin_call
  27:     0x7a298d5f4e68 - <rustc_hir_typeck[690d2b981901c23e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  28:     0x7a298982c28d - <rustc_hir_typeck[690d2b981901c23e]::fn_ctxt::FnCtxt>::confirm_builtin_call
  29:     0x7a298d5f4e68 - <rustc_hir_typeck[690d2b981901c23e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  30:     0x7a298d5ee0bd - <rustc_hir_typeck[690d2b981901c23e]::fn_ctxt::FnCtxt>::check_block_with_expected
  31:     0x7a298d5f5578 - <rustc_hir_typeck[690d2b981901c23e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  32:     0x7a298d5ee0bd - <rustc_hir_typeck[690d2b981901c23e]::fn_ctxt::FnCtxt>::check_block_with_expected
  33:     0x7a298d5f5578 - <rustc_hir_typeck[690d2b981901c23e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  34:     0x7a298ccd544c - rustc_hir_typeck[690d2b981901c23e]::check::check_fn
  35:     0x7a298d183732 - rustc_hir_typeck[690d2b981901c23e]::typeck
  36:     0x7a298d183175 - rustc_query_impl[bd1d0c2d52a1173]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bd1d0c2d52a1173]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a76a08f9151f3d73]::query::erase::Erased<[u8; 8usize]>>
  37:     0x7a298d17a18a - rustc_query_system[cf6f668eb9b403cb]::query::plumbing::try_execute_query::<rustc_query_impl[bd1d0c2d52a1173]::DynamicConfig<rustc_query_system[cf6f668eb9b403cb]::query::caches::VecCache<rustc_span[b6fe7948518089fa]::def_id::LocalDefId, rustc_middle[a76a08f9151f3d73]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[bd1d0c2d52a1173]::plumbing::QueryCtxt, true>
  38:     0x7a298d019914 - rustc_query_impl[bd1d0c2d52a1173]::query_impl::typeck::get_query_incr::__rust_end_short_backtrace
  39:     0x7a298d175f89 - <rustc_middle[a76a08f9151f3d73]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[dc85b8d661b4e95e]::check_crate::{closure#4}>::{closure#0}
  40:     0x7a298d173e32 - rustc_hir_analysis[dc85b8d661b4e95e]::check_crate
  41:     0x7a298d1711ff - rustc_interface[af22c66eb3c80e7d]::passes::run_required_analyses
  42:     0x7a298d768dde - rustc_interface[af22c66eb3c80e7d]::passes::analysis
  43:     0x7a298d768db1 - rustc_query_impl[bd1d0c2d52a1173]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bd1d0c2d52a1173]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a76a08f9151f3d73]::query::erase::Erased<[u8; 1usize]>>
  44:     0x7a298dbdbb0d - rustc_query_system[cf6f668eb9b403cb]::query::plumbing::try_execute_query::<rustc_query_impl[bd1d0c2d52a1173]::DynamicConfig<rustc_query_system[cf6f668eb9b403cb]::query::caches::SingleCache<rustc_middle[a76a08f9151f3d73]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[bd1d0c2d52a1173]::plumbing::QueryCtxt, true>
  45:     0x7a298dbdb7ba - rustc_query_impl[bd1d0c2d52a1173]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  46:     0x7a298d9d4d6a - rustc_interface[af22c66eb3c80e7d]::interface::run_compiler::<core[38f94b13edbf1545]::result::Result<(), rustc_span[b6fe7948518089fa]::ErrorGuaranteed>, rustc_driver_impl[dbde3d5700ccbd28]::run_compiler::{closure#0}>::{closure#1}
  47:     0x7a298da43310 - std[bb0a3357faafffca]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[af22c66eb3c80e7d]::util::run_in_thread_with_globals<rustc_interface[af22c66eb3c80e7d]::util::run_in_thread_pool_with_globals<rustc_interface[af22c66eb3c80e7d]::interface::run_compiler<core[38f94b13edbf1545]::result::Result<(), rustc_span[b6fe7948518089fa]::ErrorGuaranteed>, rustc_driver_impl[dbde3d5700ccbd28]::run_compiler::{closure#0}>::{closure#1}, core[38f94b13edbf1545]::result::Result<(), rustc_span[b6fe7948518089fa]::ErrorGuaranteed>>::{closure#0}, core[38f94b13edbf1545]::result::Result<(), rustc_span[b6fe7948518089fa]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[38f94b13edbf1545]::result::Result<(), rustc_span[b6fe7948518089fa]::ErrorGuaranteed>>
  48:     0x7a298da4397a - <<std[bb0a3357faafffca]::thread::Builder>::spawn_unchecked_<rustc_interface[af22c66eb3c80e7d]::util::run_in_thread_with_globals<rustc_interface[af22c66eb3c80e7d]::util::run_in_thread_pool_with_globals<rustc_interface[af22c66eb3c80e7d]::interface::run_compiler<core[38f94b13edbf1545]::result::Result<(), rustc_span[b6fe7948518089fa]::ErrorGuaranteed>, rustc_driver_impl[dbde3d5700ccbd28]::run_compiler::{closure#0}>::{closure#1}, core[38f94b13edbf1545]::result::Result<(), rustc_span[b6fe7948518089fa]::ErrorGuaranteed>>::{closure#0}, core[38f94b13edbf1545]::result::Result<(), rustc_span[b6fe7948518089fa]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[38f94b13edbf1545]::result::Result<(), rustc_span[b6fe7948518089fa]::ErrorGuaranteed>>::{closure#1} as core[38f94b13edbf1545]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  49:     0x7a298da43ceb - std::sys::pal::unix::thread::Thread::new::thread_start::h5575404a57e52770
  50:     0x7a298f0fd39d - <unknown>
  51:     0x7a298f18249c - <unknown>
  52:                0x0 - <unknown>

rustc-ice-2024-08-26T15_33_42-3644.txt

@LunarLambda LunarLambda added C-bug Category: This is a bug. 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. labels Aug 26, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 26, 2024
@Noratrieb Noratrieb added E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Aug 26, 2024
@lqd lqd added the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Aug 26, 2024
@jieyouxu
Copy link
Member

searched nightlies: from nightly-2024-06-07 to nightly-2024-08-26
regressed nightly: nightly-2024-08-18
searched commit range: 506052d...feeba19
regressed commit: 9b318d2

bisected with cargo-bisect-rustc v0.6.8

Host triple: aarch64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --regress=ice

@jieyouxu
Copy link
Member

#128786 cc @estebank, bisection looks probably correct due to external crate def interactions

@jieyouxu jieyouxu added S-has-bisection Status: a bisection has been found for this issue and removed E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc labels Aug 26, 2024
@ambiso
Copy link

ambiso commented Aug 26, 2024

I believe this is the line that's crashing?

At least it's the only type_of that occurs in that PR (that is related to the regressed commit).

@rust-lang rust-lang deleted a comment Aug 26, 2024
@compiler-errors
Copy link
Member

Should be fixed by ##129250

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. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-bisection Status: a bisection has been found for this issue 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

7 participants