rust-lang / rust-lang/rust

[ICE]: snapshot_vec: index out of bounds: the len is 1 but the index is 1

Open
#153,357 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug F-transmutability F-unboxed_closures I-ICE needs-triage T-compiler WG-trait-system-refactor
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

auto-reduced (treereduce-rust):

//@compile-flags: -Znext-solver=globally
fn delay<Make: FnMut(Ref) -> C, C: std::mem::TransmuteFrom()>(make: Make) -> impl Sized {}

fn main() {
    delay(|0| delay)
}

original:

#![feature(transmutability)]
#![feature(unboxed_closures)]

use std::cell::Ref;
fn delay<Make: FnMut(Ref) -> C, C: std::mem::TransmuteFrom()>(make: Make) -> impl Sized {}

fn main() {
    delay(|0| delay)
}

Version information

rustc 1.96.0-nightly (d2218f5f5 2026-03-03)
binary: rustc
commit-hash: d2218f5f5ca3f502772ec4cb69fc2ee44e096512
commit-date: 2026-03-03
host: x86_64-unknown-linux-gnu
release: 1.96.0-nightly
LLVM version: 22.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Znext-solver=globally

Program output

error[E0425]: cannot find type `Ref` in this scope
 --> /tmp/icemaker_global_tempdir.HuyfJ0oWTYcw/rustc_testrunner_tmpdir_reporting.OHb4dpJ5JKVO/mvce.rs:1:22
  |
1 | fn delay<Make: FnMut(Ref) -> C, C: std::mem::TransmuteFrom()>(make: Make) -> impl Sized {}
  |                      ^^^ not found in this scope
  |
help: consider importing this struct
  |
1 + use std::cell::Ref;
  |

error[E0658]: use of unstable library feature `transmutability`
 --> /tmp/icemaker_global_tempdir.HuyfJ0oWTYcw/rustc_testrunner_tmpdir_reporting.OHb4dpJ5JKVO/mvce.rs:1:36
  |
1 | fn delay<Make: FnMut(Ref) -> C, C: std::mem::TransmuteFrom()>(make: Make) -> impl Sized {}
  |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #99571 <https://github.com/rust-lang/rust/issues/99571> for more information
  = help: add `#![feature(transmutability)]` to the crate attributes to enable
  = note: this compiler was built on 2026-03-03; consider upgrading it if it is out of date

error[E0658]: parenthetical notation is only stable when used with `Fn`-family traits
 --> /tmp/icemaker_global_tempdir.HuyfJ0oWTYcw/rustc_testrunner_tmpdir_reporting.OHb4dpJ5JKVO/mvce.rs:1:36
  |
1 | fn delay<Make: FnMut(Ref) -> C, C: std::mem::TransmuteFrom()>(make: Make) -> impl Sized {}
  |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
  = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
  = note: this compiler was built on 2026-03-03; consider upgrading it if it is out of date

error[E0220]: associated type `Output` not found for `TransmuteFrom`
 --> /tmp/icemaker_global_tempdir.HuyfJ0oWTYcw/rustc_testrunner_tmpdir_reporting.OHb4dpJ5JKVO/mvce.rs:1:46
  |
1 | fn delay<Make: FnMut(Ref) -> C, C: std::mem::TransmuteFrom()>(make: Make) -> impl Sized {}
  |                                              ^^^^^^^^^^^^^^^ associated type `Output` not found


