rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.24k stars 12.7k forks source link

ICE with generic_const_exprs (and std::simd) #126443

Open anderspapitto opened 4 months ago

anderspapitto commented 4 months ago

I tried this code (https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=d0cf160632f8eed6e09099624d1cd545):

#![feature(portable_simd)]
#![feature(generic_const_exprs)]

use core::simd::num::SimdUint;
use core::mem;
use core::simd::*;

pub unsafe fn better_transmute<T, U>(x: T) -> U {
  assert!(mem::size_of::<T>() == mem::size_of::<U>());
  mem::transmute_copy::<mem::ManuallyDrop<T>, U>(&mem::ManuallyDrop::new(x))
}

pub fn double_up_u8<const N: usize>(x: Simd<u8, N>) -> Simd<u8, { N * 2 }>
where
  LaneCount<N>: SupportedLaneCount,
  LaneCount<{ N * 2 }>: SupportedLaneCount,
{
  unsafe { better_transmute(x.cast::<u16>() | (x.cast::<u16>() << 8)) }
}

pub fn quadruple_up_u8<const N: usize>(
  x: Simd<u8, N>,
) -> Simd<u8, { N * 2 * 2 }>
where
  LaneCount<N>: SupportedLaneCount,
  LaneCount<{ N * 2 }>: SupportedLaneCount,
  LaneCount<{ N * 2 * 2 }>: SupportedLaneCount,
{
  let x = double_up_u8(x);
  double_up_u8(x)
}

pub fn quadruple_up_u8_concrete_16(x: Simd<u8, 16>) -> Simd<u8, 64> {
  quadruple_up_u8(x)
}

error: internal compiler error: compiler/rustc_middle/src/ty/instance.rs:510:25: failed to resolve instance for <std::simd::Simd<u8, 16 * 2> as SimdUint>::cast::<u16>: Ok(
                                    None,
                                )

