Skip to content

[ICE]: no entry found for key #155164

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

#![feature(min_generic_const_args)]

struct X<const N: usize, F> {
    inner: std::iter::Map<
        {
            struct W<I>;
            impl<I> W<I> {
                reuse Iterator::fold;
            }
        },
        F,
    >,
}

original:

#![feature(min_generic_const_args)]
#![feature(fn_delegation)]
#![allow(incomplete_features)]
struct X<const N: usize, F> {
    inner: std::iter::Map<
        {
            struct W<I>;
            impl<I> W<I> {
                reuse Iterator::fold;
            }
        },
        F,
    >,
}

fn main() {}

Version information

rustc 1.97.0-nightly (c29effdf7 2026-04-11)
binary: rustc
commit-hash: c29effdf79bdea928ea366a2a820ed15c1de5f43
commit-date: 2026-04-11
host: x86_64-unknown-linux-gnu
release: 1.97.0-nightly
LLVM version: 22.1.2

Possibly related line of code:

// We don't record `inferred_starts` entries for empty generics.
if args.is_empty() {
return;
}
let (local, remote) = if let Some(def_id) = def_id.as_local() {
(Some(self.terms_cx.inferred_starts[&def_id]), None)
} else {
(None, Some(self.tcx().variances_of(def_id)))
};
for (i, arg) in args.iter().enumerate() {
let variance_decl = if let Some(InferredIndex(start)) = local {

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0658]: functions delegation is not yet fully implemented
 --> /tmp/icemaker_global_tempdir.r3lSV7fiTksw/rustc_testrunner_tmpdir_reporting.uCm2T54LuGi9/mvce.rs:8:17
  |
8 |                 reuse Iterator::fold;
  |                 ^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #118212 <https://github.com/rust-lang/rust/issues/118212> for more information
  = help: add `#![feature(fn_delegation)]` to the crate attributes to enable
  = note: this compiler was built on 2026-04-11; consider upgrading it if it is out of date

warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.r3lSV7fiTksw/rustc_testrunner_tmpdir_reporting.uCm2T54LuGi9/mvce.rs:1:12
  |
1 | #![feature(min_generic_const_args)]
  |            ^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #132980 <https://github.com/rust-lang/rust/issues/132980> for more information
  = note: `#[warn(incomplete_features)]` on by default

error: complex const arguments must be placed inside of a `const` block
  --> /tmp/icemaker_global_tempdir.r3lSV7fiTksw/rustc_testrunner_tmpdir_reporting.uCm2T54LuGi9/mvce.rs:5:9
   |
 5 | /         {
 6 | |             struct W<I>;
 7 | |             impl<I> W<I> {
 8 | |                 reuse Iterator::fold;
 9 | |             }
10 | |         },
   | |_________^

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.r3lSV7fiTksw/rustc_testrunner_tmpdir_reporting.uCm2T54LuGi9/mvce.rs:13:2
   |
13 | }
   |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.r3lSV7fiTksw/rustc_testrunner_tmpdir_reporting.uCm2T54LuGi9/mvce.rs`

error[E0747]: constant provided when a type was expected
  --> /tmp/icemaker_global_tempdir.r3lSV7fiTksw/rustc_testrunner_tmpdir_reporting.uCm2T54LuGi9/mvce.rs:5:9
   |
 5 | /         {
 6 | |             struct W<I>;
 7 | |             impl<I> W<I> {
 8 | |                 reuse Iterator::fold;
 9 | |             }
10 | |         },
   | |_________^


thread 'rustc' (3545319) panicked at /rustc-dev/c29effdf79bdea928ea366a2a820ed15c1de5f43/compiler/rustc_hir_analysis/src/variance/constraints.rs:376:48:
no entry found for key
stack backtrace:
   0:     0x7f135e42c98b - <<std[2c108ffa59e2e612]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[ada4f7d924c69d4d]::fmt::Display>::fmt
   1:     0x7f135ea20a48 - core[ada4f7d924c69d4d]::fmt::write
   2:     0x7f135e443c56 - <std[2c108ffa59e2e612]::sys::stdio::unix::Stderr as std[2c108ffa59e2e612]::io::Write>::write_fmt
   3:     0x7f135e402c88 - std[2c108ffa59e2e612]::panicking::default_hook::{closure#0}
   4:     0x7f135e41fff3 - std[2c108ffa59e2e612]::panicking::default_hook
   5:     0x7f135d3fb93c - std[2c108ffa59e2e612]::panicking::update_hook::<alloc[42a13c76a5367404]::boxed::Box<rustc_driver_impl[f6379a5ebec66613]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f135e4202d2 - std[2c108ffa59e2e612]::panicking::panic_with_hook
   7:     0x7f135e402d48 - std[2c108ffa59e2e612]::panicking::panic_handler::{closure#0}
   8:     0x7f135e3f72a9 - std[2c108ffa59e2e612]::sys::backtrace::__rust_end_short_backtrace::<std[2c108ffa59e2e612]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f135e4047ad - __rustc[db68a6d43ac6e424]::rust_begin_unwind
  10:     0x7f135af5848c - core[ada4f7d924c69d4d]::panicking::panic_fmt
  11:     0x7f135c3253b4 - core[ada4f7d924c69d4d]::option::expect_failed
  12:     0x7f135f2d4073 - <rustc_hir_analysis[78f7a9b2c9b5e575]::variance::constraints::ConstraintContext>::add_constraints_from_ty
  13:     0x7f135f2d353c - <rustc_hir_analysis[78f7a9b2c9b5e575]::variance::constraints::ConstraintContext>::build_constraints_for_item
  14:     0x7f135bb8ee23 - rustc_hir_analysis[78f7a9b2c9b5e575]::variance::crate_variances
  15:     0x7f135fbcad1e - rustc_query_impl[52e4ef098c0a29b2]::query_impl::crate_variances::invoke_provider_fn::__rust_begin_short_backtrace
  16:     0x7f135fbc6ce5 - rustc_query_impl[52e4ef098c0a29b2]::execution::try_execute_query::<rustc_middle[b5eb10e2400650d3]::query::caches::SingleCache<rustc_middle[b5eb10e2400650d3]::query::erase::ErasedData<[u8; 8usize]>>, false>
  17:     0x7f135fbc5339 - rustc_query_impl[52e4ef098c0a29b2]::query_impl::crate_variances::execute_query_non_incr::__rust_end_short_backtrace
  18:     0x7f136007d0e2 - rustc_query_impl[52e4ef098c0a29b2]::query_impl::variances_of::invoke_provider_fn::__rust_begin_short_backtrace.warm
  19:     0x7f135ebabb74 - rustc_query_impl[52e4ef098c0a29b2]::execution::try_execute_query::<rustc_middle[b5eb10e2400650d3]::query::caches::DefIdCache<rustc_middle[b5eb10e2400650d3]::query::erase::ErasedData<[u8; 16usize]>>, false>
  20:     0x7f135ebab60d - rustc_query_impl[52e4ef098c0a29b2]::query_impl::variances_of::execute_query_non_incr::__rust_end_short_backtrace
  21:     0x7f135ef3ebb2 - rustc_hir_analysis[78f7a9b2c9b5e575]::check::wfcheck::check_variances_for_type_defn
  22:     0x7f135eff658f - rustc_hir_analysis[78f7a9b2c9b5e575]::check::check::check_item_type
  23:     0x7f135eff17dc - rustc_hir_analysis[78f7a9b2c9b5e575]::check::wfcheck::check_well_formed
  24:     0x7f135eff17af - rustc_query_impl[52e4ef098c0a29b2]::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
  25:     0x7f135eff0de4 - rustc_query_impl[52e4ef098c0a29b2]::execution::try_execute_query::<rustc_data_structures[f02a73d2ebd1b292]::vec_cache::VecCache<rustc_span[fd2c50334a97f64c]::def_id::LocalDefId, rustc_middle[b5eb10e2400650d3]::query::erase::ErasedData<[u8; 1usize]>, rustc_middle[b5eb10e2400650d3]::dep_graph::graph::DepNodeIndex>, false>
  26:     0x7f135eff0b7b - rustc_query_impl[52e4ef098c0a29b2]::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
  27:     0x7f135efecd49 - rustc_hir_analysis[78f7a9b2c9b5e575]::check::wfcheck::check_type_wf
  28:     0x7f135efecc53 - rustc_query_impl[52e4ef098c0a29b2]::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
  29:     0x7f135fbc7f5c - rustc_query_impl[52e4ef098c0a29b2]::execution::try_execute_query::<rustc_middle[b5eb10e2400650d3]::query::caches::SingleCache<rustc_middle[b5eb10e2400650d3]::query::erase::ErasedData<[u8; 1usize]>>, false>
  30:     0x7f135fbc7d37 - rustc_query_impl[52e4ef098c0a29b2]::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
  31:     0x7f135ed169e9 - rustc_hir_analysis[78f7a9b2c9b5e575]::check_crate
  32:     0x7f135f8ed6c2 - rustc_interface[c33f18da5a348613]::passes::analysis
  33:     0x7f135fbc58c9 - rustc_query_impl[52e4ef098c0a29b2]::execution::try_execute_query::<rustc_middle[b5eb10e2400650d3]::query::caches::SingleCache<rustc_middle[b5eb10e2400650d3]::query::erase::ErasedData<[u8; 0usize]>>, false>
  34:     0x7f135fbc5529 - rustc_query_impl[52e4ef098c0a29b2]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
  35:     0x7f135fb9e050 - rustc_interface[c33f18da5a348613]::interface::run_compiler::<(), rustc_driver_impl[f6379a5ebec66613]::run_compiler::{closure#0}>::{closure#1}
  36:     0x7f135fb87e7e - std[2c108ffa59e2e612]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[c33f18da5a348613]::util::run_in_thread_with_globals<rustc_interface[c33f18da5a348613]::util::run_in_thread_pool_with_globals<rustc_interface[c33f18da5a348613]::interface::run_compiler<(), rustc_driver_impl[f6379a5ebec66613]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  37:     0x7f135fb88720 - <std[2c108ffa59e2e612]::thread::lifecycle::spawn_unchecked<rustc_interface[c33f18da5a348613]::util::run_in_thread_with_globals<rustc_interface[c33f18da5a348613]::util::run_in_thread_pool_with_globals<rustc_interface[c33f18da5a348613]::interface::run_compiler<(), rustc_driver_impl[f6379a5ebec66613]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[ada4f7d924c69d4d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  38:     0x7f135fb895ac - <std[2c108ffa59e2e612]::sys::thread::unix::Thread>::new::thread_start
  39:     0x7f13596a597a - <unknown>
  40:     0x7f13597292bc - <unknown>
  41:                0x0 - <unknown>

error: the compiler unexpectedly panicked. This is a bug

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 make sure that you have updated to the latest nightly

note: rustc 1.97.0-nightly (c29effdf7 2026-04-11) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [crate_variances] computing the variances for items in this crate
#1 [variances_of] computing the variances of `X`
#2 [check_well_formed] checking that `X` is well-formed
#3 [check_type_wf] checking that types are well-formed
#4 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 4 previous errors; 1 warning emitted

Some errors have detailed explanations: E0601, E0658, E0747.
For more information about an error, try `rustc --explain E0601`.

@rustbot label +F-min_generic_const_args +F-fn_delegation

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-fn_delegation`#![feature(fn_delegation)]`F-min_generic_const_args`#![feature(min_generic_const_args)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions