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

オープン
#166,460 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
15/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
rust
領域
compilers

調査の方向性

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/.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Rust
スター
123k
フォーク
16.6k
平均マージ
2日 17時間
マージ済み PR(30日)
532

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rust-lang/rust のほかの issue

rust-lang/rust の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。