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: collection encountered polymorphic constant #108152

Closed
saethlin opened this issue Feb 17, 2023 · 3 comments
Closed

ICE: collection encountered polymorphic constant #108152

saethlin opened this issue Feb 17, 2023 · 3 comments
Labels
A-const-generics Area: const generics (parameters and arguments) 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 F-generic_const_exprs `#![feature(generic_const_exprs)]` 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

@saethlin
Copy link
Member

ICE with -Zstrict-init-checks when compiling sci-rs v0.1.8

Meta

rustc --version --verbose:

rustc 1.69.0-nightly (2d14db321 2023-02-15)
binary: rustc
commit-hash: 2d14db321b043ffc579a7461464c88d7e3f54f83
commit-date: 2023-02-15
host: x86_64-unknown-linux-gnu
release: 1.69.0-nightly
LLVM version: 15.0.7

Error output

error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:786:54: collection encountered polymorphic constant: Unevaluated(UnevaluatedConst { def: WithOptConstParam { did: DefId(35:1008 ~ heapless[ed6d]::vec::{impl#0}::INIT), const_param_did: None }, substs: [nalgebra::Complex<f64>, Const { ty: usize, kind: Unevaluated(UnevaluatedConst { def: WithOptConstParam { did: DefId(0:426 ~ sci_rs[f7c7]::signal::filter::design::zpk2tf::poly_st::{constant#2}), const_param_did: Some(DefId(35:1000 ~ heapless[ed6d]::vec::Vec::N)) }, substs: [nalgebra::Complex<f64>, Const { ty: usize, kind: Expr(Binop(Mul, Const { ty: usize, kind: Value(Leaf(0x0000000000000004)) }, Const { ty: usize, kind: Value(Leaf(0x0000000000000002)) })) }] }) }], promoted: None }, [std::mem::MaybeUninit<nalgebra::Complex<f64>>; { N + 1 }])
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/heapless-0.7.16/src/vec.rs:70:21
   |
70 |             buffer: Self::INIT,
   |                     ^^^^^^^^^^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/2d14db321b043ffc579a7461464c88d7e3f54f83/compiler/rustc_errors/src/lib.rs:991:33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.69.0-nightly (2d14db321 2023-02-15) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C linker=clang -Z randomize-layout -C opt-level=0 -C debuginfo=0 -Z validate-mir -C debug-assertions=on -Z extra-const-ub-checks -Z strict-init-checks

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

query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: could not compile `sci-rs`
Backtrace

error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:786:54: collection encountered polymorphic constant: Unevaluated(UnevaluatedConst { def: WithOptConstParam { did: DefId(35:1008 ~ heapless[ed6d]::vec::{impl#0}::INIT), const_param_did: None }, substs: [nalgebra::Complex<f64>, Const { ty: usize, kind: Unevaluated(UnevaluatedConst { def: WithOptConstParam { did: DefId(0:426 ~ sci_rs[c0cf]::signal::filter::design::zpk2tf::poly_st::{constant#2}), const_param_did: Some(DefId(35:1000 ~ heapless[ed6d]::vec::Vec::N)) }, substs: [nalgebra::Complex<f64>, Const { ty: usize, kind: Expr(Binop(Mul, Const { ty: usize, kind: Value(Leaf(0x0000000000000004)) }, Const { ty: usize, kind: Value(Leaf(0x0000000000000002)) })) }] }) }], promoted: None }, [std::mem::MaybeUninit<nalgebra::Complex<f64>>; { N + 1 }])
  --> /home/ben/.cargo/registry/src/github.com-1ecc6299db9ec823/heapless-0.7.16/src/vec.rs:70:21
   |
70 |             buffer: Self::INIT,
   |                     ^^^^^^^^^^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/2d14db321b043ffc579a7461464c88d7e3f54f83/compiler/rustc_errors/src/lib.rs:991:33
stack backtrace:
   0:     0x7f640836a9ea - std::backtrace_rs::backtrace::libunwind::trace::h3a20221a56d872e6
                               at /rustc/2d14db321b043ffc579a7461464c88d7e3f54f83/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f640836a9ea - std::backtrace_rs::backtrace::trace_unsynchronized::h23863182fd4b4481
                               at /rustc/2d14db321b043ffc579a7461464c88d7e3f54f83/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f640836a9ea - std::sys_common::backtrace::_print_fmt::hde799c83b2fa8ddb
                               at /rustc/2d14db321b043ffc579a7461464c88d7e3f54f83/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f640836a9ea - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb1ed906e28a16738
                               at /rustc/2d14db321b043ffc579a7461464c88d7e3f54f83/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f64083caafe - core::fmt::write::hee7bc8dd2696f088
                               at /rustc/2d14db321b043ffc579a7461464c88d7e3f54f83/library/core/src/fmt/mod.rs:1232:17
   5:     0x7f640835b005 - std::io::Write::write_fmt::h031e716f6e3d1f66
                               at /rustc/2d14db321b043ffc579a7461464c88d7e3f54f83/library/std/src/io/mod.rs:1684:15
   6:     0x7f640836a7b5 - std::sys_common::backtrace::_print::h8cea91a8dc3abdb3
                               at /rustc/2d14db321b043ffc579a7461464c88d7e3f54f83/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f640836a7b5 - std::sys_common::backtrace::print::hcd9f90783d8afb1f
                               at /rustc/2d14db321b043ffc579a7461464c88d7e3f54f83/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f640836d54f - std::panicking::default_hook::{{closure}}::hdf7c561ea2419acd
                               at /rustc/2d14db321b043ffc579a7461464c88d7e3f54f83/library/std/src/panicking.rs:267:22
   9:     0x7f640836d28b - std::panicking::default_hook::h9669759e65745add
                               at /rustc/2d14db321b043ffc579a7461464c88d7e3f54f83/library/std/src/panicking.rs:286:9
  10:     0x7f640b6b8c44 - <rustc_driver_impl[cf5be2d75a70ff02]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[f0a84df7292b9247]::ops::function::FnOnce<(&core[f0a84df7292b9247]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f640836dd8a - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h71e54ddf4b01f8ef
                               at /rustc/2d14db321b043ffc579a7461464c88d7e3f54f83/library/alloc/src/boxed.rs:2002:9
  12:     0x7f640836dd8a - std::panicking::rust_panic_with_hook::h96419a4a3670d907
                               at /rustc/2d14db321b043ffc579a7461464c88d7e3f54f83/library/std/src/panicking.rs:692:13
  13:     0x7f640be674e1 - std[f1e96740c585910a]::panicking::begin_panic::<rustc_errors[580ee8295c6eeddb]::ExplicitBug>::{closure#0}
  14:     0x7f640be67256 - std[f1e96740c585910a]::sys_common::backtrace::__rust_end_short_backtrace::<std[f1e96740c585910a]::panicking::begin_panic<rustc_errors[580ee8295c6eeddb]::ExplicitBug>::{closure#0}, !>
  15:     0x7f640be76596 - std[f1e96740c585910a]::panicking::begin_panic::<rustc_errors[580ee8295c6eeddb]::ExplicitBug>
  16:     0x7f640be64596 - std[f1e96740c585910a]::panic::panic_any::<rustc_errors[580ee8295c6eeddb]::ExplicitBug>
  17:     0x7f640be641f9 - <rustc_errors[580ee8295c6eeddb]::HandlerInner>::span_bug::<rustc_span[ff2b83d94cd5766c]::span_encoding::Span, &alloc[70e88cfb93c54582]::string::String>
  18:     0x7f640be63ff0 - <rustc_errors[580ee8295c6eeddb]::Handler>::span_bug::<rustc_span[ff2b83d94cd5766c]::span_encoding::Span, &alloc[70e88cfb93c54582]::string::String>
  19:     0x7f640be64aeb - rustc_middle[bd03a598433729a4]::util::bug::opt_span_bug_fmt::<rustc_span[ff2b83d94cd5766c]::span_encoding::Span>::{closure#0}
  20:     0x7f640be64b3a - rustc_middle[bd03a598433729a4]::ty::context::tls::with_opt::<rustc_middle[bd03a598433729a4]::util::bug::opt_span_bug_fmt<rustc_span[ff2b83d94cd5766c]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f640be64676 - rustc_middle[bd03a598433729a4]::ty::context::tls::with_context_opt::<rustc_middle[bd03a598433729a4]::ty::context::tls::with_opt<rustc_middle[bd03a598433729a4]::util::bug::opt_span_bug_fmt<rustc_span[ff2b83d94cd5766c]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f640be64616 - rustc_middle[bd03a598433729a4]::util::bug::opt_span_bug_fmt::<rustc_span[ff2b83d94cd5766c]::span_encoding::Span>
  23:     0x7f640be645d4 - rustc_middle[bd03a598433729a4]::util::bug::span_bug_fmt::<rustc_span[ff2b83d94cd5766c]::span_encoding::Span>
  24:     0x7f640a6b9608 - rustc_monomorphize[4cc087e4339a3b81]::collector::collect_neighbours
  25:     0x7f640a6a9a3a - rustc_monomorphize[4cc087e4339a3b81]::collector::collect_items_rec
  26:     0x7f640a6a9ee8 - rustc_monomorphize[4cc087e4339a3b81]::collector::collect_items_rec
  27:     0x7f640a6a9ee8 - rustc_monomorphize[4cc087e4339a3b81]::collector::collect_items_rec
  28:     0x7f640a6a9ee8 - rustc_monomorphize[4cc087e4339a3b81]::collector::collect_items_rec
  29:     0x7f640a6a9ee8 - rustc_monomorphize[4cc087e4339a3b81]::collector::collect_items_rec
  30:     0x7f640a6a9ee8 - rustc_monomorphize[4cc087e4339a3b81]::collector::collect_items_rec
  31:     0x7f640a6a9ee8 - rustc_monomorphize[4cc087e4339a3b81]::collector::collect_items_rec
  32:     0x7f640a6a9ee8 - rustc_monomorphize[4cc087e4339a3b81]::collector::collect_items_rec
  33:     0x7f640aba2822 - <rustc_session[130bf05e2988f5fc]::session::Session>::time::<(), rustc_monomorphize[4cc087e4339a3b81]::collector::collect_crate_mono_items::{closure#1}>
  34:     0x7f640aba21d4 - rustc_monomorphize[4cc087e4339a3b81]::collector::collect_crate_mono_items
  35:     0x7f640aba07d0 - rustc_monomorphize[4cc087e4339a3b81]::partitioning::collect_and_partition_mono_items
  36:     0x7f640ae67a5d - <rustc_query_system[9c20c97984254eda]::dep_graph::graph::DepGraph<rustc_middle[bd03a598433729a4]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[bd03a598433729a4]::ty::context::TyCtxt, (), (&rustc_data_structures[4cb054fd51de001a]::unord::UnordSet<rustc_span[ff2b83d94cd5766c]::def_id::DefId>, &[rustc_middle[bd03a598433729a4]::mir::mono::CodegenUnit])>
  37:     0x7f640ae673ac - rustc_query_system[9c20c97984254eda]::query::plumbing::try_execute_query::<rustc_query_impl[e25e6056fa54423]::queries::collect_and_partition_mono_items, rustc_query_impl[e25e6056fa54423]::plumbing::QueryCtxt>
  38:     0x7f640b04b182 - <rustc_query_impl[e25e6056fa54423]::Queries as rustc_middle[bd03a598433729a4]::ty::query::QueryEngine>::collect_and_partition_mono_items
  39:     0x7f640ac7fdd3 - rustc_codegen_ssa[d775a2dcabf3140d]::base::codegen_crate::<rustc_codegen_llvm[cb4b49b4ef71e669]::LlvmCodegenBackend>
  40:     0x7f640ac7fb9e - <rustc_codegen_llvm[cb4b49b4ef71e669]::LlvmCodegenBackend as rustc_codegen_ssa[d775a2dcabf3140d]::traits::backend::CodegenBackend>::codegen_crate
  41:     0x7f640a8cdbd1 - <rustc_session[130bf05e2988f5fc]::session::Session>::time::<alloc[70e88cfb93c54582]::boxed::Box<dyn core[f0a84df7292b9247]::any::Any>, rustc_interface[e19372daae8a4d61]::passes::start_codegen::{closure#0}>
  42:     0x7f640a8cd6f9 - rustc_interface[e19372daae8a4d61]::passes::start_codegen
  43:     0x7f640a8c8298 - <rustc_middle[bd03a598433729a4]::ty::context::GlobalCtxt>::enter::<<rustc_interface[e19372daae8a4d61]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[f0a84df7292b9247]::result::Result<alloc[70e88cfb93c54582]::boxed::Box<dyn core[f0a84df7292b9247]::any::Any>, rustc_errors[580ee8295c6eeddb]::ErrorGuaranteed>>
  44:     0x7f640a8c7484 - <rustc_interface[e19372daae8a4d61]::queries::Queries>::ongoing_codegen
  45:     0x7f640a8c6a4d - <rustc_interface[e19372daae8a4d61]::interface::Compiler>::enter::<rustc_driver_impl[cf5be2d75a70ff02]::run_compiler::{closure#1}::{closure#2}, core[f0a84df7292b9247]::result::Result<core[f0a84df7292b9247]::option::Option<rustc_interface[e19372daae8a4d61]::queries::Linker>, rustc_errors[580ee8295c6eeddb]::ErrorGuaranteed>>
  46:     0x7f640a8c4b04 - rustc_span[ff2b83d94cd5766c]::with_source_map::<core[f0a84df7292b9247]::result::Result<(), rustc_errors[580ee8295c6eeddb]::ErrorGuaranteed>, rustc_interface[e19372daae8a4d61]::interface::run_compiler<core[f0a84df7292b9247]::result::Result<(), rustc_errors[580ee8295c6eeddb]::ErrorGuaranteed>, rustc_driver_impl[cf5be2d75a70ff02]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  47:     0x7f640a8c4614 - <scoped_tls[94748c71a964531c]::ScopedKey<rustc_span[ff2b83d94cd5766c]::SessionGlobals>>::set::<rustc_interface[e19372daae8a4d61]::interface::run_compiler<core[f0a84df7292b9247]::result::Result<(), rustc_errors[580ee8295c6eeddb]::ErrorGuaranteed>, rustc_driver_impl[cf5be2d75a70ff02]::run_compiler::{closure#1}>::{closure#0}, core[f0a84df7292b9247]::result::Result<(), rustc_errors[580ee8295c6eeddb]::ErrorGuaranteed>>
  48:     0x7f640a8c3d12 - std[f1e96740c585910a]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e19372daae8a4d61]::util::run_in_thread_pool_with_globals<rustc_interface[e19372daae8a4d61]::interface::run_compiler<core[f0a84df7292b9247]::result::Result<(), rustc_errors[580ee8295c6eeddb]::ErrorGuaranteed>, rustc_driver_impl[cf5be2d75a70ff02]::run_compiler::{closure#1}>::{closure#0}, core[f0a84df7292b9247]::result::Result<(), rustc_errors[580ee8295c6eeddb]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f0a84df7292b9247]::result::Result<(), rustc_errors[580ee8295c6eeddb]::ErrorGuaranteed>>
  49:     0x7f640a8c3abc - <<std[f1e96740c585910a]::thread::Builder>::spawn_unchecked_<rustc_interface[e19372daae8a4d61]::util::run_in_thread_pool_with_globals<rustc_interface[e19372daae8a4d61]::interface::run_compiler<core[f0a84df7292b9247]::result::Result<(), rustc_errors[580ee8295c6eeddb]::ErrorGuaranteed>, rustc_driver_impl[cf5be2d75a70ff02]::run_compiler::{closure#1}>::{closure#0}, core[f0a84df7292b9247]::result::Result<(), rustc_errors[580ee8295c6eeddb]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f0a84df7292b9247]::result::Result<(), rustc_errors[580ee8295c6eeddb]::ErrorGuaranteed>>::{closure#1} as core[f0a84df7292b9247]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  50:     0x7f6408377d23 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6f3268749d03f717
                               at /rustc/2d14db321b043ffc579a7461464c88d7e3f54f83/library/alloc/src/boxed.rs:1988:9
  51:     0x7f6408377d23 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he030b34c5a5b9772
                               at /rustc/2d14db321b043ffc579a7461464c88d7e3f54f83/library/alloc/src/boxed.rs:1988:9
  52:     0x7f6408377d23 - std::sys::unix::thread::Thread::new::thread_start::h3f952212e35a76cc
                               at /rustc/2d14db321b043ffc579a7461464c88d7e3f54f83/library/std/src/sys/unix/thread.rs:108:17
  53:     0x7f6408107bb5 - <unknown>
  54:     0x7f6408189d90 - <unknown>
  55:                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.69.0-nightly (2d14db321 2023-02-15) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C linker=clang -C incremental=[REDACTED] -Z strict-init-checks

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

query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: could not compile `sci-rs`

@rustbot label +E-needs-mcve

@saethlin saethlin 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 Feb 17, 2023
@rustbot rustbot added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Feb 17, 2023
@saethlin saethlin changed the title collection encountered polymorphic constant ICE: collection encountered polymorphic constant Feb 17, 2023
@BoxyUwU
Copy link
Member

BoxyUwU commented Feb 17, 2023

Judging by the N + 1 in the backtrace I assume this is a generic_const_exprs issue

@BoxyUwU BoxyUwU added A-const-generics Area: const generics (parameters and arguments) F-generic_const_exprs `#![feature(generic_const_exprs)]` labels Feb 17, 2023
@trueb2
Copy link
Contributor

trueb2 commented Mar 16, 2023

This is a duplicate of #106423

@saethlin
Copy link
Member Author

Thanks for identifying that!

@saethlin saethlin closed this as not planned Won't fix, can't repro, duplicate, stale Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) 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 F-generic_const_exprs `#![feature(generic_const_exprs)]` 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