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

ICE: kcfi: cannot get associated-item of DefKey.. #123641

Closed
matthiaskrgr opened this issue Apr 8, 2024 · 3 comments
Closed

ICE: kcfi: cannot get associated-item of DefKey.. #123641

matthiaskrgr opened this issue Apr 8, 2024 · 3 comments
Labels
A-sanitizers Area: Sanitizers for correctness and code quality. 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.

Comments

@matthiaskrgr
Copy link
Member

snippet:

fn main() {
    let option_id_closure = |x| Some(x);

    let _: Vec<_> = vec![5_i8; 6]
        .into_iter()
        .map(option_id_closure)
        .flatten()
        .collect();
}

Version information

rustc 1.79.0-nightly (537aab7a2 2024-04-08)
binary: rustc
commit-hash: 537aab7a2e7fe9cdf50b5ff18485e0793cd8db62
commit-date: 2024-04-08
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.3

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zsanitizer=kcfi -Cpanic=abort

Program output

error: internal compiler error: compiler/rustc_metadata/src/rmeta/decoder.rs:1335:18: cannot get associated-item of `DefKey { parent: Some(DefIndex(6824)), disambiguated_data: DisambiguatedDefPathData { data: ValueNs("from_iter_in_place"), disambiguator: 0 } }`

thread 'rustc' panicked at compiler/rustc_metadata/src/rmeta/decoder.rs:1335:18:
Box<dyn Any>
stack backtrace:
   0:     0x700a82ca0885 - std::backtrace_rs::backtrace::libunwind::trace::h3c5d6be2ca224618
                               at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x700a82ca0885 - std::backtrace_rs::backtrace::trace_unsynchronized::h07f25bfbbc81f9b7
                               at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x700a82ca0885 - std::sys_common::backtrace::_print_fmt::hf0313e0fd41b1242
                               at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x700a82ca0885 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha80bcf755077e3a1
                               at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x700a82cefb4b - core::fmt::rt::Argument::fmt::hea7d7a647aef4433
                               at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/core/src/fmt/rt.rs:142:9
   5:     0x700a82cefb4b - core::fmt::write::h0eafe6836efd2236
                               at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/core/src/fmt/mod.rs:1153:17
   6:     0x700a82c9547f - std::io::Write::write_fmt::hee25aa3e7912fe48
                               at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/io/mod.rs:1843:15
   7:     0x700a82ca065e - std::sys_common::backtrace::_print::h0c8b5670573775f7
                               at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x700a82ca065e - std::sys_common::backtrace::print::hb0c84899d27bc992
                               at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x700a82ca3159 - std::panicking::default_hook::{{closure}}::hdd10a62b37f83705
  10:     0x700a82ca2e75 - std::panicking::default_hook::h491d7bd053f3c065
                               at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/panicking.rs:291:9
  11:     0x700a7f65be5f - std[8cce646dcc9f51a2]::panicking::update_hook::<alloc[7e5e1bdade7884f3]::boxed::Box<rustc_driver_impl[b1693766bfe96bed]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x700a82ca385c - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h673a5ec9e27814ea
                               at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/alloc/src/boxed.rs:2032:9
  13:     0x700a82ca385c - std::panicking::rust_panic_with_hook::h2f18055510e9d6ac
                               at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/panicking.rs:792:13
  14:     0x700a7f68bed4 - std[8cce646dcc9f51a2]::panicking::begin_panic::<rustc_errors[6ec141f8b50a2d31]::ExplicitBug>::{closure#0}
  15:     0x700a7f688c46 - std[8cce646dcc9f51a2]::sys_common::backtrace::__rust_end_short_backtrace::<std[8cce646dcc9f51a2]::panicking::begin_panic<rustc_errors[6ec141f8b50a2d31]::ExplicitBug>::{closure#0}, !>
  16:     0x700a7f688926 - std[8cce646dcc9f51a2]::panicking::begin_panic::<rustc_errors[6ec141f8b50a2d31]::ExplicitBug>
  17:     0x700a7f6952d1 - <rustc_errors[6ec141f8b50a2d31]::diagnostic::BugAbort as rustc_errors[6ec141f8b50a2d31]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x700a7fb3650c - rustc_middle[29872c107b60a246]::util::bug::opt_span_bug_fmt::<rustc_span[c8203a7ebedcd79e]::span_encoding::Span>::{closure#0}
  19:     0x700a7fb1dfda - rustc_middle[29872c107b60a246]::ty::context::tls::with_opt::<rustc_middle[29872c107b60a246]::util::bug::opt_span_bug_fmt<rustc_span[c8203a7ebedcd79e]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x700a7fb1de5b - rustc_middle[29872c107b60a246]::ty::context::tls::with_context_opt::<rustc_middle[29872c107b60a246]::ty::context::tls::with_opt<rustc_middle[29872c107b60a246]::util::bug::opt_span_bug_fmt<rustc_span[c8203a7ebedcd79e]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x700a7d6ff810 - rustc_middle[29872c107b60a246]::util::bug::bug_fmt
  22:     0x700a80cafbdd - rustc_metadata[b6296f5d457caf2d]::rmeta::decoder::cstore_impl::provide_extern::associated_item
  23:     0x700a80cae8b5 - rustc_query_impl[51661ff1e116d73e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[51661ff1e116d73e]::query_impl::associated_item::dynamic_query::{closure#2}::{closure#0}, rustc_middle[29872c107b60a246]::query::erase::Erased<[u8; 40usize]>>
  24:     0x700a80cadc7a - rustc_query_system[2cf76174bd7e0814]::query::plumbing::try_execute_query::<rustc_query_impl[51661ff1e116d73e]::DynamicConfig<rustc_query_system[2cf76174bd7e0814]::query::caches::DefIdCache<rustc_middle[29872c107b60a246]::query::erase::Erased<[u8; 40usize]>>, false, false, false>, rustc_query_impl[51661ff1e116d73e]::plumbing::QueryCtxt, false>
  25:     0x700a80cad970 - rustc_query_impl[51661ff1e116d73e]::query_impl::associated_item::get_query_non_incr::__rust_end_short_backtrace
  26:     0x700a8141cccc - rustc_middle[29872c107b60a246]::query::plumbing::query_get_at::<rustc_query_system[2cf76174bd7e0814]::query::caches::DefIdCache<rustc_middle[29872c107b60a246]::query::erase::Erased<[u8; 40usize]>>>
  27:     0x700a8209f520 - <rustc_middle[29872c107b60a246]::ty::instance::Instance>::resolve_for_fn_ptr.cold
  28:     0x700a8168f5a9 - <rustc_const_eval[3bfb358494a99f29]::interpret::eval_context::InterpCx<rustc_const_eval[3bfb358494a99f29]::const_eval::machine::CompileTimeInterpreter>>::eval_rvalue_into_place
  29:     0x700a8162a134 - rustc_const_eval[3bfb358494a99f29]::const_eval::eval_queries::eval_to_allocation_raw_provider
  30:     0x700a81629800 - rustc_query_impl[51661ff1e116d73e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[51661ff1e116d73e]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[29872c107b60a246]::query::erase::Erased<[u8; 24usize]>>
  31:     0x700a81619d96 - rustc_query_system[2cf76174bd7e0814]::query::plumbing::try_execute_query::<rustc_query_impl[51661ff1e116d73e]::DynamicConfig<rustc_query_system[2cf76174bd7e0814]::query::caches::DefaultCache<rustc_middle[29872c107b60a246]::ty::ParamEnvAnd<rustc_middle[29872c107b60a246]::mir::interpret::GlobalId>, rustc_middle[29872c107b60a246]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[51661ff1e116d73e]::plumbing::QueryCtxt, false>
  32:     0x700a8161996c - rustc_query_impl[51661ff1e116d73e]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
  33:     0x700a81617ae5 - rustc_const_eval[3bfb358494a99f29]::const_eval::eval_queries::eval_to_const_value_raw_provider
  34:     0x700a81617900 - rustc_query_impl[51661ff1e116d73e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[51661ff1e116d73e]::query_impl::eval_to_const_value_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[29872c107b60a246]::query::erase::Erased<[u8; 24usize]>>
  35:     0x700a81619d59 - rustc_query_system[2cf76174bd7e0814]::query::plumbing::try_execute_query::<rustc_query_impl[51661ff1e116d73e]::DynamicConfig<rustc_query_system[2cf76174bd7e0814]::query::caches::DefaultCache<rustc_middle[29872c107b60a246]::ty::ParamEnvAnd<rustc_middle[29872c107b60a246]::mir::interpret::GlobalId>, rustc_middle[29872c107b60a246]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[51661ff1e116d73e]::plumbing::QueryCtxt, false>
  36:     0x700a81619884 - rustc_query_impl[51661ff1e116d73e]::query_impl::eval_to_const_value_raw::get_query_non_incr::__rust_end_short_backtrace
  37:     0x700a7de70f74 - <rustc_middle[29872c107b60a246]::ty::context::TyCtxt>::const_eval_resolve
  38:     0x700a7e1d8ca5 - rustc_monomorphize[a54e4eb903c076d9]::collector::collect_items_rec::{closure#0}
  39:     0x700a818415e6 - rustc_monomorphize[a54e4eb903c076d9]::collector::collect_items_rec
  40:     0x700a81841fb2 - rustc_monomorphize[a54e4eb903c076d9]::collector::collect_items_rec
  41:     0x700a81841fb2 - rustc_monomorphize[a54e4eb903c076d9]::collector::collect_items_rec
  42:     0x700a81841fb2 - rustc_monomorphize[a54e4eb903c076d9]::collector::collect_items_rec
  43:     0x700a8183c0ac - rustc_monomorphize[a54e4eb903c076d9]::partitioning::collect_and_partition_mono_items
  44:     0x700a8183b6a8 - rustc_query_impl[51661ff1e116d73e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[51661ff1e116d73e]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle[29872c107b60a246]::query::erase::Erased<[u8; 24usize]>>
  45:     0x700a8183b68d - <rustc_query_impl[51661ff1e116d73e]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core[7ebb3dbf9c5383ca]::ops::function::FnOnce<(rustc_middle[29872c107b60a246]::ty::context::TyCtxt, ())>>::call_once
  46:     0x700a81838214 - rustc_query_system[2cf76174bd7e0814]::query::plumbing::try_execute_query::<rustc_query_impl[51661ff1e116d73e]::DynamicConfig<rustc_query_system[2cf76174bd7e0814]::query::caches::SingleCache<rustc_middle[29872c107b60a246]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[51661ff1e116d73e]::plumbing::QueryCtxt, false>
  47:     0x700a81837f0b - rustc_query_impl[51661ff1e116d73e]::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace
  48:     0x700a819a4aaa - rustc_codegen_ssa[1df6559decbf1b9a]::base::codegen_crate::<rustc_codegen_llvm[daf017fde14aa476]::LlvmCodegenBackend>
  49:     0x700a818ad502 - <rustc_codegen_llvm[daf017fde14aa476]::LlvmCodegenBackend as rustc_codegen_ssa[1df6559decbf1b9a]::traits::backend::CodegenBackend>::codegen_crate
  50:     0x700a818ace85 - rustc_interface[e7aac3eeb74c4c0c]::passes::start_codegen
  51:     0x700a818ac4ee - <rustc_interface[e7aac3eeb74c4c0c]::queries::Queries>::codegen_and_build_linker
  52:     0x700a816eecd3 - rustc_interface[e7aac3eeb74c4c0c]::interface::run_compiler::<core[7ebb3dbf9c5383ca]::result::Result<(), rustc_span[c8203a7ebedcd79e]::ErrorGuaranteed>, rustc_driver_impl[b1693766bfe96bed]::run_compiler::{closure#0}>::{closure#0}
  53:     0x700a817cc01d - std[8cce646dcc9f51a2]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e7aac3eeb74c4c0c]::util::run_in_thread_with_globals<rustc_interface[e7aac3eeb74c4c0c]::util::run_in_thread_pool_with_globals<rustc_interface[e7aac3eeb74c4c0c]::interface::run_compiler<core[7ebb3dbf9c5383ca]::result::Result<(), rustc_span[c8203a7ebedcd79e]::ErrorGuaranteed>, rustc_driver_impl[b1693766bfe96bed]::run_compiler::{closure#0}>::{closure#0}, core[7ebb3dbf9c5383ca]::result::Result<(), rustc_span[c8203a7ebedcd79e]::ErrorGuaranteed>>::{closure#0}, core[7ebb3dbf9c5383ca]::result::Result<(), rustc_span[c8203a7ebedcd79e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7ebb3dbf9c5383ca]::result::Result<(), rustc_span[c8203a7ebedcd79e]::ErrorGuaranteed>>
  54:     0x700a817cbe2a - <<std[8cce646dcc9f51a2]::thread::Builder>::spawn_unchecked_<rustc_interface[e7aac3eeb74c4c0c]::util::run_in_thread_with_globals<rustc_interface[e7aac3eeb74c4c0c]::util::run_in_thread_pool_with_globals<rustc_interface[e7aac3eeb74c4c0c]::interface::run_compiler<core[7ebb3dbf9c5383ca]::result::Result<(), rustc_span[c8203a7ebedcd79e]::ErrorGuaranteed>, rustc_driver_impl[b1693766bfe96bed]::run_compiler::{closure#0}>::{closure#0}, core[7ebb3dbf9c5383ca]::result::Result<(), rustc_span[c8203a7ebedcd79e]::ErrorGuaranteed>>::{closure#0}, core[7ebb3dbf9c5383ca]::result::Result<(), rustc_span[c8203a7ebedcd79e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[7ebb3dbf9c5383ca]::result::Result<(), rustc_span[c8203a7ebedcd79e]::ErrorGuaranteed>>::{closure#1} as core[7ebb3dbf9c5383ca]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  55:     0x700a82cad28b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hea2f762c1fe3db14
                               at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/alloc/src/boxed.rs:2018:9
  56:     0x700a82cad28b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h79ea2eedb7e4df53
                               at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/alloc/src/boxed.rs:2018:9
  57:     0x700a82cad28b - std::sys::pal::unix::thread::Thread::new::thread_start::h83279d19c2446390
                               at /rustc/537aab7a2e7fe9cdf50b5ff18485e0793cd8db62/library/std/src/sys/pal/unix/thread.rs:108:17
  58:     0x700a7c4a955a - <unknown>
  59:     0x700a7c526a3c - <unknown>
  60:                0x0 - <unknown>

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: rustc 1.79.0-nightly (537aab7a2 2024-04-08) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z sanitizer=kcfi -C panic=abort -Z dump-mir-dir=dir

query stack during panic:
#0 [associated_item] computing associated item data for `alloc::vec::in_place_collect::from_iter_in_place`
#1 [eval_to_allocation_raw] const-evaluating + checking `alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T, I> for alloc::vec::Vec<T>>::from_iter::{constant#0}`
#2 [eval_to_const_value_raw] simplifying constant for the type system `alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T, I> for alloc::vec::Vec<T>>::from_iter::{constant#0}`
#3 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: aborting due to 1 previous error


@matthiaskrgr matthiaskrgr 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 Apr 8, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 8, 2024
@matthiaskrgr matthiaskrgr added the A-sanitizers Area: Sanitizers for correctness and code quality. label Apr 8, 2024
@compiler-errors
Copy link
Member

i feel like this is just another dupe, fixed by #123635

@compiler-errors
Copy link
Member

(and the reason the ice messages are different are bc the items are different DefKinds)

@matthiaskrgr
Copy link
Member Author

mmh when I check the test of #123635 with current master, the ice msg is like the one from #123639

@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sanitizers Area: Sanitizers for correctness and code quality. 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.
Projects
None yet
Development

No branches or pull requests

4 participants