Repository navigation
ICE: collection encountered polymorphic constant: UnevaluatedConst #106423
Copy link
Copy link
Closed
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)C-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.F-generic_const_exprs`#![feature(generic_const_exprs)]``#![feature(generic_const_exprs)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityMedium priorityS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
Description
Code
use rand::prelude::*;
use std::time::Instant;
use sci_rs::signal::filter::{design::Sos, sosfilt_dyn};
use sci_rs::signal::filter::design::{butter_st, FilterBandType, FilterOutputType};
fn main() {
let mut rng = rand::thread_rng();
let vals: Vec<f64> = (0..25000*120).map(|_| rng.gen()).collect();
// let y = Array1::from_vec(vec![0.0, 0.09414586007215595, 0.18745540640340155, ...]);
let filter = butter_st::<f64,4,2>(
[10.,50.],
Some(FilterBandType::Bandpass),
Some(false),
Some(FilterOutputType::Zpk),
Some(1666.)
);
// check filter params
println!("{:?}",filter)
}Meta
rustc --version --verbose:
rustc 1.68.0-nightly (d6f99e535 2023-01-02)
binary: rustc
commit-hash: d6f99e535a301a421dfee52a7c25bb4bdf420344
commit-date: 2023-01-02
host: aarch64-apple-darwin
release: 1.68.0-nightly
LLVM version: 15.0.6
Error output
error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:786:54: collection encountered polymorphic constant: Unevaluated(UnevaluatedConst { def: WithOptConstParam { did: DefId(43:1008 ~ heapless[99d5]::vec::{impl#0}::INIT), const_param_did: None }, substs: [num_complex::Complex<f64>, Const { ty: usize, kind: Unevaluated(UnevaluatedConst { def: WithOptConstParam { did: DefId(27:400 ~ sci_rs[d81d]::signal::filter::design::zpk2tf::poly_st::{constant#2}), const_param_did: Some(DefId(43:1000 ~ heapless[99d5]::vec::Vec::N)) }, substs: [num_complex::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<num_complex::Complex<f64>>; _])
--> /Users/blubafc1/.cargo/registry/src/github.life-white.uk-1ecc6299db9ec823/heapless-0.7.16/src/vec.rs:70:21
|
70 | buffer: Self::INIT,
| ^^^^^^^^^^
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/d6f99e535a301a421dfee52a7c25bb4bdf420344/compiler/rustc_errors/src/lib.rs:978:33
Backtrace
stack backtrace:
0: 0x1054f9bac - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hea68b7b20126fcc2
1: 0x10554b30c - core::fmt::write::h76ef1456439f6e44
2: 0x1054ed404 - std::io::Write::write_fmt::ha1f61edbd5acf3b5
3: 0x1054f99c0 - std::sys_common::backtrace::print::h8649bc4326f5f277
4: 0x1054fc4f4 - std::panicking::default_hook::{{closure}}::h7887887a17185173
5: 0x1054fc24c - std::panicking::default_hook::h197221548797e88a
6: 0x10d73b324 - rustc_driver[69cf2497f4e7534a]::DEFAULT_HOOK::{closure#0}::{closure#0}
7: 0x1054fcbec - std::panicking::rust_panic_with_hook::h0e871605208fade7
8: 0x10fcff64c - std[8e1853b45c5b494b]::panicking::begin_panic::<rustc_errors[e6281b614dbb5e3f]::ExplicitBug>::{closure#0}
9: 0x10fcfef20 - std[8e1853b45c5b494b]::sys_common::backtrace::__rust_end_short_backtrace::<std[8e1853b45c5b494b]::panicking::begin_panic<rustc_errors[e6281b614dbb5e3f]::ExplicitBug>::{closure#0}, !>
10: 0x11197db58 - std[8e1853b45c5b494b]::panicking::begin_panic::<rustc_errors[e6281b614dbb5e3f]::ExplicitBug>
11: 0x10fd151d8 - std[8e1853b45c5b494b]::panic::panic_any::<rustc_errors[e6281b614dbb5e3f]::ExplicitBug>
12: 0x10fd145c8 - <rustc_errors[e6281b614dbb5e3f]::HandlerInner>::span_bug::<rustc_span[35545e7b8de4724]::span_encoding::Span, &alloc[5863fc2f9119b42e]::string::String>
13: 0x10fd1440c - <rustc_errors[e6281b614dbb5e3f]::Handler>::span_bug::<rustc_span[35545e7b8de4724]::span_encoding::Span, &alloc[5863fc2f9119b42e]::string::String>
14: 0x10fd1536c - rustc_middle[6ee9a7af4dced80c]::ty::context::tls::with_context_opt::<rustc_middle[6ee9a7af4dced80c]::ty::context::tls::with_opt<rustc_middle[6ee9a7af4dced80c]::util::bug::opt_span_bug_fmt<rustc_span[35545e7b8de4724]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
15: 0x10fd15238 - rustc_middle[6ee9a7af4dced80c]::util::bug::opt_span_bug_fmt::<rustc_span[35545e7b8de4724]::span_encoding::Span>
16: 0x111984ce8 - rustc_middle[6ee9a7af4dced80c]::util::bug::span_bug_fmt::<rustc_span[35545e7b8de4724]::span_encoding::Span>
17: 0x10fcf0178 - <rustc_monomorphize[674d628f34238242]::collector::MirNeighborCollector as rustc_middle[6ee9a7af4dced80c]::mir::visit::Visitor>::visit_constant
18: 0x10fcebbd4 - <rustc_monomorphize[674d628f34238242]::collector::MirNeighborCollector as rustc_middle[6ee9a7af4dced80c]::mir::visit::Visitor>::visit_operand
19: 0x10fceab50 - <rustc_monomorphize[674d628f34238242]::collector::MirNeighborCollector as rustc_middle[6ee9a7af4dced80c]::mir::visit::Visitor>::visit_rvalue
20: 0x10fcf1128 - rustc_monomorphize[674d628f34238242]::collector::collect_neighbours
21: 0x10fcef290 - rustc_monomorphize[674d628f34238242]::collector::collect_items_rec
22: 0x10fcef708 - rustc_monomorphize[674d628f34238242]::collector::collect_items_rec
23: 0x10fcef708 - rustc_monomorphize[674d628f34238242]::collector::collect_items_rec
24: 0x10fcef708 - rustc_monomorphize[674d628f34238242]::collector::collect_items_rec
25: 0x10fcef708 - rustc_monomorphize[674d628f34238242]::collector::collect_items_rec
26: 0x10fcef708 - rustc_monomorphize[674d628f34238242]::collector::collect_items_rec
27: 0x10fcf7f04 - std[8e1853b45c5b494b]::panicking::try::<(), core[584ed36222eb190f]::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures[b95ec3f837caec24]::sync::par_for_each_in<alloc[5863fc2f9119b42e]::vec::Vec<rustc_middle[6ee9a7af4dced80c]::mir::mono::MonoItem>, rustc_monomorphize[674d628f34238242]::collector::collect_crate_mono_items::{closure#1}::{closure#0}>::{closure#0}::{closure#0}>>
28: 0x10fd0df24 - <rustc_session[3969ec7f4fda3833]::session::Session>::time::<(), rustc_monomorphize[674d628f34238242]::collector::collect_crate_mono_items::{closure#1}>
29: 0x10fced448 - rustc_monomorphize[674d628f34238242]::collector::collect_crate_mono_items
30: 0x10fcf5600 - rustc_monomorphize[674d628f34238242]::partitioning::collect_and_partition_mono_items
31: 0x11080110c - rustc_query_system[4bcc622c2d45b20f]::query::plumbing::try_execute_query::<rustc_query_impl[6aadb7c2b2165783]::queries::collect_and_partition_mono_items, rustc_query_impl[6aadb7c2b2165783]::plumbing::QueryCtxt>
32: 0x110951548 - <rustc_query_impl[6aadb7c2b2165783]::Queries as rustc_middle[6ee9a7af4dced80c]::ty::query::QueryEngine>::collect_and_partition_mono_items
33: 0x10d84c27c - rustc_codegen_ssa[3b93f269012db227]::base::codegen_crate::<rustc_codegen_llvm[fb132dddf7640da0]::LlvmCodegenBackend>
34: 0x10d9374f4 - <rustc_codegen_llvm[fb132dddf7640da0]::LlvmCodegenBackend as rustc_codegen_ssa[3b93f269012db227]::traits::backend::CodegenBackend>::codegen_crate
35: 0x10d7b2aa8 - <rustc_session[3969ec7f4fda3833]::session::Session>::time::<alloc[5863fc2f9119b42e]::boxed::Box<dyn core[584ed36222eb190f]::any::Any>, rustc_interface[99b2e32c496d056e]::passes::start_codegen::{closure#0}>
36: 0x10d7cfc24 - rustc_interface[99b2e32c496d056e]::passes::start_codegen
37: 0x10d7cec2c - <rustc_interface[99b2e32c496d056e]::passes::QueryContext>::enter::<<rustc_interface[99b2e32c496d056e]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[584ed36222eb190f]::result::Result<alloc[5863fc2f9119b42e]::boxed::Box<dyn core[584ed36222eb190f]::any::Any>, rustc_errors[e6281b614dbb5e3f]::ErrorGuaranteed>>
38: 0x10d822f10 - <rustc_interface[99b2e32c496d056e]::queries::Queries>::ongoing_codegen
39: 0x10d71759c - rustc_span[35545e7b8de4724]::with_source_map::<core[584ed36222eb190f]::result::Result<(), rustc_errors[e6281b614dbb5e3f]::ErrorGuaranteed>, rustc_interface[99b2e32c496d056e]::interface::run_compiler<core[584ed36222eb190f]::result::Result<(), rustc_errors[e6281b614dbb5e3f]::ErrorGuaranteed>, rustc_driver[69cf2497f4e7534a]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
40: 0x10d70b0d8 - <scoped_tls[c35d5098e8adf783]::ScopedKey<rustc_span[35545e7b8de4724]::SessionGlobals>>::set::<rustc_interface[99b2e32c496d056e]::interface::run_compiler<core[584ed36222eb190f]::result::Result<(), rustc_errors[e6281b614dbb5e3f]::ErrorGuaranteed>, rustc_driver[69cf2497f4e7534a]::run_compiler::{closure#1}>::{closure#0}, core[584ed36222eb190f]::result::Result<(), rustc_errors[e6281b614dbb5e3f]::ErrorGuaranteed>>
41: 0x10d6e0180 - std[8e1853b45c5b494b]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[99b2e32c496d056e]::util::run_in_thread_pool_with_globals<rustc_interface[99b2e32c496d056e]::interface::run_compiler<core[584ed36222eb190f]::result::Result<(), rustc_errors[e6281b614dbb5e3f]::ErrorGuaranteed>, rustc_driver[69cf2497f4e7534a]::run_compiler::{closure#1}>::{closure#0}, core[584ed36222eb190f]::result::Result<(), rustc_errors[e6281b614dbb5e3f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[584ed36222eb190f]::result::Result<(), rustc_errors[e6281b614dbb5e3f]::ErrorGuaranteed>>
42: 0x10d6c6638 - <<std[8e1853b45c5b494b]::thread::Builder>::spawn_unchecked_<rustc_interface[99b2e32c496d056e]::util::run_in_thread_pool_with_globals<rustc_interface[99b2e32c496d056e]::interface::run_compiler<core[584ed36222eb190f]::result::Result<(), rustc_errors[e6281b614dbb5e3f]::ErrorGuaranteed>, rustc_driver[69cf2497f4e7534a]::run_compiler::{closure#1}>::{closure#0}, core[584ed36222eb190f]::result::Result<(), rustc_errors[e6281b614dbb5e3f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[584ed36222eb190f]::result::Result<(), rustc_errors[e6281b614dbb5e3f]::ErrorGuaranteed>>::{closure#1} as core[584ed36222eb190f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
43: 0x105505624 - std::sys::unix::thread::Thread::new::thread_start::h7328e7d271fec60e
44: 0x1b4f1c26c - __pthread_deallocate
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)C-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.F-generic_const_exprs`#![feature(generic_const_exprs)]``#![feature(generic_const_exprs)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityMedium priorityS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
Activity
[-]Compiler Crashes on Heapless Mac M1[/-][+]error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:786:54[/+]trueb2 commentedon Jan 5, 2023
Hi @frankblubaugh, cool to see someone interested in sci-rs. sci-rs makes heavy use of const generic sized arrays (provided by heapless) to allow functionality for no_std. I hit several ICEs across several nightly versions, while putting together the current crate functionality. Do be warned to keep track of what nightly works for you if you plan to use the crate as it is now. The features required by sci-rs are
#![feature(generic_const_exprs, generic_arg_infer)], which are known to be undergoing changes.I find that the internal compiler error hits in 2022-11-27 but not 2022-11-26. I tried both the aarch64-apple-ios and aarch64-apple-darwin targets on a library that uses sci-rs like your example.
sci-rs has a lot of const generic usage. The call that crashed was way down inside of the butter_st call near poly_st and heapless. Here is an example of how the functions calls use computed const generic values to compute math on the stack for no_std compatibility in this call tree.
Additionally, here is a call site for poly_st
SantaRedux commentedon Jan 10, 2023
searched nightlies: from nightly-2022-11-25 to nightly-2022-12-01
regressed nightly: nightly-2022-11-27
searched commit range: 8681d4c...80a9646
regressed commit: aff003b
bisected with cargo-bisect-rustc v0.6.5
Host triple: aarch64-apple-darwin
Reproduce with:
jyn514 commentedon Jan 10, 2023
cc @JulianKnodt @BoxyUwU
apiraino commentedon Jan 10, 2023
WG-prioritization assigning priority (Zulip discussion).
@rustbot label -I-prioritize +P-medium
12 remaining items
Rust ICE: rust-lang/rust#106423
Mark-Simulacrum commentedon Mar 3, 2023
Given this is tagged with requires-nightly, I don't think it qualifies as a beta regression. Removing that label.
JohnTitor commentedon Oct 15, 2023
Triage: Fixed on the latest nightly, marking as E-needs-test
@rustbot labels: +E-needs-test
add test for rust-lang#106423
Rollup merge of rust-lang#122943 - matthiaskrgr:ice-tests-9xxxx-to-12…
Rollup merge of rust-lang#122943 - matthiaskrgr:ice-tests-9xxxx-to-12…
Rollup merge of rust-lang#122943 - matthiaskrgr:ice-tests-9xxxx-to-12…
Rollup merge of rust-lang#122943 - matthiaskrgr:ice-tests-9xxxx-to-12…
Unrolled build for rust-lang#122943
add test for rust-lang#106423
Rollup merge of rust-lang#122943 - matthiaskrgr:ice-tests-9xxxx-to-12…