thread 'rustc' (593782) panicked at /rust/deps/ena-0.14.4/src/snapshot_vec.rs:199:10:
index out of bounds: the len is 1 but the index is 1
stack backtrace:
   0:     0x7fe03b762aab - <<std[76599d2169901dc8]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[d5ffb84325ed5c2a]::fmt::Display>::fmt
   1:     0x7fe03be228c8 - core[d5ffb84325ed5c2a]::fmt::write
   2:     0x7fe03b779ab6 - <std[76599d2169901dc8]::sys::stdio::unix::Stderr as std[76599d2169901dc8]::io::Write>::write_fmt
   3:     0x7fe03b738b88 - std[76599d2169901dc8]::panicking::default_hook::{closure#0}
   4:     0x7fe03b755f13 - std[76599d2169901dc8]::panicking::default_hook
   5:     0x7fe03a7424cc - std[76599d2169901dc8]::panicking::update_hook::<alloc[f847baa7d3d2ac55]::boxed::Box<rustc_driver_impl[ffd722fd6c32666a]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7fe03b7561f2 - std[76599d2169901dc8]::panicking::panic_with_hook
   7:     0x7fe03b738c48 - std[76599d2169901dc8]::panicking::panic_handler::{closure#0}
   8:     0x7fe03b72f979 - std[76599d2169901dc8]::sys::backtrace::__rust_end_short_backtrace::<std[76599d2169901dc8]::panicking::panic_handler::{closure#0}, !>
   9:     0x7fe03b73a6ad - __rustc[7dea9537d06e225e]::rust_begin_unwind
  10:     0x7fe03831975c - core[d5ffb84325ed5c2a]::panicking::panic_fmt
  11:     0x7fe0386fa982 - core[d5ffb84325ed5c2a]::panicking::panic_bounds_check
  12:     0x7fe03cdcaced - <rustc_infer[a106829e2b559cfc]::infer::InferCtxt as rustc_type_ir[6a4b9ee69e1ff834]::infer_ctxt::InferCtxtLike>::opportunistic_resolve_ty_var
  13:     0x7fe03cdc0cb4 - <rustc_next_trait_solver[beb9dc5464000fde]::resolve::EagerResolver<rustc_trait_selection[502c21a12406236f]::solve::delegate::SolverDelegate, rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt> as rustc_type_ir[6a4b9ee69e1ff834]::fold::TypeFolder<rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt>>::fold_ty
  14:     0x7fe03cdc08f1 - <&rustc_middle[7c9cbe436035c5a4]::ty::list::RawList<(), rustc_middle[7c9cbe436035c5a4]::ty::generic_args::GenericArg> as rustc_type_ir[6a4b9ee69e1ff834]::fold::TypeFoldable<rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt>>::fold_with::<rustc_next_trait_solver[beb9dc5464000fde]::resolve::EagerResolver<rustc_trait_selection[502c21a12406236f]::solve::delegate::SolverDelegate, rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt>>
  15:     0x7fe03cdc0d05 - <rustc_next_trait_solver[beb9dc5464000fde]::resolve::EagerResolver<rustc_trait_selection[502c21a12406236f]::solve::delegate::SolverDelegate, rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt> as rustc_type_ir[6a4b9ee69e1ff834]::fold::TypeFolder<rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt>>::fold_ty
  16:     0x7fe03cdc13a6 - <rustc_next_trait_solver[beb9dc5464000fde]::resolve::EagerResolver<rustc_trait_selection[502c21a12406236f]::solve::delegate::SolverDelegate, rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt> as rustc_type_ir[6a4b9ee69e1ff834]::fold::TypeFolder<rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt>>::fold_predicate
  17:     0x7fe03cdc1666 - <rustc_type_ir[6a4b9ee69e1ff834]::solve::Goal<rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt, rustc_middle[7c9cbe436035c5a4]::ty::predicate::Predicate> as rustc_type_ir[6a4b9ee69e1ff834]::fold::TypeFoldable<rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt>>::fold_with::<rustc_next_trait_solver[beb9dc5464000fde]::resolve::EagerResolver<rustc_trait_selection[502c21a12406236f]::solve::delegate::SolverDelegate, rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt>>
  18:     0x7fe03cdc1527 - rustc_next_trait_solver[beb9dc5464000fde]::resolve::eager_resolve_vars::<rustc_trait_selection[502c21a12406236f]::solve::delegate::SolverDelegate, (rustc_type_ir[6a4b9ee69e1ff834]::solve::Goal<rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt, rustc_middle[7c9cbe436035c5a4]::ty::predicate::Predicate>, alloc[f847baa7d3d2ac55]::vec::Vec<(rustc_type_ir[6a4b9ee69e1ff834]::opaque_ty::OpaqueTypeKey<rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt>, rustc_middle[7c9cbe436035c5a4]::ty::Ty)>)>
  19:     0x7fe03cdbd7e7 - <rustc_next_trait_solver[beb9dc5464000fde]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[502c21a12406236f]::solve::delegate::SolverDelegate, rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt>>::evaluate_goal_raw
  20:     0x7fe03cdbcfcd - <rustc_trait_selection[502c21a12406236f]::solve::fulfill::FulfillmentCtxt<rustc_infer[a106829e2b559cfc]::traits::engine::ScrubbedTraitError> as rustc_infer[a106829e2b559cfc]::traits::engine::TraitEngine<rustc_infer[a106829e2b559cfc]::traits::engine::ScrubbedTraitError>>::try_evaluate_obligations
  21:     0x7fe03cdc2b8d - <rustc_trait_selection[502c21a12406236f]::solve::normalize::NormalizationFolder<rustc_infer[a106829e2b559cfc]::traits::engine::ScrubbedTraitError>>::normalize_alias_term
  22:     0x7fe03cdc1f6d - <rustc_trait_selection[502c21a12406236f]::solve::normalize::NormalizationFolder<rustc_infer[a106829e2b559cfc]::traits::engine::ScrubbedTraitError> as rustc_type_ir[6a4b9ee69e1ff834]::fold::FallibleTypeFolder<rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt>>::try_fold_ty::{closure#0}
  23:     0x7fe03c769bd7 - <rustc_traits[e245382208f7963e]::normalize_erasing_regions::provide::{closure#0} as core[d5ffb84325ed5c2a]::ops::function::FnOnce<(rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt, rustc_middle[7c9cbe436035c5a4]::ty::PseudoCanonicalInput<rustc_middle[7c9cbe436035c5a4]::ty::generic_args::GenericArg>)>>::call_once
  24:     0x7fe03c7683e3 - rustc_query_impl[89f9236b2ac04da0]::execution::try_execute_query::<rustc_middle[7c9cbe436035c5a4]::query::caches::DefaultCache<rustc_middle[7c9cbe436035c5a4]::ty::PseudoCanonicalInput<rustc_middle[7c9cbe436035c5a4]::ty::generic_args::GenericArg>, rustc_middle[7c9cbe436035c5a4]::query::erase::ErasedData<[u8; 8usize]>>, false>
  25:     0x7fe03c768083 - rustc_query_impl[89f9236b2ac04da0]::query_impl::try_normalize_generic_arg_after_erasing_regions::execute_query_non_incr::__rust_end_short_backtrace
  26:     0x7fe03c767892 - <rustc_middle[7c9cbe436035c5a4]::ty::normalize_erasing_regions::TryNormalizeAfterErasingRegionsFolder as rustc_type_ir[6a4b9ee69e1ff834]::fold::FallibleTypeFolder<rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt>>::try_fold_ty
  27:     0x7fe03c7452e2 - rustc_ty_utils[23782f25fc8ac972]::layout::layout_of
  28:     0x7fe03c74512f - rustc_query_impl[89f9236b2ac04da0]::query_impl::layout_of::invoke_provider_fn::__rust_begin_short_backtrace
  29:     0x7fe03c74402a - rustc_query_impl[89f9236b2ac04da0]::execution::try_execute_query::<rustc_middle[7c9cbe436035c5a4]::query::caches::DefaultCache<rustc_middle[7c9cbe436035c5a4]::ty::PseudoCanonicalInput<rustc_middle[7c9cbe436035c5a4]::ty::Ty>, rustc_middle[7c9cbe436035c5a4]::query::erase::ErasedData<[u8; 16usize]>>, false>
  30:     0x7fe03c743c5e - rustc_query_impl[89f9236b2ac04da0]::query_impl::layout_of::execute_query_non_incr::__rust_end_short_backtrace
  31:     0x7fe03b685dac - rustc_transmute[a3106bcd6ed1d712]::layout::rustc::layout_of
  32:     0x7fe03b683e52 - <rustc_transmute[a3106bcd6ed1d712]::layout::tree::Tree<rustc_transmute[a3106bcd6ed1d712]::layout::rustc::Def, rustc_middle[7c9cbe436035c5a4]::ty::region::Region, rustc_middle[7c9cbe436035c5a4]::ty::Ty>>::from_ty
  33:     0x7fe03b67d754 - <rustc_transmute[a3106bcd6ed1d712]::rustc::TransmuteTypeEnv>::is_transmutable
  34:     0x7fe03b5b6415 - <rustc_trait_selection[502c21a12406236f]::solve::delegate::SolverDelegate as rustc_next_trait_solver[beb9dc5464000fde]::delegate::SolverDelegate>::is_transmutable
  35:     0x7fe03b5a8051 - <rustc_type_ir[6a4b9ee69e1ff834]::predicate::TraitPredicate<rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt> as rustc_next_trait_solver[beb9dc5464000fde]::solve::assembly::GoalKind<rustc_trait_selection[502c21a12406236f]::solve::delegate::SolverDelegate, rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt>>::consider_builtin_transmute_candidate
  36:     0x7fe03cd3c349 - <rustc_next_trait_solver[beb9dc5464000fde]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[502c21a12406236f]::solve::delegate::SolverDelegate, rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt>>::assemble_builtin_impl_candidates::<rustc_type_ir[6a4b9ee69e1ff834]::predicate::TraitPredicate<rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt>>
  37:     0x7fe03cd2e073 - <rustc_next_trait_solver[beb9dc5464000fde]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[502c21a12406236f]::solve::delegate::SolverDelegate, rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt>>::compute_trait_goal
  38:     0x7fe03c8423a9 - <rustc_next_trait_solver[beb9dc5464000fde]::solve::search_graph::SearchGraphDelegate<rustc_trait_selection[502c21a12406236f]::solve::delegate::SolverDelegate> as rustc_type_ir[6a4b9ee69e1ff834]::search_graph::Delegate>::compute_goal::{closure#0}
  39:     0x7fe03c85fe89 - <rustc_next_trait_solver[beb9dc5464000fde]::solve::eval_ctxt::EvalCtxt<rustc_trait_selection[502c21a12406236f]::solve::delegate::SolverDelegate, rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt>>::evaluate_goal_raw
  40:     0x7fe03c84e87c - <rustc_trait_selection[502c21a12406236f]::solve::fulfill::FulfillmentCtxt<rustc_infer[a106829e2b559cfc]::traits::engine::ScrubbedTraitError> as rustc_infer[a106829e2b559cfc]::traits::engine::TraitEngine<rustc_infer[a106829e2b559cfc]::traits::engine::ScrubbedTraitError>>::evaluate_obligations_error_on_ambiguity
  41:     0x7fe03c51b744 - <rustc_infer[a106829e2b559cfc]::infer::InferCtxt as rustc_trait_selection[502c21a12406236f]::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
  42:     0x7fe03b5749d5 - <rustc_trait_selection[502c21a12406236f]::error_reporting::TypeErrCtxt>::suggest_fn_call
  43:     0x7fe03b53dbc0 - <rustc_trait_selection[502c21a12406236f]::error_reporting::TypeErrCtxt>::report_selection_error
  44:     0x7fe03a02fdb6 - <rustc_trait_selection[502c21a12406236f]::error_reporting::TypeErrCtxt>::report_fulfillment_errors
  45:     0x7fe03c24ebd5 - <rustc_hir_typeck[9092ee1b27375cdd]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  46:     0x7fe03c2642e0 - <rustc_hir_typeck[9092ee1b27375cdd]::fn_ctxt::FnCtxt>::check_expr_call
  47:     0x7fe03c24bd90 - <rustc_hir_typeck[9092ee1b27375cdd]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  48:     0x7fe03c245f70 - <rustc_hir_typeck[9092ee1b27375cdd]::fn_ctxt::FnCtxt>::check_expr_block
  49:     0x7fe03c24bd17 - <rustc_hir_typeck[9092ee1b27375cdd]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  50:     0x7fe03c21a9f8 - rustc_hir_typeck[9092ee1b27375cdd]::check::check_fn
  51:     0x7fe03cc26374 - rustc_hir_typeck[9092ee1b27375cdd]::typeck_with_inspect::{closure#0}
  52:     0x7fe03cc24df2 - rustc_query_impl[89f9236b2ac04da0]::query_impl::typeck::invoke_provider_fn::__rust_begin_short_backtrace
  53:     0x7fe03bf6d18a - rustc_query_impl[89f9236b2ac04da0]::execution::try_execute_query::<rustc_data_structures[79f5f180de225010]::vec_cache::VecCache<rustc_span[8a71b77c74bc13cb]::def_id::LocalDefId, rustc_middle[7c9cbe436035c5a4]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[7c9cbe436035c5a4]::dep_graph::graph::DepNodeIndex>, false>
  54:     0x7fe03bf6cb03 - rustc_query_impl[89f9236b2ac04da0]::query_impl::typeck::execute_query_non_incr::__rust_end_short_backtrace
  55:     0x7fe03c4a5a96 - <rustc_middle[7c9cbe436035c5a4]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[7282aa5ba0febab4]::check_crate::{closure#2}>::{closure#0}
  56:     0x7fe03c4a54f5 - rustc_hir_analysis[7282aa5ba0febab4]::check_crate
  57:     0x7fe03bf69b93 - rustc_interface[400bc27e64bfd912]::passes::analysis
  58:     0x7fe03d03175c - rustc_query_impl[89f9236b2ac04da0]::execution::try_execute_query::<rustc_middle[7c9cbe436035c5a4]::query::caches::SingleCache<rustc_middle[7c9cbe436035c5a4]::query::erase::ErasedData<[u8; 0usize]>>, false>
  59:     0x7fe03d0314bb - rustc_query_impl[89f9236b2ac04da0]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
  60:     0x7fe03cfeda2d - rustc_interface[400bc27e64bfd912]::interface::run_compiler::<(), rustc_driver_impl[ffd722fd6c32666a]::run_compiler::{closure#0}>::{closure#1}
  61:     0x7fe03cfd20be - std[76599d2169901dc8]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[400bc27e64bfd912]::util::run_in_thread_with_globals<rustc_interface[400bc27e64bfd912]::util::run_in_thread_pool_with_globals<rustc_interface[400bc27e64bfd912]::interface::run_compiler<(), rustc_driver_impl[ffd722fd6c32666a]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  62:     0x7fe03cfd2720 - <std[76599d2169901dc8]::thread::lifecycle::spawn_unchecked<rustc_interface[400bc27e64bfd912]::util::run_in_thread_with_globals<rustc_interface[400bc27e64bfd912]::util::run_in_thread_pool_with_globals<rustc_interface[400bc27e64bfd912]::interface::run_compiler<(), rustc_driver_impl[ffd722fd6c32666a]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[d5ffb84325ed5c2a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  63:     0x7fe03cfd35ac - <std[76599d2169901dc8]::sys::thread::unix::Thread>::new::thread_start
  64:     0x7fe036aa598b - <unknown>
  65:     0x7fe036b29a0c - <unknown>
  66:                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.96.0-nightly (d2218f5f5 2026-03-03) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z next-solver=globally -Z dump-mir-dir=dir

query stack during panic:
#0 [try_normalize_generic_arg_after_erasing_regions] normalizing `delay::{opaque#0}`
#1 [layout_of] computing layout of `delay::{opaque#0}`
#2 [typeck] type-checking `main`
#3 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 4 previous errors

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

@rustbot label +F-transmutability +F-unboxed_closures +WG-trait-system-refactor

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by compiling the reduced a.rs reproducer with -Znext-solver=globally and inspect the panic at ena-0.14.4/src/snapshot_vec.rs:199. Trace the rustc_infer opportunistic_resolve_ty_var and rustc_next_trait_solver frames shown in the backtrace; done means the reproducer reports diagnostics without an internal compiler error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.