thread 'rustc' panicked at compiler/rustc_middle/src/ty/instance.rs:510:25:
Box<dyn Any>
stack backtrace:
   0:     0x7faef43c4ae5 - std::backtrace_rs::backtrace::libunwind::trace::h5ef2cc16e9a7415a
                               at /rustc/8337ba9189de188e2ed417018af2bf17a57d51ac/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x7faef43c4ae5 - std::backtrace_rs::backtrace::trace_unsynchronized::h9b5e016e9075f714
                               at /rustc/8337ba9189de188e2ed417018af2bf17a57d51ac/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7faef43c4ae5 - std::sys_common::backtrace::_print_fmt::h2f62c7f9ff224e93
                               at /rustc/8337ba9189de188e2ed417018af2bf17a57d51ac/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7faef43c4ae5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbe51682735731910
                               at /rustc/8337ba9189de188e2ed417018af2bf17a57d51ac/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7faef441577b - core::fmt::rt::Argument::fmt::h1994ab2b310d665e
                               at /rustc/8337ba9189de188e2ed417018af2bf17a57d51ac/library/core/src/fmt/rt.rs:165:63
   5:     0x7faef441577b - core::fmt::write::hade58a36d63468d7
                               at /rustc/8337ba9189de188e2ed417018af2bf17a57d51ac/library/core/src/fmt/mod.rs:1168:21
   6:     0x7faef43b96bf - std::io::Write::write_fmt::h16145587d801a9ab
                               at /rustc/8337ba9189de188e2ed417018af2bf17a57d51ac/library/std/src/io/mod.rs:1835:15
   7:     0x7faef43c48be - std::sys_common::backtrace::_print::ha8082e56201dadb4
                               at /rustc/8337ba9189de188e2ed417018af2bf17a57d51ac/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7faef43c48be - std::sys_common::backtrace::print::he30f96b4e7f6cbfd
                               at /rustc/8337ba9189de188e2ed417018af2bf17a57d51ac/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7faef43c72f9 - std::panicking::default_hook::{{closure}}::hf0801f6b18a968d3
  10:     0x7faef43c709c - std::panicking::default_hook::hd2defec7eda5aeb0
                               at /rustc/8337ba9189de188e2ed417018af2bf17a57d51ac/library/std/src/panicking.rs:292:9
  11:     0x7faef76ec050 - std[a8a14b0e6646fad5]::panicking::update_hook::<alloc[798fb67bec780804]::boxed::Box<rustc_driver_impl[fb29927f0a07f39d]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7faef43c7bff - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hcab2bb72e8fd3275
                               at /rustc/8337ba9189de188e2ed417018af2bf17a57d51ac/library/alloc/src/boxed.rs:2076:9
  13:     0x7faef43c7bff - std::panicking::rust_panic_with_hook::hde93283600065c53
                               at /rustc/8337ba9189de188e2ed417018af2bf17a57d51ac/library/std/src/panicking.rs:801:13
  14:     0x7faef771ca11 - std[a8a14b0e6646fad5]::panicking::begin_panic::<rustc_errors[707d6179d593b007]::ExplicitBug>::{closure#0}
  15:     0x7faef77194f6 - std[a8a14b0e6646fad5]::sys_common::backtrace::__rust_end_short_backtrace::<std[a8a14b0e6646fad5]::panicking::begin_panic<rustc_errors[707d6179d593b007]::ExplicitBug>::{closure#0}, !>
  16:     0x7faef77148d6 - std[a8a14b0e6646fad5]::panicking::begin_panic::<rustc_errors[707d6179d593b007]::ExplicitBug>
  17:     0x7faef7725f61 - <rustc_errors[707d6179d593b007]::diagnostic::BugAbort as rustc_errors[707d6179d593b007]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7faef7c23c2c - rustc_middle[a6772a91e67f1048]::util::bug::opt_span_bug_fmt::<rustc_span[e3a1e1b56e6f88d8]::span_encoding::Span>::{closure#0}
  19:     0x7faef7c0ccaa - rustc_middle[a6772a91e67f1048]::ty::context::tls::with_opt::<rustc_middle[a6772a91e67f1048]::util::bug::opt_span_bug_fmt<rustc_span[e3a1e1b56e6f88d8]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x7faef7c0cb4b - rustc_middle[a6772a91e67f1048]::ty::context::tls::with_context_opt::<rustc_middle[a6772a91e67f1048]::ty::context::tls::with_opt<rustc_middle[a6772a91e67f1048]::util::bug::opt_span_bug_fmt<rustc_span[e3a1e1b56e6f88d8]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x7faef56095f0 - rustc_middle[a6772a91e67f1048]::util::bug::bug_fmt
  22:     0x7faef8ee99c8 - <rustc_middle[a6772a91e67f1048]::ty::instance::Instance>::expect_resolve
  23:     0x7faef98a2da6 - rustc_monomorphize[b25ec8e9515cda93]::collector::collect_items_rec::{closure#0}
  24:     0x7faef8ad93bf - rustc_monomorphize[b25ec8e9515cda93]::collector::collect_items_rec
  25:     0x7faef8ad9b36 - rustc_monomorphize[b25ec8e9515cda93]::collector::collect_items_rec
  26:     0x7faef8ad9b36 - rustc_monomorphize[b25ec8e9515cda93]::collector::collect_items_rec
  27:     0x7faef8ec42f9 - rustc_monomorphize[b25ec8e9515cda93]::partitioning::collect_and_partition_mono_items
  28:     0x7faef9af6ee4 - rustc_query_impl[1babe9a7768fd14]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1babe9a7768fd14]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a6772a91e67f1048]::query::erase::Erased<[u8; 24usize]>>
  29:     0x7faef9af6ec9 - <rustc_query_impl[1babe9a7768fd14]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core[df0bc3c4e892894f]::ops::function::FnOnce<(rustc_middle[a6772a91e67f1048]::ty::context::TyCtxt, ())>>::call_once
  30:     0x7faef9af6a88 - rustc_query_system[f0d53dba093567b9]::query::plumbing::try_execute_query::<rustc_query_impl[1babe9a7768fd14]::DynamicConfig<rustc_query_system[f0d53dba093567b9]::query::caches::SingleCache<rustc_middle[a6772a91e67f1048]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[1babe9a7768fd14]::plumbing::QueryCtxt, false>
  31:     0x7faef9af67a1 - rustc_query_impl[1babe9a7768fd14]::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7faef9544c09 - rustc_codegen_ssa[1546aa7d1fe842a3]::back::symbol_export::exported_symbols_provider_local
  33:     0x7faef8bcf7a5 - rustc_query_impl[1babe9a7768fd14]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1babe9a7768fd14]::query_impl::exported_symbols::dynamic_query::{closure#2}::{closure#0}, rustc_middle[a6772a91e67f1048]::query::erase::Erased<[u8; 16usize]>>
  34:     0x7faef8bcf76d - <rustc_query_impl[1babe9a7768fd14]::query_impl::exported_symbols::dynamic_query::{closure#2} as core[df0bc3c4e892894f]::ops::function::FnOnce<(rustc_middle[a6772a91e67f1048]::ty::context::TyCtxt, rustc_span[e3a1e1b56e6f88d8]::def_id::CrateNum)>>::call_once
  35:     0x7faef97aafa6 - rustc_query_system[f0d53dba093567b9]::query::plumbing::try_execute_query::<rustc_query_impl[1babe9a7768fd14]::DynamicConfig<rustc_query_system[f0d53dba093567b9]::query::caches::VecCache<rustc_span[e3a1e1b56e6f88d8]::def_id::CrateNum, rustc_middle[a6772a91e67f1048]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[1babe9a7768fd14]::plumbing::QueryCtxt, false>
  36:     0x7faef97aabab - rustc_query_impl[1babe9a7768fd14]::query_impl::exported_symbols::get_query_non_incr::__rust_end_short_backtrace
  37:     0x7faef97aa8ec - rustc_middle[a6772a91e67f1048]::query::plumbing::query_get_at::<rustc_query_system[f0d53dba093567b9]::query::caches::VecCache<rustc_span[e3a1e1b56e6f88d8]::def_id::CrateNum, rustc_middle[a6772a91e67f1048]::query::erase::Erased<[u8; 16usize]>>>
  38:     0x7faef922eb4a - <rustc_metadata[b6ccef206159871f]::rmeta::encoder::EncodeContext>::encode_crate_root
  39:     0x7faef99746d8 - rustc_metadata[b6ccef206159871f]::rmeta::encoder::encode_metadata
  40:     0x7faef996f8b2 - rustc_metadata[b6ccef206159871f]::fs::encode_and_write_metadata
  41:     0x7faef996e340 - rustc_interface[eafdc2161e58eccb]::passes::start_codegen
  42:     0x7faef996da9a - <rustc_interface[eafdc2161e58eccb]::queries::Queries>::codegen_and_build_linker
  43:     0x7faef9724732 - rustc_interface[eafdc2161e58eccb]::interface::run_compiler::<core[df0bc3c4e892894f]::result::Result<(), rustc_span[e3a1e1b56e6f88d8]::ErrorGuaranteed>, rustc_driver_impl[fb29927f0a07f39d]::run_compiler::{closure#0}>::{closure#1}
  44:     0x7faef9746827 - std[a8a14b0e6646fad5]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[eafdc2161e58eccb]::util::run_in_thread_with_globals<rustc_interface[eafdc2161e58eccb]::util::run_in_thread_pool_with_globals<rustc_interface[eafdc2161e58eccb]::interface::run_compiler<core[df0bc3c4e892894f]::result::Result<(), rustc_span[e3a1e1b56e6f88d8]::ErrorGuaranteed>, rustc_driver_impl[fb29927f0a07f39d]::run_compiler::{closure#0}>::{closure#1}, core[df0bc3c4e892894f]::result::Result<(), rustc_span[e3a1e1b56e6f88d8]::ErrorGuaranteed>>::{closure#0}, core[df0bc3c4e892894f]::result::Result<(), rustc_span[e3a1e1b56e6f88d8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[df0bc3c4e892894f]::result::Result<(), rustc_span[e3a1e1b56e6f88d8]::ErrorGuaranteed>>
  45:     0x7faef97465ea - <<std[a8a14b0e6646fad5]::thread::Builder>::spawn_unchecked_<rustc_interface[eafdc2161e58eccb]::util::run_in_thread_with_globals<rustc_interface[eafdc2161e58eccb]::util::run_in_thread_pool_with_globals<rustc_interface[eafdc2161e58eccb]::interface::run_compiler<core[df0bc3c4e892894f]::result::Result<(), rustc_span[e3a1e1b56e6f88d8]::ErrorGuaranteed>, rustc_driver_impl[fb29927f0a07f39d]::run_compiler::{closure#0}>::{closure#1}, core[df0bc3c4e892894f]::result::Result<(), rustc_span[e3a1e1b56e6f88d8]::ErrorGuaranteed>>::{closure#0}, core[df0bc3c4e892894f]::result::Result<(), rustc_span[e3a1e1b56e6f88d8]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[df0bc3c4e892894f]::result::Result<(), rustc_span[e3a1e1b56e6f88d8]::ErrorGuaranteed>>::{closure#2} as core[df0bc3c4e892894f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  46:     0x7faef43d1a7b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9777b4cca5324078
                               at /rustc/8337ba9189de188e2ed417018af2bf17a57d51ac/library/alloc/src/boxed.rs:2062:9
  47:     0x7faef43d1a7b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8c468acad9ff28af
                               at /rustc/8337ba9189de188e2ed417018af2bf17a57d51ac/library/alloc/src/boxed.rs:2062:9
  48:     0x7faef43d1a7b - std::sys::pal::unix::thread::Thread::new::thread_start::hc013dcac52817fe6
                               at /rustc/8337ba9189de188e2ed417018af2bf17a57d51ac/library/std/src/sys/pal/unix/thread.rs:108:17
  49:     0x7faef42df609 - start_thread
  50:     0x7faef4202353 - clone
  51:                0x0 - <unknown>

cyrgani commented 2 months ago

Reduced version:

#![feature(generic_const_exprs)]

fn any<T>() -> T {
    loop {}
}

trait Cast {
    fn cast(&self);
}

impl<const N: usize> Cast for [(); N]
where
// remove the line below for a different ice
    LaneCount<N>: SupportedLaneCount,
{
    fn cast(&self) {}
}

fn double_up_u8<const N: usize>(x: [(); N]) -> [(); N * 2]
where
    LaneCount<N>: SupportedLaneCount,
    LaneCount<{ N * 2 }>: SupportedLaneCount,
{
    x.cast();
    any()
}

fn quadruple_up_u8<const N: usize>(x: [(); N]) -> [(); N * 2 * 2]
where
    LaneCount<N>: SupportedLaneCount,
    LaneCount<{ N * 2 }>: SupportedLaneCount,
    LaneCount<{ N * 2 * 2 }>: SupportedLaneCount,
{
    double_up_u8(double_up_u8(x))
}

pub fn quadruple_up_u8_concrete() {
    quadruple_up_u8::<0>(any());
}

struct LaneCount<const N: usize>;
trait SupportedLaneCount {}
impl SupportedLaneCount for LaneCount<0> {}

Removing the commented line gives:

error: internal compiler error: compiler/rustc_codegen_llvm/src/context.rs:1173:21: `fn_abi_of_instance(any::<[(); N * 2]>, [])` failed: Layout(Unknown([(); UnevaluatedConst { def: DefId(0:15 ~ playground[c7cd]::double_up_u8::{constant#2}), args: [(Mul: (0_usize: usize), (2_usize: usize))] }]))
 --> src/lib.rs:3:1
  |
3 | fn any<T>() -> T {
  | ^^^^^^^^^^^^^^^^

thread 'rustc' panicked at compiler/rustc_codegen_llvm/src/context.rs:1173:21:
Box<dyn Any>
stack backtrace:
   0:     0x7fb17b384bad - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hfd30b84ebe11988c
   1:     0x7fb17bb94c97 - core::fmt::write::hb626a39072c0eb4c
   2:     0x7fb17cb1e7d1 - std::io::Write::write_fmt::h0614c4dd6b12fec7
   3:     0x7fb17b38728b - std::panicking::default_hook::{{closure}}::h4464369cfb2c3523
   4:     0x7fb17b386efe - std::panicking::default_hook::hbe88f1457419259e
   5:     0x7fb17a4e5d29 - std[4821b876adeec04f]::panicking::update_hook::<alloc[579338a18283919f]::boxed::Box<rustc_driver_impl[699cd2d3c3a41798]::install_ice_hook::{closure#0}>>::{closure#0}
   6:     0x7fb17b387ba7 - std::panicking::rust_panic_with_hook::hdf548254c8466072
   7:     0x7fb17a51f851 - std[4821b876adeec04f]::panicking::begin_panic::<rustc_errors[3009ca04ab9b3e26]::ExplicitBug>::{closure#0}
   8:     0x7fb17a512f16 - std[4821b876adeec04f]::sys::backtrace::__rust_end_short_backtrace::<std[4821b876adeec04f]::panicking::begin_panic<rustc_errors[3009ca04ab9b3e26]::ExplicitBug>::{closure#0}, !>
   9:     0x7fb17a512c96 - std[4821b876adeec04f]::panicking::begin_panic::<rustc_errors[3009ca04ab9b3e26]::ExplicitBug>
  10:     0x7fb17a528a71 - <rustc_errors[3009ca04ab9b3e26]::diagnostic::BugAbort as rustc_errors[3009ca04ab9b3e26]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7fb17a31d25d - <rustc_errors[3009ca04ab9b3e26]::DiagCtxtHandle>::span_bug::<rustc_span[617b2c4e116b8252]::span_encoding::Span, alloc[579338a18283919f]::string::String>
  12:     0x7fb17a3418b8 - rustc_middle[177a089697687a0f]::util::bug::opt_span_bug_fmt::<rustc_span[617b2c4e116b8252]::span_encoding::Span>::{closure#0}
  13:     0x7fb17a3418ea - rustc_middle[177a089697687a0f]::ty::context::tls::with_opt::<rustc_middle[177a089697687a0f]::util::bug::opt_span_bug_fmt<rustc_span[617b2c4e116b8252]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7fb17a33101b - rustc_middle[177a089697687a0f]::ty::context::tls::with_context_opt::<rustc_middle[177a089697687a0f]::ty::context::tls::with_opt<rustc_middle[177a089697687a0f]::util::bug::opt_span_bug_fmt<rustc_span[617b2c4e116b8252]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7fb17a330887 - rustc_middle[177a089697687a0f]::util::bug::span_bug_fmt::<rustc_span[617b2c4e116b8252]::span_encoding::Span>
  16:     0x7fb17a36cbe4 - <rustc_codegen_llvm[f7f993617aa7612f]::context::CodegenCx as rustc_middle[177a089697687a0f]::ty::layout::FnAbiOfHelpers>::handle_fn_abi_err
  17:     0x7fb17a343d34 - <rustc_codegen_llvm[f7f993617aa7612f]::context::CodegenCx as rustc_middle[177a089697687a0f]::ty::layout::FnAbiOf>::fn_abi_of_instance::{closure#0}
  18:     0x7fb178a3d120 - <rustc_codegen_llvm[f7f993617aa7612f]::context::CodegenCx as rustc_codegen_ssa[dea1e47a759436d]::traits::declare::PreDefineMethods>::predefine_fn
  19:     0x7fb17ca988ff - rustc_codegen_llvm[f7f993617aa7612f]::base::compile_codegen_unit::module_codegen
  20:     0x7fb17cb72293 - <rustc_codegen_llvm[f7f993617aa7612f]::LlvmCodegenBackend as rustc_codegen_ssa[dea1e47a759436d]::traits::backend::ExtraBackendMethods>::compile_codegen_unit
  21:     0x7fb17cb6ec84 - <rustc_codegen_llvm[f7f993617aa7612f]::LlvmCodegenBackend as rustc_codegen_ssa[dea1e47a759436d]::traits::backend::CodegenBackend>::codegen_crate
  22:     0x7fb17cb77bf0 - <rustc_interface[4e8b14457d10516f]::queries::Linker>::codegen_and_build_linker
  23:     0x7fb17c96e199 - rustc_interface[4e8b14457d10516f]::interface::run_compiler::<core[3a188adb88b8af3f]::result::Result<(), rustc_span[617b2c4e116b8252]::ErrorGuaranteed>, rustc_driver_impl[699cd2d3c3a41798]::run_compiler::{closure#0}>::{closure#1}
  24:     0x7fb17ca3b604 - std[4821b876adeec04f]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[4e8b14457d10516f]::util::run_in_thread_with_globals<rustc_interface[4e8b14457d10516f]::util::run_in_thread_pool_with_globals<rustc_interface[4e8b14457d10516f]::interface::run_compiler<core[3a188adb88b8af3f]::result::Result<(), rustc_span[617b2c4e116b8252]::ErrorGuaranteed>, rustc_driver_impl[699cd2d3c3a41798]::run_compiler::{closure#0}>::{closure#1}, core[3a188adb88b8af3f]::result::Result<(), rustc_span[617b2c4e116b8252]::ErrorGuaranteed>>::{closure#0}, core[3a188adb88b8af3f]::result::Result<(), rustc_span[617b2c4e116b8252]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3a188adb88b8af3f]::result::Result<(), rustc_span[617b2c4e116b8252]::ErrorGuaranteed>>
  25:     0x7fb17ca3bc70 - <<std[4821b876adeec04f]::thread::Builder>::spawn_unchecked_<rustc_interface[4e8b14457d10516f]::util::run_in_thread_with_globals<rustc_interface[4e8b14457d10516f]::util::run_in_thread_pool_with_globals<rustc_interface[4e8b14457d10516f]::interface::run_compiler<core[3a188adb88b8af3f]::result::Result<(), rustc_span[617b2c4e116b8252]::ErrorGuaranteed>, rustc_driver_impl[699cd2d3c3a41798]::run_compiler::{closure#0}>::{closure#1}, core[3a188adb88b8af3f]::result::Result<(), rustc_span[617b2c4e116b8252]::ErrorGuaranteed>>::{closure#0}, core[3a188adb88b8af3f]::result::Result<(), rustc_span[617b2c4e116b8252]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3a188adb88b8af3f]::result::Result<(), rustc_span[617b2c4e116b8252]::ErrorGuaranteed>>::{closure#1} as core[3a188adb88b8af3f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  26:     0x7fb17ca3bfeb - std::sys::pal::unix::thread::Thread::new::thread_start::h7ef170129820a8c9
  27:     0x7fb176f63609 - start_thread
  28:     0x7fb176e88353 - clone
  29:                0x0 - <unknown>
cyrgani commented 2 months ago

Further reduced for the second ICE:

#![feature(generic_const_exprs)]

fn double_up_u8<const N: usize>() -> [(); N * 2]
where
    LaneCount<{ N * 2 }>: IsZero,
{
    loop {}
}

fn quadruple_up_u8<const N: usize>() -> [(); N * 2 * 2]
where
    LaneCount<{ N * 2 }>: IsZero,
    LaneCount<{ N * 2 * 2 }>: IsZero,
{
    double_up_u8()
}

pub fn quadruple_up_u8_concrete() {
    quadruple_up_u8::<0>();
}

struct LaneCount<const N: usize>;
trait IsZero {}
impl IsZero for LaneCount<0> {}
cyrgani commented 2 months ago

More reduction:

#![feature(generic_const_exprs)]

fn double_up<const M: usize>() -> [(); M * 2] {
    todo!()
}

fn quadruple_up<const N: usize>() -> [(); N * 2 * 2] {
    double_up()
}

pub fn init() {
    quadruple_up::<0>();
}