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: compiler/rustc_const_eval/src/util/compare_types.rs #114121

Closed
matthiaskrgr opened this issue Jul 27, 2023 · 1 comment · Fixed by #114123
Closed

ICE: compiler/rustc_const_eval/src/util/compare_types.rs #114121

matthiaskrgr opened this issue Jul 27, 2023 · 1 comment · Fixed by #114123
Labels
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

Code

rustc -Zvalidate-mir

fn main() {
    let _ = Some(())
        .into_iter()
        .flat_map(|_| Some(()).into_iter().flat_map(func));
}

fn func(_: ()) -> impl Iterator<Item = ()> {
    Some(()).into_iter().flat_map(|_| vec![])
}

Meta

rustc --version --verbose:

rustc 1.73.0-nightly (0d95f9132 2023-07-26)
binary: rustc
commit-hash: 0d95f9132909ae7c5f2456748d0ffd1c3ba4a8e8
commit-date: 2023-07-26
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5

Error output

<output>
Backtrace

error: internal compiler error: compiler/rustc_const_eval/src/util/compare_types.rs:60:9: FlatMap<std::option::IntoIter<()>, Vec<()>, [[email protected]:12:35: 12:38]>, FlatMap<std::option::IntoIter<()>, Vec<()>, [[email protected]:12:35: 12:38]>

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/3e11b223d7ad9836babf2d531b0ca6d13ff3f065/compiler/rustc_errors/src/lib.rs:984:33
stack backtrace:
   0:     0x7f798fb8afc1 - std::backtrace_rs::backtrace::libunwind::trace::h34b52eab641761be
                               at /rustc/3e11b223d7ad9836babf2d531b0ca6d13ff3f065/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f798fb8afc1 - std::backtrace_rs::backtrace::trace_unsynchronized::h997dbb2011b5cf9e
                               at /rustc/3e11b223d7ad9836babf2d531b0ca6d13ff3f065/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f798fb8afc1 - std::sys_common::backtrace::_print_fmt::h27d98da531dc62f2
                               at /rustc/3e11b223d7ad9836babf2d531b0ca6d13ff3f065/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f798fb8afc1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6ff5c5befde606a8
                               at /rustc/3e11b223d7ad9836babf2d531b0ca6d13ff3f065/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f798fbf149c - core::fmt::rt::Argument::fmt::h0b78b9d7ed8562d3
                               at /rustc/3e11b223d7ad9836babf2d531b0ca6d13ff3f065/library/core/src/fmt/rt.rs:138:9
   5:     0x7f798fbf149c - core::fmt::write::h941c48da304d4679
                               at /rustc/3e11b223d7ad9836babf2d531b0ca6d13ff3f065/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f798fb7d7ae - std::io::Write::write_fmt::h7504291052467c2e
                               at /rustc/3e11b223d7ad9836babf2d531b0ca6d13ff3f065/library/std/src/io/mod.rs:1714:15
   7:     0x7f798fb8add5 - std::sys_common::backtrace::_print::haa405176d86e9509
                               at /rustc/3e11b223d7ad9836babf2d531b0ca6d13ff3f065/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f798fb8add5 - std::sys_common::backtrace::print::h8cb930c9662fcbe5
                               at /rustc/3e11b223d7ad9836babf2d531b0ca6d13ff3f065/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f798fb8de2a - std::panicking::panic_hook_with_disk_dump::{{closure}}::h69be33a261466836
                               at /rustc/3e11b223d7ad9836babf2d531b0ca6d13ff3f065/library/std/src/panicking.rs:278:22
  10:     0x7f798fb8dac3 - std::panicking::panic_hook_with_disk_dump::h9c509d5bcf8e910f
                               at /rustc/3e11b223d7ad9836babf2d531b0ca6d13ff3f065/library/std/src/panicking.rs:312:9
  11:     0x7f798e9912b9 - rustc_driver_impl[d71bbe132f208e76]::install_ice_hook::{closure#0}
  12:     0x7f798fb8e6d0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h96e6c64033b86051
                               at /rustc/3e11b223d7ad9836babf2d531b0ca6d13ff3f065/library/alloc/src/boxed.rs:2021:9
  13:     0x7f798fb8e6d0 - std::panicking::rust_panic_with_hook::hde8dca79465834eb
                               at /rustc/3e11b223d7ad9836babf2d531b0ca6d13ff3f065/library/std/src/panicking.rs:733:13
  14:     0x7f798e9038e1 - std[5a172474299c65ce]::panicking::begin_panic::<rustc_errors[12aaae0854151d3b]::ExplicitBug>::{closure#0}
  15:     0x7f798e902a66 - std[5a172474299c65ce]::sys_common::backtrace::__rust_end_short_backtrace::<std[5a172474299c65ce]::panicking::begin_panic<rustc_errors[12aaae0854151d3b]::ExplicitBug>::{closure#0}, !>
  16:     0x7f798e9008a6 - std[5a172474299c65ce]::panicking::begin_panic::<rustc_errors[12aaae0854151d3b]::ExplicitBug>
  17:     0x7f798e95ecae - <rustc_errors[12aaae0854151d3b]::HandlerInner>::span_bug::<rustc_span[1b6d8bb2568b90bc]::span_encoding::Span, alloc[8fd9ca7cb32eafa0]::string::String>
  18:     0x7f798e9592af - <rustc_errors[12aaae0854151d3b]::Handler>::span_bug::<rustc_span[1b6d8bb2568b90bc]::span_encoding::Span, alloc[8fd9ca7cb32eafa0]::string::String>
  19:     0x7f798e961cbd - rustc_middle[551ac73590daa449]::util::bug::opt_span_bug_fmt::<rustc_span[1b6d8bb2568b90bc]::span_encoding::Span>::{closure#0}
  20:     0x7f798e961cea - rustc_middle[551ac73590daa449]::ty::context::tls::with_opt::<rustc_middle[551ac73590daa449]::util::bug::opt_span_bug_fmt<rustc_span[1b6d8bb2568b90bc]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f798e961ab8 - rustc_middle[551ac73590daa449]::ty::context::tls::with_context_opt::<rustc_middle[551ac73590daa449]::ty::context::tls::with_opt<rustc_middle[551ac73590daa449]::util::bug::opt_span_bug_fmt<rustc_span[1b6d8bb2568b90bc]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f798ce79784 - rustc_middle[551ac73590daa449]::util::bug::span_bug_fmt::<rustc_span[1b6d8bb2568b90bc]::span_encoding::Span>
  23:     0x7f798d5a22ca - rustc_const_eval[b42dcae41b46c403]::util::compare_types::is_subtype
  24:     0x7f798d70efcf - rustc_const_eval[b42dcae41b46c403]::transform::validate::validate_types
  25:     0x7f798d6f60fc - <rustc_const_eval[b42dcae41b46c403]::transform::validate::Validator as rustc_middle[551ac73590daa449]::mir::MirPass>::run_pass
  26:     0x7f798f172e10 - rustc_mir_transform[f001fc04107e9b9e]::pass_manager::validate_body
  27:     0x7f798d6f1d19 - rustc_mir_transform[f001fc04107e9b9e]::pass_manager::run_passes
  28:     0x7f798dddc250 - rustc_mir_transform[f001fc04107e9b9e]::shim::make_shim
  29:     0x7f798d64682f - rustc_query_impl[af1ff291a4c4850a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[af1ff291a4c4850a]::query_impl::mir_shims::dynamic_query::{closure#2}::{closure#0}, rustc_middle[551ac73590daa449]::query::erase::Erased<[u8; 8usize]>>
  30:     0x7f798d6467ec - <rustc_query_impl[af1ff291a4c4850a]::query_impl::mir_shims::dynamic_query::{closure#2} as core[5a22fc829b0f94e2]::ops::function::FnOnce<(rustc_middle[551ac73590daa449]::ty::context::TyCtxt, rustc_middle[551ac73590daa449]::ty::instance::InstanceDef)>>::call_once
  31:     0x7f798d6eaa70 - rustc_query_system[1c34060796548d21]::query::plumbing::try_execute_query::<rustc_query_impl[af1ff291a4c4850a]::DynamicConfig<rustc_query_system[1c34060796548d21]::query::caches::DefaultCache<rustc_middle[551ac73590daa449]::ty::instance::InstanceDef, rustc_middle[551ac73590daa449]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[af1ff291a4c4850a]::plumbing::QueryCtxt, false>
  32:     0x7f798d6ea783 - rustc_query_impl[af1ff291a4c4850a]::query_impl::mir_shims::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7f798cfb37dc - <rustc_middle[551ac73590daa449]::ty::context::TyCtxt>::instance_mir
  34:     0x7f798ca7d376 - rustc_monomorphize[dbdec64131a9e474]::collector::collect_used_items
  35:     0x7f798ca79d45 - rustc_monomorphize[dbdec64131a9e474]::collector::collect_items_rec
  36:     0x7f798ca7a69c - rustc_monomorphize[dbdec64131a9e474]::collector::collect_items_rec
  37:     0x7f798df37c70 - rustc_data_structures[fb03cc5bd7e189d4]::sync::par_for_each_in::<alloc[8fd9ca7cb32eafa0]::vec::Vec<rustc_middle[551ac73590daa449]::mir::mono::MonoItem>, rustc_monomorphize[dbdec64131a9e474]::collector::collect_crate_mono_items::{closure#1}::{closure#0}>
  38:     0x7f798df37569 - <rustc_session[bd2c67ddbe213558]::session::Session>::time::<(), rustc_monomorphize[dbdec64131a9e474]::collector::collect_crate_mono_items::{closure#1}>
  39:     0x7f798df371c8 - rustc_monomorphize[dbdec64131a9e474]::collector::collect_crate_mono_items
  40:     0x7f798df357a7 - rustc_monomorphize[dbdec64131a9e474]::partitioning::collect_and_partition_mono_items
  41:     0x7f798df8ea19 - rustc_query_impl[af1ff291a4c4850a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[af1ff291a4c4850a]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle[551ac73590daa449]::query::erase::Erased<[u8; 24usize]>>
  42:     0x7f798df8e9eb - <rustc_query_impl[af1ff291a4c4850a]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core[5a22fc829b0f94e2]::ops::function::FnOnce<(rustc_middle[551ac73590daa449]::ty::context::TyCtxt, ())>>::call_once
  43:     0x7f798e07552c - rustc_query_system[1c34060796548d21]::query::plumbing::try_execute_query::<rustc_query_impl[af1ff291a4c4850a]::DynamicConfig<rustc_query_system[1c34060796548d21]::query::caches::SingleCache<rustc_middle[551ac73590daa449]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[af1ff291a4c4850a]::plumbing::QueryCtxt, false>
  44:     0x7f798e30adb8 - rustc_query_impl[af1ff291a4c4850a]::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace
  45:     0x7f798da6f5e6 - rustc_codegen_ssa[68214238dbe7e393]::base::codegen_crate::<rustc_codegen_llvm[63aadcf8e14e7030]::LlvmCodegenBackend>
  46:     0x7f798da6f3cb - <rustc_codegen_llvm[63aadcf8e14e7030]::LlvmCodegenBackend as rustc_codegen_ssa[68214238dbe7e393]::traits::backend::CodegenBackend>::codegen_crate
  47:     0x7f798dbd8a32 - <rustc_session[bd2c67ddbe213558]::session::Session>::time::<alloc[8fd9ca7cb32eafa0]::boxed::Box<dyn core[5a22fc829b0f94e2]::any::Any>, rustc_interface[5284e2ff6730c6a0]::passes::start_codegen::{closure#0}>
  48:     0x7f798dbd85ab - rustc_interface[5284e2ff6730c6a0]::passes::start_codegen
  49:     0x7f798dbd323a - <rustc_middle[551ac73590daa449]::ty::context::GlobalCtxt>::enter::<<rustc_interface[5284e2ff6730c6a0]::queries::Queries>::ongoing_codegen::{closure#0}, core[5a22fc829b0f94e2]::result::Result<alloc[8fd9ca7cb32eafa0]::boxed::Box<dyn core[5a22fc829b0f94e2]::any::Any>, rustc_span[1b6d8bb2568b90bc]::ErrorGuaranteed>>
  50:     0x7f798dbd2273 - <rustc_interface[5284e2ff6730c6a0]::interface::Compiler>::enter::<rustc_driver_impl[d71bbe132f208e76]::run_compiler::{closure#1}::{closure#2}, core[5a22fc829b0f94e2]::result::Result<core[5a22fc829b0f94e2]::option::Option<rustc_interface[5284e2ff6730c6a0]::queries::Linker>, rustc_span[1b6d8bb2568b90bc]::ErrorGuaranteed>>
  51:     0x7f798dbcb2b8 - std[5a172474299c65ce]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[5284e2ff6730c6a0]::util::run_in_thread_pool_with_globals<rustc_interface[5284e2ff6730c6a0]::interface::run_compiler<core[5a22fc829b0f94e2]::result::Result<(), rustc_span[1b6d8bb2568b90bc]::ErrorGuaranteed>, rustc_driver_impl[d71bbe132f208e76]::run_compiler::{closure#1}>::{closure#0}, core[5a22fc829b0f94e2]::result::Result<(), rustc_span[1b6d8bb2568b90bc]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5a22fc829b0f94e2]::result::Result<(), rustc_span[1b6d8bb2568b90bc]::ErrorGuaranteed>>
  52:     0x7f798dbcaa3e - <<std[5a172474299c65ce]::thread::Builder>::spawn_unchecked_<rustc_interface[5284e2ff6730c6a0]::util::run_in_thread_pool_with_globals<rustc_interface[5284e2ff6730c6a0]::interface::run_compiler<core[5a22fc829b0f94e2]::result::Result<(), rustc_span[1b6d8bb2568b90bc]::ErrorGuaranteed>, rustc_driver_impl[d71bbe132f208e76]::run_compiler::{closure#1}>::{closure#0}, core[5a22fc829b0f94e2]::result::Result<(), rustc_span[1b6d8bb2568b90bc]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5a22fc829b0f94e2]::result::Result<(), rustc_span[1b6d8bb2568b90bc]::ErrorGuaranteed>>::{closure#1} as core[5a22fc829b0f94e2]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  53:     0x7f798fb98dc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hcc1b1a287409c317
                               at /rustc/3e11b223d7ad9836babf2d531b0ca6d13ff3f065/library/alloc/src/boxed.rs:2007:9
  54:     0x7f798fb98dc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h64035a7c0604b910
                               at /rustc/3e11b223d7ad9836babf2d531b0ca6d13ff3f065/library/alloc/src/boxed.rs:2007:9
  55:     0x7f798fb98dc5 - std::sys::unix::thread::Thread::new::thread_start::h79af870cb7bf2b35
                               at /rustc/3e11b223d7ad9836babf2d531b0ca6d13ff3f065/library/std/src/sys/unix/thread.rs:108:17
  56:     0x7f798b69d44b - <unknown>
  57:     0x7f798b720e40 - <unknown>
  58:                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: please attach the file at `/tmp/F/src/rustc-ice-2023-07-27T07:37:57.570831686Z-951469.txt` to your bug report

note: compiler flags: -Z validate-mir

query stack during panic:
#0 [mir_shims] generating MIR shim for `core::ptr::drop_in_place`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: aborting due to 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 Jul 27, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 27, 2023
@matthiaskrgr
Copy link
Member Author

#113661 cc @oli-obk

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) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants