[ICE]: `entered unreachable code: we only replace regions in nll_relate, not types`

Abierto
#166,460 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
15/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust
Área
compilers

Línea de trabajo

The panic is raised at the unreachable branch in compiler/rustc_borrowck/src/type_check/relate_tys.rs around line 220, inside NllTypeRelating::enter_forall, reached while borrow-checking f from the reproducer with a higher-ranked trait alias behind &dyn. Start by reading that function and the binders path that calls it, then reproduce with the minimized snippet under the non_lifetime_binders feature. Done means the ICE no longer occurs and the case has a UI test under tests/ui/traits/alias/.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

C-bug F-non_lifetime_binders F-trait_alias I-ICE needs-triage S-found-by-fuzzing T-compiler
Code
#![feature(non_lifetime_binders)]
#![feature(trait_alias)]
#![expect(incomplete_features)]

trait Test<T> {}

pub trait SelfInput = for<T> Test<T>;

pub fn f(_f: &dyn SelfInput) {}

fn main() {}

A mutant of tests/ui/traits/alias/self-in-generics.rs.

Meta

rustc --version --verbose:

rustc 1.102.0-nightly (20fe935d5 2026-11-23)
binary: rustc
commit-hash: 20fe935d50367c0ff8872c2ebfa050c5c99d9201
commit-date: 2026-11-23
host: x86_64-unknown-linux-gnu
release: 1.102.0-nightly
LLVM version: 23.1.6
Error output

Command: rustc --edition 2024

thread 'rustc' (282225) panicked at /rustc-dev/20fe935d50367c0ff8872c2ebfa050c5c99d9201/compiler/rustc_borrowck/src/type_check/relate_tys.rs:220:21:
internal error: entered unreachable code: we only replace regions in nll_relate, not types
Backtrace

thread 'rustc' (282225) panicked at /rustc-dev/20fe935d50367c0ff8872c2ebfa050c5c99d9201/compiler/rustc_borrowck/src/type_check/relate_tys.rs:220:21:
internal error: entered unreachable code: we only replace regions in nll_relate, not types
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <<rustc_borrowck::type_check::relate_tys::NllTypeRelating>::enter_forall<rustc_type_ir::ty_kind::FnSig<rustc_middle::ty::context::TyCtxt>, core::result::Result<rustc_type_ir::ty_kind::FnSig<rustc_middle::ty::context::TyCtxt>, rustc_type_ir::error::TypeError<rustc_middle::ty::context::TyCtxt>>, <rustc_borrowck::type_check::relate_tys::NllTypeRelating as rustc_type_ir::relate::TypeRelation<rustc_middle::ty::context::TyCtxt>>::binders<rustc_type_ir::ty_kind::FnSig<rustc_middle::ty::context::TyCtxt>>::{closure#0}>::{closure#1} as core::ops::function::FnOnce<(rustc_type_ir::binder::BoundTy<rustc_middle::ty::context::TyCtxt>,)>>::call_once::{shim:vtable#0}
   3: <rustc_type_ir::fold::BoundVarReplacer<rustc_middle::ty::context::TyCtxt, rustc_type_ir::fold::FnMutDelegate<rustc_middle::ty::context::TyCtxt>> as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty
   4: <rustc_middle::ty::generic_args::GenericArgs as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::fold_with::<rustc_type_ir::fold::BoundVarReplacer<rustc_middle::ty::context::TyCtxt, rustc_type_ir::fold::FnMutDelegate<rustc_middle::ty::context::TyCtxt>>>
   5: rustc_type_ir::fold::replace_escaping_bound_vars_uncached::<rustc_middle::ty::context::TyCtxt, rustc_type_ir::predicate::ExistentialTraitRef<rustc_middle::ty::context::TyCtxt>, rustc_type_ir::fold::FnMutDelegate<rustc_middle::ty::context::TyCtxt>>
   6: <&rustc_middle::ty::list::RawList<(), rustc_type_ir::binder::Binder<rustc_middle::ty::context::TyCtxt, rustc_type_ir::predicate::ExistentialPredicate<rustc_middle::ty::context::TyCtxt>>> as rustc_type_ir::relate::Relate<rustc_middle::ty::context::TyCtxt>>::relate::<rustc_borrowck::type_check::relate_tys::NllTypeRelating>::{closure#0}
   7: <&rustc_middle::ty::list::RawList<(), rustc_type_ir::binder::Binder<rustc_middle::ty::context::TyCtxt, rustc_type_ir::predicate::ExistentialPredicate<rustc_middle::ty::context::TyCtxt>>> as rustc_type_ir::relate::Relate<rustc_middle::ty::context::TyCtxt>>::relate::<rustc_borrowck::type_check::relate_tys::NllTypeRelating>
   8: rustc_type_ir::relate::structurally_relate_tys::<rustc_middle::ty::context::TyCtxt, rustc_borrowck::type_check::relate_tys::NllTypeRelating>::{closure#0}
   9: rustc_type_ir::relate::structurally_relate_tys::<rustc_middle::ty::context::TyCtxt, rustc_borrowck::type_check::relate_tys::NllTypeRelating>::{closure#0}
  10: rustc_borrowck::borrowck_collect_region_constraints
  11: <rustc_borrowck::root_cx::BorrowCheckRootCtxt>::do_mir_borrowck
  12: rustc_borrowck::mir_borrowck
      [... omitted 1 frame ...]
  13: <rustc_middle::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface::passes::run_required_analyses::{closure#2}::{closure#0}>::{closure#0}
  14: rustc_thread_pool::scope::scope::<rustc_data_structures::sync::parallel::par_range_internal<rustc_data_structures::sync::parallel::par_for_each_in<rustc_span::def_id::LocalDefId, [rustc_span::def_id::LocalDefId], <rustc_middle::ty::context::TyCtxt>::par_hir_body_owners<rustc_interface::passes::run_required_analyses::{closure#2}::{closure#0}>::{closure#0}>::{closure#0}::{closure#0}>::{closure#1}, ()>::{closure#0}
  15: rustc_interface::passes::run_required_analyses
  16: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, false>
  17: rustc_interface::passes::full_analysis
  18: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::compiler_entrypoint::{closure#0}>::{closure#2}
  19: <rustc_thread_pool::job::StackJob<rustc_thread_pool::latch::LatchRef<rustc_thread_pool::latch::LockLatch>, <rustc_thread_pool::registry::Registry>::in_worker_cold<<rustc_thread_pool::thread_pool::ThreadPool>::install<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::compiler_entrypoint::{closure#0}>::{closure#2}, ()>::{closure#6}::{closure#0}::{closure#1}::{closure#0}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> as rustc_thread_pool::job::Job>::execute
  20: <rustc_thread_pool::registry::WorkerThread>::wait_or_steal_until_cold
  21: <rustc_thread_pool::registry::ThreadBuilder>::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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: please attach the file at `/home/jb/workspace/261124-ice-report-check/tmp/rustc-ice-2026-11-24T04_32_38-282214.txt` to your bug report

note: rustc 1.102.0-nightly (20fe935d5 2026-11-23) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_borrowck] borrow-checking `f`
#1 [required_analysis] running required analysis passes on crate `asdf`
end of query stack

Notes
Duplication Check

@rustbot label +S-found-by-fuzzing +F-non_lifetime_binders +F-trait_alias

Lenguaje dominante
Rust
Estrellas
123k
Forks
16.6k
Merge medio
2 d 17 h
PR fusionados (30 d)
532

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de rust-lang/rust

Todos los issues de rust-lang/rust

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.