Skip to content

ICE: type parameter S/#1 (S/#1/1) out of range when instantiating, args=[A/#0] #121963

Open
@ileixe

Description

@ileixe

Code

#![feature(generic_const_exprs)]
use std::marker::PhantomData;

trait Arch {
    const CHANNEL_COUNT: usize = 2;
}

struct Channel<const N: usize> {
    r: [u8; N],
}

struct Dram<A: Arch, S = Channel<{ A::CHANNEL_COUNT }>> {
    a: PhantomData<A>,
    s: PhantomData<S>,
}

struct C<A: Arch>
where
    Channel<{ A::CHANNEL_COUNT }, u8>: Sized,
{
    b: Dram<A>,
    //  b: Dram<A, Channel<{ A::CHANNEL_COUNT }>>,  // When I specified generic here, it worked
}

fn main() {}

Meta

rustc --version --verbose:

genericargice$ rustc --version --verbose
rustc 1.78.0-nightly (2bf78d12d 2024-02-18)
binary: rustc
commit-hash: 2bf78d12d33ae02d10010309a0d85dd04e7cff72
commit-date: 2024-02-18
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Error output

genericargice$ cargo check
    Checking genericargice v0.1.0 
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
 --> src/main.rs:1:12
  |
1 | #![feature(generic_const_exprs)]
  |            ^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
  = note: `#[warn(incomplete_features)]` on by default

