ICE caused by `feature(non_lifetime_binders)` feature in combination with trait bounds involving GATs
Open
Nobody has claimed this yet.
C-bug
F-non_lifetime_binders
I-ICE
S-bug-has-test
S-has-mcve
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
rustc-ice-2025-12-26T18_23_13-31309.txt
Code
#![feature(non_lifetime_binders)]
trait A<T> {
type GAT<U>: A<U>;
fn foo<U>(self, u: U) -> Self::GAT<U>
where
Self: Sized;
}
trait B<T>: A<T>
where
for<U> Self::GAT<U>: B<U>,
{
fn bar<U>(self) -> Self::GAT<U>
where
Self: Sized;
fn baz<U>(self, u: U) -> Self::GAT<U>
where
Self: Sized,
{
self.foo(u).bar()
}
}
Meta
rustc --version --verbose:
rustc 1.94.0-nightly (fabece9e9 2025-12-25)
binary: rustc
commit-hash: fabece9e9491d0a3c3655dba488881968b7c5f7a
commit-date: 2025-12-25
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 21.1.8
Error output
error: internal compiler error: /rustc-dev/fabece9e9491d0a3c3655dba488881968b7c5f7a/compiler/rustc_middle/src/ty/fold.rs:236:33: unexpected bound ty in binder: DefId(0:11 ~ non_lifetime_binders_ice[56ef]::B::U)
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/mego/non-lifetime-binders-ice/rustc-ice-2025-12-26T18_23_13-31309.txt` to your bug report
note: rustc 1.94.0-nightly (fabece9e9 2025-12-25) running on x86_64-unknown-linux-gnu
note: compiler flags: --crate-type lib -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 [typeck] type-checking `B::baz`
#1 [analysis] running analysis passes on crate `non_lifetime_binders_ice`
end of query stack
warning: `non-lifetime-binders-ice` (lib) generated 1 warning
error: could not compile `non-lifetime-binders-ice` (lib); 1 warning emitted
Caused by:
process didn't exit successfully: `/home/mego/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name non_lifetime_binders_ice --edition=2024 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=120 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values())' -C metadata=0d4d6d84d0327686 -C extra-filename=-945b58e5f233fce9 --out-dir /home/mego/non-lifetime-binders-ice/target/debug/deps -C incremental=/home/mego/non-lifetime-binders-ice/target/debug/incremental -L dependency=/home/mego/non-lifetime-binders-ice/target/debug/deps` (exit status: 101)
Backtrace
thread 'rustc' (32094) panicked at /rustc-dev/fabece9e9491d0a3c3655dba488881968b7c5f7a/compiler/rustc_middle/src/ty/fold.rs:236:33:
Box<dyn Any>
stack backtrace:
0: 0x7fd0c205e583 - <<std[c1452cd6b6f4b41c]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[df330930cbc6b342]::fmt::Display>::fmt
1: 0x7fd0c28106c8 - core[df330930cbc6b342]::fmt::write
2: 0x7fd0c2074cd6 - <std[c1452cd6b6f4b41c]::sys::stdio::unix::Stderr as std[c1452cd6b6f4b41c]::io::Write>::write_fmt
3: 0x7fd0c2034d28 - std[c1452cd6b6f4b41c]::panicking::default_hook::{closure#0}
4: 0x7fd0c20523f3 - std[c1452cd6b6f4b41c]::panicking::default_hook
5: 0x7fd0c102e1ba - std[c1452cd6b6f4b41c]::panicking::update_hook::<alloc[fdba8dc7c7cb980c]::boxed::Box<rustc_driver_impl[e9308e410a80ccc2]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7fd0c20526d2 - std[c1452cd6b6f4b41c]::panicking::panic_with_hook
7: 0x7fd0c106ab31 - std[c1452cd6b6f4b41c]::panicking::begin_panic::<rustc_errors[8cf289fd9a18de16]::ExplicitBug>::{closure#0}
8: 0x7fd0c105b076 - std[c1452cd6b6f4b41c]::sys::backtrace::__rust_end_short_backtrace::<std[c1452cd6b6f4b41c]::panicking::begin_panic<rustc_errors[8cf289fd9a18de16]::ExplicitBug>::{closure#0}, !>
9: 0x7fd0c1058419 - std[c1452cd6b6f4b41c]::panicking::begin_panic::<rustc_errors[8cf289fd9a18de16]::ExplicitBug>
10: 0x7fd0c1088b21 - <rustc_errors[8cf289fd9a18de16]::diagnostic::BugAbort as rustc_errors[8cf289fd9a18de16]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
11: 0x7fd0c16364a9 - rustc_middle[54bcc516263886d0]::util::bug::opt_span_bug_fmt::<rustc_span[160bea70edb6b602]::span_encoding::Span>::{closure#0}
12: 0x7fd0c1636632 - rustc_middle[54bcc516263886d0]::ty::context::tls::with_opt::<rustc_middle[54bcc516263886d0]::util::bug::opt_span_bug_fmt<rustc_span[160bea70edb6b602]::span_encoding::Span>::{closure#0}, !>::{closure#0}
13: 0x7fd0c162750b - rustc_middle[54bcc516263886d0]::ty::context::tls::with_context_opt::<rustc_middle[54bcc516263886d0]::ty::context::tls::with_opt<rustc_middle[54bcc516263886d0]::util::bug::opt_span_bug_fmt<rustc_span[160bea70edb6b602]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
14: 0x7fd0bf04fd64 - rustc_middle[54bcc516263886d0]::util::bug::bug_fmt
15: 0x7fd0c1de847e - <rustc_middle[54bcc516263886d0]::ty::context::TyCtxt>::instantiate_bound_regions_uncached::<rustc_type_ir[a4a11647208c0e96]::ty_kind::FnSig<rustc_middle[54bcc516263886d0]::ty::context::TyCtxt>, <rustc_middle[54bcc516263886d0]::ty::context::TyCtxt>::instantiate_bound_regions<rustc_type_ir[a4a11647208c0e96]::ty_kind::FnSig<rustc_middle[54bcc516263886d0]::ty::context::TyCtxt>, <rustc_middle[54bcc516263886d0]::ty::context::TyCtxt>::instantiate_bound_regions_with_erased<rustc_type_ir[a4a11647208c0e96]::ty_kind::FnSig<rustc_middle[54bcc516263886d0]::ty::context::TyCtxt>>::{closure#0}>::{closure#0}>::{closure#0}
16: 0x7fd0c16b7f66 - <rustc_middle[54bcc516263886d0]::ty::fold::FnMutDelegate as rustc_middle[54bcc516263886d0]::ty::fold::BoundVarReplacerDelegate>::replace_ty
17: 0x7fd0c29dfcfd - <rustc_middle[54bcc516263886d0]::ty::fold::BoundVarReplacer<rustc_middle[54bcc516263886d0]::ty::fold::FnMutDelegate> as rustc_type_ir[a4a11647208c0e96]::fold::TypeFolder<rustc_middle[54bcc516263886d0]::ty::context::TyCtxt>>::fold_ty
18: 0x7fd0c29dec4c - <&rustc_middle[54bcc516263886d0]::ty::list::RawList<(), rustc_middle[54bcc516263886d0]::ty::generic_args::GenericArg> as rustc_type_ir[a4a11647208c0e96]::fold::TypeFoldable<rustc_middle[54bcc516263886d0]::ty::context::TyCtxt>>::fold_with::<rustc_middle[54bcc516263886d0]::ty::fold::BoundVarReplacer<rustc_middle[54bcc516263886d0]::ty::fold::FnMutDelegate>>
19: 0x7fd0c29dfbc1 - <rustc_middle[54bcc516263886d0]::ty::fold::BoundVarReplacer<rustc_middle[54bcc516263886d0]::ty::fold::FnMutDelegate> as rustc_type_ir[a4a11647208c0e96]::fold::TypeFolder<rustc_middle[54bcc516263886d0]::ty::context::TyCtxt>>::fold_ty
20: 0x7fd0c1d4d2bf - <rustc_middle[54bcc516263886d0]::ty::context::TyCtxt>::instantiate_bound_regions_with_erased::<rustc_middle[54bcc516263886d0]::ty::Ty>
21: 0x7fd0c1e685b6 - <rustc_trait_selection[ce697ee2c32d50b6]::error_reporting::TypeErrCtxt>::suggest_dereferences
22: 0x7fd0c1e2b715 - <rustc_trait_selection[ce697ee2c32d50b6]::error_reporting::TypeErrCtxt>::report_selection_error
23: 0x7fd0c096695a - <rustc_trait_selection[ce697ee2c32d50b6]::error_reporting::TypeErrCtxt>::report_fulfillment_errors
24: 0x7fd0c2c77c3a - <rustc_hir_typeck[6de9ddff819006ec]::fn_ctxt::FnCtxt>::check_expr_method_call
25: 0x7fd0c2ca46f0 - <rustc_hir_typeck[6de9ddff819006ec]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
26: 0x7fd0c2c9eb65 - <rustc_hir_typeck[6de9ddff819006ec]::fn_ctxt::FnCtxt>::check_expr_block
27: 0x7fd0c2ca470c - <rustc_hir_typeck[6de9ddff819006ec]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
28: 0x7fd0c2c85491 - rustc_hir_typeck[6de9ddff819006ec]::check::check_fn
29: 0x7fd0c3479cf9 - rustc_hir_typeck[6de9ddff819006ec]::typeck_with_inspect::{closure#0}
30: 0x7fd0c3478670 - rustc_query_impl[94c8afbc39e3af62]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[94c8afbc39e3af62]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[54bcc516263886d0]::query::erase::Erased<[u8; 8usize]>>
31: 0x7fd0c2a45c3e - rustc_query_system[f270da620ae7bca3]::query::plumbing::try_execute_query::<rustc_query_impl[94c8afbc39e3af62]::DynamicConfig<rustc_data_structures[79db1b91e24649bb]::vec_cache::VecCache<rustc_span[160bea70edb6b602]::def_id::LocalDefId, rustc_middle[54bcc516263886d0]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[f270da620ae7bca3]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[94c8afbc39e3af62]::plumbing::QueryCtxt, true>
32: 0x7fd0c2a45041 - rustc_query_impl[94c8afbc39e3af62]::query_impl::typeck::get_query_incr::__rust_end_short_backtrace
33: 0x7fd0c3014d71 - <rustc_middle[54bcc516263886d0]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[b69b1346315f61b2]::check_crate::{closure#2}>::{closure#0}
34: 0x7fd0c3014783 - rustc_hir_analysis[b69b1346315f61b2]::check_crate
35: 0x7fd0c2a4a25b - rustc_interface[67132ee5d2f670a9]::passes::analysis
36: 0x7fd0c2a49eb5 - rustc_query_impl[94c8afbc39e3af62]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[94c8afbc39e3af62]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[54bcc516263886d0]::query::erase::Erased<[u8; 0usize]>>
37: 0x7fd0c3becd0f - rustc_query_system[f270da620ae7bca3]::query::plumbing::try_execute_query::<rustc_query_impl[94c8afbc39e3af62]::DynamicConfig<rustc_query_system[f270da620ae7bca3]::query::caches::SingleCache<rustc_middle[54bcc516263886d0]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[94c8afbc39e3af62]::plumbing::QueryCtxt, true>
38: 0x7fd0c3bec5bf - rustc_query_impl[94c8afbc39e3af62]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
39: 0x7fd0c3ac7951 - <rustc_interface[67132ee5d2f670a9]::passes::create_and_enter_global_ctxt<core[df330930cbc6b342]::option::Option<rustc_interface[67132ee5d2f670a9]::queries::Linker>, rustc_driver_impl[e9308e410a80ccc2]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[df330930cbc6b342]::ops::function::FnOnce<(&rustc_session[947e878a67e7e5f8]::session::Session, rustc_middle[54bcc516263886d0]::ty::context::CurrentGcx, alloc[fdba8dc7c7cb980c]::sync::Arc<rustc_data_structures[79db1b91e24649bb]::jobserver::Proxy>, &std[c1452cd6b6f4b41c]::sync::once_lock::OnceLock<rustc_middle[54bcc516263886d0]::ty::context::GlobalCtxt>, &rustc_data_structures[79db1b91e24649bb]::sync::worker_local::WorkerLocal<rustc_middle[54bcc516263886d0]::arena::Arena>, &rustc_data_structures[79db1b91e24649bb]::sync::worker_local::WorkerLocal<rustc_hir[9181c4482ba2e702]::Arena>, rustc_driver_impl[e9308e410a80ccc2]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
40: 0x7fd0c3a3678a - rustc_interface[67132ee5d2f670a9]::interface::run_compiler::<(), rustc_driver_impl[e9308e410a80ccc2]::run_compiler::{closure#0}>::{closure#1}
41: 0x7fd0c39768ce - std[c1452cd6b6f4b41c]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[67132ee5d2f670a9]::util::run_in_thread_with_globals<rustc_interface[67132ee5d2f670a9]::util::run_in_thread_pool_with_globals<rustc_interface[67132ee5d2f670a9]::interface::run_compiler<(), rustc_driver_impl[e9308e410a80ccc2]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
42: 0x7fd0c39766a0 - <std[c1452cd6b6f4b41c]::thread::lifecycle::spawn_unchecked<rustc_interface[67132ee5d2f670a9]::util::run_in_thread_with_globals<rustc_interface[67132ee5d2f670a9]::util::run_in_thread_pool_with_globals<rustc_interface[67132ee5d2f670a9]::interface::run_compiler<(), rustc_driver_impl[e9308e410a80ccc2]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[df330930cbc6b342]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
43: 0x7fd0c397bff8 - <std[c1452cd6b6f4b41c]::sys::thread::unix::Thread>::new::thread_start
44: 0x7fd0bd28aaa4 - start_thread
at ./nptl/pthread_create.c:447:8
45: 0x7fd0bd317c3c - clone3
at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0
46: 0x0 - <unknown>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal reproducer in the issue and run it on the reported nightly compiler. Trace the panic at compiler/rustc_middle/src/ty/fold.rs:236 through type-checking B::baz and the bound-region instantiation path; done means the example no longer causes an internal compiler error and has regression coverage.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100