error: internal compiler error: compiler/rustc_middle/src/ty/generic_args.rs:927:9: type parameter `S/#1` (S/#1/1) out of range when instantiating, args=[A/#0]

thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:35:44:
Box<dyn Any>
stack backtrace:
   0:     0x7f42f2c6daf6 - std::backtrace_rs::backtrace::libunwind::trace::h9df285d1486a2d13
                               at /rustc/2bf78d12d33ae02d10010309a0d85dd04e7cff72/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f42f2c6daf6 - std::backtrace_rs::backtrace::trace_unsynchronized::h99509b3e52ad9c86
                               at /rustc/2bf78d12d33ae02d10010309a0d85dd04e7cff72/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f42f2c6daf6 - std::sys_common::backtrace::_print_fmt::h8c2021c31e85dca5
                               at /rustc/2bf78d12d33ae02d10010309a0d85dd04e7cff72/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f42f2c6daf6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h402f02d9b4df5fe1
                               at /rustc/2bf78d12d33ae02d10010309a0d85dd04e7cff72/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f42f2cbe29c - core::fmt::rt::Argument::fmt::h8056a844c3e8daaa
                               at /rustc/2bf78d12d33ae02d10010309a0d85dd04e7cff72/library/core/src/fmt/rt.rs:142:9
   5:     0x7f42f2cbe29c - core::fmt::write::h8fddb4828840201f
                               at /rustc/2bf78d12d33ae02d10010309a0d85dd04e7cff72/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f42f2c6152f - std::io::Write::write_fmt::h38b9b1a6a63dbb61
                               at /rustc/2bf78d12d33ae02d10010309a0d85dd04e7cff72/library/std/src/io/mod.rs:1846:15
   7:     0x7f42f2c6d8a4 - std::sys_common::backtrace::_print::h0e4a6e68dd91926c
                               at /rustc/2bf78d12d33ae02d10010309a0d85dd04e7cff72/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f42f2c6d8a4 - std::sys_common::backtrace::print::h98a1789ae7f04118
                               at /rustc/2bf78d12d33ae02d10010309a0d85dd04e7cff72/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f42f2c705eb - std::panicking::default_hook::{{closure}}::hbf9ed991ae15cec9
  10:     0x7f42f2c70339 - std::panicking::default_hook::h0e9a403389616b5a
                               at /rustc/2bf78d12d33ae02d10010309a0d85dd04e7cff72/library/std/src/panicking.rs:292:9
  11:     0x7f42efa2c34c - std[b63fea9e4af8a7cd]::panicking::update_hook::<alloc[5b0c164e4760cfd9]::boxed::Box<rustc_driver_impl[1e85413e46ec3c21]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f42f2c70d50 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h19c493a0a67a96c8
                               at /rustc/2bf78d12d33ae02d10010309a0d85dd04e7cff72/library/alloc/src/boxed.rs:2030:9
  13:     0x7f42f2c70d50 - std::panicking::rust_panic_with_hook::h47d6ea0dd5408232
                               at /rustc/2bf78d12d33ae02d10010309a0d85dd04e7cff72/library/std/src/panicking.rs:786:13
  14:     0x7f42efa5a024 - std[b63fea9e4af8a7cd]::panicking::begin_panic::<rustc_errors[cf74d743b15828b6]::ExplicitBug>::{closure#0}
  15:     0x7f42efa56f46 - std[b63fea9e4af8a7cd]::sys_common::backtrace::__rust_end_short_backtrace::<std[b63fea9e4af8a7cd]::panicking::begin_panic<rustc_errors[cf74d743b15828b6]::ExplicitBug>::{closure#0}, !>
  16:     0x7f42efa56956 - std[b63fea9e4af8a7cd]::panicking::begin_panic::<rustc_errors[cf74d743b15828b6]::ExplicitBug>
  17:     0x7f42efa66291 - <rustc_errors[cf74d743b15828b6]::diagnostic_builder::BugAbort as rustc_errors[cf74d743b15828b6]::diagnostic_builder::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7f42efe2e42c - <rustc_errors[cf74d743b15828b6]::DiagCtxt>::bug::<alloc[5b0c164e4760cfd9]::string::String>
  19:     0x7f42efed101b - rustc_middle[10eab8ba3c863b90]::util::bug::opt_span_bug_fmt::<rustc_span[67e522c4f094395b]::span_encoding::Span>::{closure#0}
  20:     0x7f42efeb5e9a - rustc_middle[10eab8ba3c863b90]::ty::context::tls::with_opt::<rustc_middle[10eab8ba3c863b90]::util::bug::opt_span_bug_fmt<rustc_span[67e522c4f094395b]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f42efeb5d18 - rustc_middle[10eab8ba3c863b90]::ty::context::tls::with_context_opt::<rustc_middle[10eab8ba3c863b90]::ty::context::tls::with_opt<rustc_middle[10eab8ba3c863b90]::util::bug::opt_span_bug_fmt<rustc_span[67e522c4f094395b]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f42ee2c4180 - rustc_middle[10eab8ba3c863b90]::util::bug::bug_fmt
  23:     0x7f42efec56b6 - <rustc_middle[10eab8ba3c863b90]::ty::generic_args::ArgFolder>::type_param_out_of_range
  24:     0x7f42f0c081be - <rustc_middle[10eab8ba3c863b90]::ty::generic_args::ArgFolder as rustc_type_ir[a764223bce5b3995]::fold::TypeFolder<rustc_middle[10eab8ba3c863b90]::ty::context::TyCtxt>>::fold_ty
  25:     0x7f42f0f2b944 - <&rustc_middle[10eab8ba3c863b90]::ty::list::List<rustc_middle[10eab8ba3c863b90]::ty::generic_args::GenericArg> as rustc_type_ir[a764223bce5b3995]::fold::TypeFoldable<rustc_middle[10eab8ba3c863b90]::ty::context::TyCtxt>>::try_fold_with::<rustc_middle[10eab8ba3c863b90]::ty::generic_args::ArgFolder>
  26:     0x7f42f0c38eb5 - <rustc_middle[10eab8ba3c863b90]::ty::generic_args::ArgFolder as rustc_type_ir[a764223bce5b3995]::fold::TypeFolder<rustc_middle[10eab8ba3c863b90]::ty::context::TyCtxt>>::fold_const
  27:     0x7f42f0c03083 - <rustc_middle[10eab8ba3c863b90]::ty::generic_args::ArgFolder as rustc_type_ir[a764223bce5b3995]::fold::TypeFolder<rustc_middle[10eab8ba3c863b90]::ty::context::TyCtxt>>::fold_ty
  28:     0x7f42f0f18df7 - <<dyn rustc_hir_analysis[9b89395ae1a29d0d]::astconv::AstConv>::create_args_for_ast_path::{closure#0}::InstantiationsForAstPathCtxt as rustc_hir_analysis[9b89395ae1a29d0d]::astconv::CreateInstantiationsForGenericArgsCtxt>::inferred_kind
  29:     0x7f42eedcde86 - <dyn rustc_hir_analysis[9b89395ae1a29d0d]::astconv::AstConv>::ast_path_args_for_ty
  30:     0x7f42eedbc999 - <dyn rustc_hir_analysis[9b89395ae1a29d0d]::astconv::AstConv>::res_to_ty
  31:     0x7f42f0f33216 - <dyn rustc_hir_analysis[9b89395ae1a29d0d]::astconv::AstConv>::ast_ty_to_ty_inner
  32:     0x7f42ef03c9ac - rustc_hir_analysis[9b89395ae1a29d0d]::collect::type_of::type_of
  33:     0x7f42f0c9377a - rustc_query_impl[4d9845ba555ec7c3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4d9845ba555ec7c3]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[10eab8ba3c863b90]::query::erase::Erased<[u8; 8usize]>>
  34:     0x7f42f10bb8c9 - rustc_query_system[b2951f7bfbcd1f5f]::query::plumbing::try_execute_query::<rustc_query_impl[4d9845ba555ec7c3]::DynamicConfig<rustc_query_system[b2951f7bfbcd1f5f]::query::caches::DefIdCache<rustc_middle[10eab8ba3c863b90]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[4d9845ba555ec7c3]::plumbing::QueryCtxt, true>
  35:     0x7f42f0d65099 - rustc_query_impl[4d9845ba555ec7c3]::query_impl::type_of::get_query_incr::__rust_end_short_backtrace
  36:     0x7f42f1650907 - rustc_hir_analysis[9b89395ae1a29d0d]::outlives::inferred_outlives_crate
  37:     0x7f42f164f620 - rustc_query_impl[4d9845ba555ec7c3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4d9845ba555ec7c3]::query_impl::inferred_outlives_crate::dynamic_query::{closure#2}::{closure#0}, rustc_middle[10eab8ba3c863b90]::query::erase::Erased<[u8; 8usize]>>
  38:     0x7f42f1c3e1c4 - rustc_query_system[b2951f7bfbcd1f5f]::query::plumbing::try_execute_query::<rustc_query_impl[4d9845ba555ec7c3]::DynamicConfig<rustc_query_system[b2951f7bfbcd1f5f]::query::caches::SingleCache<rustc_middle[10eab8ba3c863b90]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[4d9845ba555ec7c3]::plumbing::QueryCtxt, true>
  39:     0x7f42f1c3dada - rustc_query_impl[4d9845ba555ec7c3]::plumbing::force_from_dep_node::<rustc_query_impl[4d9845ba555ec7c3]::DynamicConfig<rustc_query_system[b2951f7bfbcd1f5f]::query::caches::SingleCache<rustc_middle[10eab8ba3c863b90]::query::erase::Erased<[u8; 8usize]>>, false, false, false>>
  40:     0x7f42f0214efd - <rustc_query_impl[4d9845ba555ec7c3]::plumbing::query_callback<rustc_query_impl[4d9845ba555ec7c3]::query_impl::inferred_outlives_crate::QueryType>::{closure#0} as core[877e2560be895f29]::ops::function::FnOnce<(rustc_middle[10eab8ba3c863b90]::ty::context::TyCtxt, rustc_query_system[b2951f7bfbcd1f5f]::dep_graph::dep_node::DepNode)>>::call_once
  41:     0x7f42f0c4083b - <rustc_query_system[b2951f7bfbcd1f5f]::dep_graph::graph::DepGraphData<rustc_middle[10eab8ba3c863b90]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[4d9845ba555ec7c3]::plumbing::QueryCtxt>
  42:     0x7f42f11e8d58 - rustc_query_system[b2951f7bfbcd1f5f]::query::plumbing::try_execute_query::<rustc_query_impl[4d9845ba555ec7c3]::DynamicConfig<rustc_query_system[b2951f7bfbcd1f5f]::query::caches::DefIdCache<rustc_middle[10eab8ba3c863b90]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[4d9845ba555ec7c3]::plumbing::QueryCtxt, true>
  43:     0x7f42f11e8391 - rustc_query_impl[4d9845ba555ec7c3]::query_impl::inferred_outlives_of::get_query_incr::__rust_end_short_backtrace
  44:     0x7f42f0cf26d5 - rustc_hir_analysis[9b89395ae1a29d0d]::collect::predicates_defined_on
  45:     0x7f42f0cf2513 - rustc_query_impl[4d9845ba555ec7c3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4d9845ba555ec7c3]::query_impl::predicates_defined_on::dynamic_query::{closure#2}::{closure#0}, rustc_middle[10eab8ba3c863b90]::query::erase::Erased<[u8; 24usize]>>
  46:     0x7f42f11bdc2b - rustc_query_system[b2951f7bfbcd1f5f]::query::plumbing::try_execute_query::<rustc_query_impl[4d9845ba555ec7c3]::DynamicConfig<rustc_query_system[b2951f7bfbcd1f5f]::query::caches::DefIdCache<rustc_middle[10eab8ba3c863b90]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[4d9845ba555ec7c3]::plumbing::QueryCtxt, true>
  47:     0x7f42f1bcfc76 - rustc_query_impl[4d9845ba555ec7c3]::plumbing::force_from_dep_node::<rustc_query_impl[4d9845ba555ec7c3]::DynamicConfig<rustc_query_system[b2951f7bfbcd1f5f]::query::caches::DefIdCache<rustc_middle[10eab8ba3c863b90]::query::erase::Erased<[u8; 24usize]>>, false, false, false>>
  48:     0x7f42f1c9afed - <rustc_query_impl[4d9845ba555ec7c3]::plumbing::query_callback<rustc_query_impl[4d9845ba555ec7c3]::query_impl::predicates_defined_on::QueryType>::{closure#0} as core[877e2560be895f29]::ops::function::FnOnce<(rustc_middle[10eab8ba3c863b90]::ty::context::TyCtxt, rustc_query_system[b2951f7bfbcd1f5f]::dep_graph::dep_node::DepNode)>>::call_once
  49:     0x7f42f0c4083b - <rustc_query_system[b2951f7bfbcd1f5f]::dep_graph::graph::DepGraphData<rustc_middle[10eab8ba3c863b90]::dep_graph::DepsType>>::try_mark_previous_green::<rustc_query_impl[4d9845ba555ec7c3]::plumbing::QueryCtxt>
  50:     0x7f42f0d64e1b - rustc_query_system[b2951f7bfbcd1f5f]::query::plumbing::ensure_must_run::<rustc_query_impl[4d9845ba555ec7c3]::DynamicConfig<rustc_query_system[b2951f7bfbcd1f5f]::query::caches::DefIdCache<rustc_middle[10eab8ba3c863b90]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[4d9845ba555ec7c3]::plumbing::QueryCtxt>
  51:     0x7f42f0d646ca - rustc_query_impl[4d9845ba555ec7c3]::query_impl::predicates_of::get_query_incr::__rust_end_short_backtrace
  52:     0x7f42f0fb69ee - <rustc_hir_analysis[9b89395ae1a29d0d]::collect::CollectItemTypesVisitor as rustc_hir[e948b6ceb545ab11]::intravisit::Visitor>::visit_item
  53:     0x7f42f0fb5976 - rustc_hir_analysis[9b89395ae1a29d0d]::collect::collect_mod_item_types
  54:     0x7f42f0fb5909 - rustc_query_impl[4d9845ba555ec7c3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4d9845ba555ec7c3]::query_impl::collect_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[10eab8ba3c863b90]::query::erase::Erased<[u8; 0usize]>>
  55:     0x7f42f0f98cc2 - rustc_query_system[b2951f7bfbcd1f5f]::query::plumbing::try_execute_query::<rustc_query_impl[4d9845ba555ec7c3]::DynamicConfig<rustc_query_system[b2951f7bfbcd1f5f]::query::caches::DefaultCache<rustc_span[67e522c4f094395b]::def_id::LocalModDefId, rustc_middle[10eab8ba3c863b90]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[4d9845ba555ec7c3]::plumbing::QueryCtxt, true>
  56:     0x7f42f185113c - rustc_query_impl[4d9845ba555ec7c3]::query_impl::collect_mod_item_types::get_query_incr::__rust_end_short_backtrace
  57:     0x7f42f0df1b28 - rustc_hir_analysis[9b89395ae1a29d0d]::check_crate
  58:     0x7f42f16b30d3 - rustc_interface[328d64ac2abca7cc]::passes::analysis
  59:     0x7f42f16b2d29 - rustc_query_impl[4d9845ba555ec7c3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4d9845ba555ec7c3]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[10eab8ba3c863b90]::query::erase::Erased<[u8; 1usize]>>
  60:     0x7f42f19538e2 - rustc_query_system[b2951f7bfbcd1f5f]::query::plumbing::try_execute_query::<rustc_query_impl[4d9845ba555ec7c3]::DynamicConfig<rustc_query_system[b2951f7bfbcd1f5f]::query::caches::SingleCache<rustc_middle[10eab8ba3c863b90]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[4d9845ba555ec7c3]::plumbing::QueryCtxt, true>
  61:     0x7f42f19534dc - rustc_query_impl[4d9845ba555ec7c3]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  62:     0x7f42f1961fd6 - rustc_interface[328d64ac2abca7cc]::interface::run_compiler::<core[877e2560be895f29]::result::Result<(), rustc_span[67e522c4f094395b]::ErrorGuaranteed>, rustc_driver_impl[1e85413e46ec3c21]::run_compiler::{closure#0}>::{closure#0}
  63:     0x7f42f1bc980d - std[b63fea9e4af8a7cd]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[328d64ac2abca7cc]::util::run_in_thread_with_globals<rustc_interface[328d64ac2abca7cc]::util::run_in_thread_pool_with_globals<rustc_interface[328d64ac2abca7cc]::interface::run_compiler<core[877e2560be895f29]::result::Result<(), rustc_span[67e522c4f094395b]::ErrorGuaranteed>, rustc_driver_impl[1e85413e46ec3c21]::run_compiler::{closure#0}>::{closure#0}, core[877e2560be895f29]::result::Result<(), rustc_span[67e522c4f094395b]::ErrorGuaranteed>>::{closure#0}, core[877e2560be895f29]::result::Result<(), rustc_span[67e522c4f094395b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[877e2560be895f29]::result::Result<(), rustc_span[67e522c4f094395b]::ErrorGuaranteed>>
  64:     0x7f42f1bc963a - <<std[b63fea9e4af8a7cd]::thread::Builder>::spawn_unchecked_<rustc_interface[328d64ac2abca7cc]::util::run_in_thread_with_globals<rustc_interface[328d64ac2abca7cc]::util::run_in_thread_pool_with_globals<rustc_interface[328d64ac2abca7cc]::interface::run_compiler<core[877e2560be895f29]::result::Result<(), rustc_span[67e522c4f094395b]::ErrorGuaranteed>, rustc_driver_impl[1e85413e46ec3c21]::run_compiler::{closure#0}>::{closure#0}, core[877e2560be895f29]::result::Result<(), rustc_span[67e522c4f094395b]::ErrorGuaranteed>>::{closure#0}, core[877e2560be895f29]::result::Result<(), rustc_span[67e522c4f094395b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[877e2560be895f29]::result::Result<(), rustc_span[67e522c4f094395b]::ErrorGuaranteed>>::{closure#1} as core[877e2560be895f29]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  65:     0x7f42f2c79e95 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hdee4f1d27a02e964
                               at /rustc/2bf78d12d33ae02d10010309a0d85dd04e7cff72/library/alloc/src/boxed.rs:2016:9
  66:     0x7f42f2c79e95 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h901ad38ebcbd12ab
                               at /rustc/2bf78d12d33ae02d10010309a0d85dd04e7cff72/library/alloc/src/boxed.rs:2016:9
  67:     0x7f42f2c79e95 - std::sys::pal::unix::thread::Thread::new::thread_start::ha622e5bdf6a63770
                               at /rustc/2bf78d12d33ae02d10010309a0d85dd04e7cff72/library/std/src/sys/pal/unix/thread.rs:108:17
  68:     0x7f42eca6bac3 - start_thread
                               at ./nptl/pthread_create.c:442:8
  69:     0x7f42ecafd850 - __GI___clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  70:                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 `/home/ys/Source/Practice/languages/rust/genericargice/rustc-ice-2024-03-04T06_39_09-295597.txt` to your bug report

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
#0 [type_of] computing type of `C::b`
#1 [inferred_outlives_crate] computing the inferred outlives predicates for items in this crate
#2 [inferred_outlives_of] computing inferred outlives predicates of `Channel`
#3 [predicates_defined_on] computing predicates of `Channel`
#4 [collect_mod_item_types] collecting item types in top-level module
#5 [analysis] running analysis passes on this crate
end of query stack
there was a panic while trying to force a dep node
try_mark_green dep node stack:
#0 inferred_outlives_of(genericargice[8074]::Channel)
end of try_mark_green dep node stack
there was a panic while trying to force a dep node
try_mark_green dep node stack:
#0 predicates_of(genericargice[8074]::Channel)
end of try_mark_green dep node stack

Backtrace

error: internal compiler error: compiler/rustc_middle/src/ty/generic_args.rs:927:9: type parameter `S/#1` (S/#1/1) out of range when instantiating, args=[A/#0]

thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:35:44:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic_builder::BugAbort as rustc_errors::diagnostic_builder::EmissionGuarantee>::emit_producing_guarantee
   2: <rustc_errors::DiagCtxt>::bug::<alloc::string::String>
   3: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   5: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   6: rustc_middle::util::bug::bug_fmt
   7: <rustc_middle::ty::generic_args::ArgFolder>::type_param_out_of_range
   8: <rustc_middle::ty::generic_args::ArgFolder as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty
   9: <&rustc_middle::ty::list::List<rustc_middle::ty::generic_args::GenericArg> as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::try_fold_with::<rustc_middle::ty::generic_args::ArgFolder>
  10: <rustc_middle::ty::generic_args::ArgFolder as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_const
  11: <rustc_middle::ty::generic_args::ArgFolder as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty
  12: <<dyn rustc_hir_analysis::astconv::AstConv>::create_args_for_ast_path::{closure#0}::InstantiationsForAstPathCtxt as rustc_hir_analysis::astconv::CreateInstantiationsForGenericArgsCtxt>::inferred_kind
  13: <dyn rustc_hir_analysis::astconv::AstConv>::ast_path_args_for_ty
  14: <dyn rustc_hir_analysis::astconv::AstConv>::res_to_ty
  15: <dyn rustc_hir_analysis::astconv::AstConv>::ast_ty_to_ty_inner
  16: rustc_hir_analysis::collect::type_of::type_of
      [... omitted 1 frame ...]
  17: rustc_hir_analysis::outlives::inferred_outlives_crate
      [... omitted 5 frames ...]
  18: rustc_hir_analysis::collect::predicates_defined_on
      [... omitted 5 frames ...]
  19: <rustc_hir_analysis::collect::CollectItemTypesVisitor as rustc_hir::intravisit::Visitor>::visit_item
  20: rustc_hir_analysis::collect::collect_mod_item_types
      [... omitted 1 frame ...]
  21: rustc_hir_analysis::check_crate
  22: rustc_interface::passes::analysis
      [... omitted 1 frame ...]
  23: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#0}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-generic_const_exprs`#![feature(generic_const_exprs)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-lowLow priorityS-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.S-has-mcveStatus: 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.requires-incomplete-featuresThis issue requires the use of incomplete features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions