[ICE]: `it should not be possible to encounter unnormalized aliases in borrowck`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
auto-reduced (treereduce-rust):
type MyClosure = impl AsyncFnOnce<()>;
type MyFuture = <MyClosure as AsyncFnOnce<()>>::CallOnceFuture;
impl MyClosure {
async fn foo(self) -> MyFuture {
become self()
}
}
original:
#![feature(explicit_tail_calls)]
#![feature(type_alias_impl_trait)]
#![feature(async_fn_traits)]
#![feature(unboxed_closures)]
type MyClosure = impl AsyncFnOnce<()>;
type MyFuture = <MyClosure as AsyncFnOnce<()>>::CallOnceFuture;
impl MyClosure {
async fn foo(self) -> MyFuture {
become self()
}
}
fn main() {}
Version information
rustc 1.100.0-nightly (74b3f086e 2026-09-12)
binary: rustc
commit-hash: 74b3f086e27d20f04611a52addc3781576f3c749
commit-date: 2026-09-12
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.1
Possibly related line of code:
https://github.com/rust-lang/rust/blob/74b3f086e27d20f04611a52addc3781576f3c749/compiler/rustc_borrowck/src/type_check/relate_tys.rs#L407-L419
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error[E0670]: `async fn` is not permitted in Rust 2015
--> /tmp/icemaker_global_tempdir.iQ7cEy1zH8N7/rustc_testrunner_tmpdir_reporting.f4c8fWrUpSCp/mvce.rs:4:5
|
4 | async fn foo(self) -> MyFuture {
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
= help: pass `--edition 2024` to `rustc`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
error[E0658]: `become` expression is experimental
--> /tmp/icemaker_global_tempdir.iQ7cEy1zH8N7/rustc_testrunner_tmpdir_reporting.f4c8fWrUpSCp/mvce.rs:5:9
|
5 | become self()
| ^^^^^^^^^^^^^
|
= note: see issue #112788 <https://github.com/rust-lang/rust/issues/112788> for more information
= help: add `#![feature(explicit_tail_calls)]` to the crate attributes to enable
= note: this compiler was built on 2026-09-12; consider upgrading it if it is out of date
error[E0658]: `impl Trait` in type aliases is unstable
--> /tmp/icemaker_global_tempdir.iQ7cEy1zH8N7/rustc_testrunner_tmpdir_reporting.f4c8fWrUpSCp/mvce.rs:1:18
|
1 | type MyClosure = impl AsyncFnOnce<()>;
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
= note: this compiler was built on 2026-09-12; consider upgrading it if it is out of date
error[E0601]: `main` function not found in crate `mvce`
--> /tmp/icemaker_global_tempdir.iQ7cEy1zH8N7/rustc_testrunner_tmpdir_reporting.f4c8fWrUpSCp/mvce.rs:7:2
|
7 | }
| ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.iQ7cEy1zH8N7/rustc_testrunner_tmpdir_reporting.f4c8fWrUpSCp/mvce.rs`
error[E0658]: use of unstable library feature `async_fn_traits`
--> /tmp/icemaker_global_tempdir.iQ7cEy1zH8N7/rustc_testrunner_tmpdir_reporting.f4c8fWrUpSCp/mvce.rs:2:17
|
2 | type MyFuture = <MyClosure as AsyncFnOnce<()>>::CallOnceFuture;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(async_fn_traits)]` to the crate attributes to enable
= note: this compiler was built on 2026-09-12; consider upgrading it if it is out of date
error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change
--> /tmp/icemaker_global_tempdir.iQ7cEy1zH8N7/rustc_testrunner_tmpdir_reporting.f4c8fWrUpSCp/mvce.rs:2:17
|
2 | type MyFuture = <MyClosure as AsyncFnOnce<()>>::CallOnceFuture;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use parenthetical notation instead: `AsyncFnOnce() -> ()`
|
= 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-09-12; consider upgrading it if it is out of date
error: unconstrained opaque type
--> /tmp/icemaker_global_tempdir.iQ7cEy1zH8N7/rustc_testrunner_tmpdir_reporting.f4c8fWrUpSCp/mvce.rs:1:18
|
1 | type MyClosure = impl AsyncFnOnce<()>;
| ^^^^^^^^^^^^^^^^^^^^
|
= note: `MyClosure` must be used in combination with a concrete type within the same crate
error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change
--> /tmp/icemaker_global_tempdir.iQ7cEy1zH8N7/rustc_testrunner_tmpdir_reporting.f4c8fWrUpSCp/mvce.rs:1:23
|
1 | type MyClosure = impl AsyncFnOnce<()>;
| ^^^^^^^^^^^^^^^ help: use parenthetical notation instead: `AsyncFnOnce() -> ()`
|
= 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-09-12; consider upgrading it if it is out of date
error: `become` is not allowed in closures
--> /tmp/icemaker_global_tempdir.iQ7cEy1zH8N7/rustc_testrunner_tmpdir_reporting.f4c8fWrUpSCp/mvce.rs:5:9
|
5 | become self()
| ^^^^^^^^^^^^^
error: internal compiler error: /rustc-dev/74b3f086e27d20f04611a52addc3781576f3c749/compiler/rustc_borrowck/src/type_check/relate_tys.rs:413:17: it should not be possible to encounter unnormalized aliases in borrowck
--> /tmp/icemaker_global_tempdir.iQ7cEy1zH8N7/rustc_testrunner_tmpdir_reporting.f4c8fWrUpSCp/mvce.rs:4:36
|
4 | async fn foo(self) -> MyFuture {
| ____________________________________^
5 | | become self()
6 | | }
| |_____^
thread 'rustc' (744594) panicked at /rustc-dev/74b3f086e27d20f04611a52addc3781576f3c749/compiler/rustc_borrowck/src/type_check/relate_tys.rs:413:17:
Box<dyn Any>
stack backtrace:
0: 0x7ff8ac43d6f6 - <<std[3528600ba3f9fe66]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[9253e626ef1be868]::fmt::Display>::fmt
1: 0x7ff8aca0988f - core[9253e626ef1be868]::fmt::write
2: 0x7ff8ac4526bc - <std[3528600ba3f9fe66]::sys::stdio::unix::Stderr as core[9253e626ef1be868]::io::write::Write>::write_fmt
3: 0x7ff8ac4103da - std[3528600ba3f9fe66]::panicking::default_hook::{closure#0}
4: 0x7ff8ac431e53 - std[3528600ba3f9fe66]::panicking::default_hook
5: 0x7ff8ab16269f - std[3528600ba3f9fe66]::panicking::update_hook::<alloc[19f73542e5485bc1]::boxed::Box<rustc_driver_impl[4014d772c3bdc445]::install_ice_hook::{closure#1}>>::{closure#0}
6: 0x7ff8ac4322f2 - std[3528600ba3f9fe66]::panicking::panic_with_hook
7: 0x7ff8ab191624 - std[3528600ba3f9fe66]::panicking::begin_panic::<rustc_errors[ece56505557c1b0d]::ExplicitBug>::{closure#0}
8: 0x7ff8ab18a216 - std[3528600ba3f9fe66]::sys::backtrace::__rust_end_short_backtrace::<std[3528600ba3f9fe66]::panicking::begin_panic<rustc_errors[ece56505557c1b0d]::ExplicitBug>::{closure#0}, !>
9: 0x7ff8ab18819e - std[3528600ba3f9fe66]::panicking::begin_panic::<rustc_errors[ece56505557c1b0d]::ExplicitBug>
10: 0x7ff8ab19cda1 - <rustc_errors[ece56505557c1b0d]::diagnostic::BugAbort as rustc_errors[ece56505557c1b0d]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
11: 0x7ff8ab7ea78c - <rustc_errors[ece56505557c1b0d]::DiagCtxtHandle>::span_bug::<rustc_span[2d93c3ee6901fd4d]::span_encoding::Span, alloc[19f73542e5485bc1]::string::String>
12: 0x7ff8ab818856 - rustc_middle[5a5f5798a8f38072]::util::bug::opt_span_bug_fmt::<rustc_span[2d93c3ee6901fd4d]::span_encoding::Span>::{closure#0}
13: 0x7ff8ab818cb2 - rustc_middle[5a5f5798a8f38072]::ty::context::tls::with_opt::<rustc_middle[5a5f5798a8f38072]::util::bug::opt_span_bug_fmt<rustc_span[2d93c3ee6901fd4d]::span_encoding::Span>::{closure#0}, !>::{closure#0}
14: 0x7ff8ab803a40 - rustc_middle[5a5f5798a8f38072]::ty::context::tls::with_context_opt::<rustc_middle[5a5f5798a8f38072]::ty::context::tls::with_opt<rustc_middle[5a5f5798a8f38072]::util::bug::opt_span_bug_fmt<rustc_span[2d93c3ee6901fd4d]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
15: 0x7ff8a95c9fc8 - rustc_middle[5a5f5798a8f38072]::util::bug::span_bug_fmt::<rustc_span[2d93c3ee6901fd4d]::span_encoding::Span>
16: 0x7ff8ad5596f4 - <rustc_middle[5a5f5798a8f38072]::ty::generic_args::GenericArg as rustc_type_ir[e133639d9cb9d719]::relate::Relate<rustc_middle[5a5f5798a8f38072]::ty::context::TyCtxt>>::relate::<rustc_borrowck[fb2d02eb91b19704]::type_check::relate_tys::NllTypeRelating>
17: 0x7ff8ad557184 - <core[9253e626ef1be868]::result::Result<rustc_middle[5a5f5798a8f38072]::ty::generic_args::GenericArg, rustc_type_ir[e133639d9cb9d719]::error::TypeError<rustc_middle[5a5f5798a8f38072]::ty::context::TyCtxt>> as rustc_type_ir[e133639d9cb9d719]::interner::CollectAndApply<rustc_middle[5a5f5798a8f38072]::ty::generic_args::GenericArg, &rustc_middle[5a5f5798a8f38072]::ty::list::RawList<(), rustc_middle[5a5f5798a8f38072]::ty::generic_args::GenericArg>>>::collect_and_apply::<core[9253e626ef1be868]::iter::adapters::map::Map<core[9253e626ef1be868]::iter::adapters::zip::Zip<core[9253e626ef1be868]::iter::adapters::copied::Copied<core[9253e626ef1be868]::slice::iter::Iter<rustc_middle[5a5f5798a8f38072]::ty::generic_args::GenericArg>>, core[9253e626ef1be868]::iter::adapters::copied::Copied<core[9253e626ef1be868]::slice::iter::Iter<rustc_middle[5a5f5798a8f38072]::ty::generic_args::GenericArg>>>, rustc_type_ir[e133639d9cb9d719]::relate::relate_args_invariantly<rustc_middle[5a5f5798a8f38072]::ty::context::TyCtxt, rustc_borrowck[fb2d02eb91b19704]::type_check::relate_tys::NllTypeRelating>::{closure#0}>, <rustc_middle[5a5f5798a8f38072]::ty::context::TyCtxt>::mk_args_from_iter<core[9253e626ef1be868]::iter::adapters::map::Map<core[9253e626ef1be868]::iter::adapters::zip::Zip<core[9253e626ef1be868]::iter::adapters::copied::Copied<core[9253e626ef1be868]::slice::iter::Iter<rustc_middle[5a5f5798a8f38072]::ty::generic_args::GenericArg>>, core[9253e626ef1be868]::iter::adapters::copied::Copied<core[9253e626ef1be868]::slice::iter::Iter<rustc_middle[5a5f5798a8f38072]::ty::generic_args::GenericArg>>>, rustc_type_ir[e133639d9cb9d719]::relate::relate_args_invariantly<rustc_middle[5a5f5798a8f38072]::ty::context::TyCtxt, rustc_borrowck[fb2d02eb91b19704]::type_check::relate_tys::NllTypeRelating>::{closure#0}>, core[9253e626ef1be868]::result::Result<rustc_middle[5a5f5798a8f38072]::ty::generic_args::GenericArg, rustc_type_ir[e133639d9cb9d719]::error::TypeError<rustc_middle[5a5f5798a8f38072]::ty::context::TyCtxt>>>::{closure#0}>
18: 0x7ff8ad562b47 - rustc_type_ir[e133639d9cb9d719]::relate::structurally_relate_tys::<rustc_middle[5a5f5798a8f38072]::ty::context::TyCtxt, rustc_borrowck[fb2d02eb91b19704]::type_check::relate_tys::NllTypeRelating>::{closure#0}
19: 0x7ff8a911d8b3 - rustc_borrowck[fb2d02eb91b19704]::type_check::type_check
20: 0x7ff8add4af75 - rustc_borrowck[fb2d02eb91b19704]::borrowck_collect_region_constraints
21: 0x7ff8add5586a - <rustc_borrowck[fb2d02eb91b19704]::root_cx::BorrowCheckRootCtxt>::do_mir_borrowck
22: 0x7ff8add54704 - rustc_borrowck[fb2d02eb91b19704]::mir_borrowck
23: 0x7ff8add54419 - rustc_query_impl[d5422e89ac02de23]::query_vtables::mir_borrowck::invoke_provider_fn::__rust_begin_short_backtrace
24: 0x7ff8ad0cdc75 - rustc_query_impl[d5422e89ac02de23]::execution::try_execute_query::<rustc_data_structures[1609676847358c32]::vec_cache::VecCache<rustc_span[2d93c3ee6901fd4d]::def_id::LocalDefId, rustc_middle[5a5f5798a8f38072]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[5a5f5798a8f38072]::dep_graph::graph::DepNodeIndex>, false>
25: 0x7ff8ad0cd7e7 - rustc_query_impl[d5422e89ac02de23]::query_vtables::mir_borrowck::execute_query_non_incr::__rust_end_short_backtrace
26: 0x7ff8ad8d52ce - rustc_hir_analysis[a3e24397d7d8df45]::collect::type_of::opaque::find_opaque_ty_constraints_for_rpit
27: 0x7ff8ad8d4faa - rustc_hir_analysis[a3e24397d7d8df45]::collect::type_of::type_of_opaque
28: 0x7ff8aca47c3d - rustc_query_impl[d5422e89ac02de23]::execution::try_execute_query::<rustc_middle[5a5f5798a8f38072]::query::caches::DefIdCache<rustc_middle[5a5f5798a8f38072]::query::erase::ErasedData<[u8; 8usize]>>, false>
29: 0x7ff8adcd072a - rustc_query_impl[d5422e89ac02de23]::query_vtables::type_of_opaque::execute_query_non_incr::__rust_end_short_backtrace
30: 0x7ff8ace23ded - rustc_hir_analysis[a3e24397d7d8df45]::collect::type_of::type_of
31: 0x7ff8ace265a6 - rustc_query_impl[d5422e89ac02de23]::query_vtables::type_of::invoke_provider_fn::__rust_begin_short_backtrace
32: 0x7ff8aca47c3d - rustc_query_impl[d5422e89ac02de23]::execution::try_execute_query::<rustc_middle[5a5f5798a8f38072]::query::caches::DefIdCache<rustc_middle[5a5f5798a8f38072]::query::erase::ErasedData<[u8; 8usize]>>, false>
33: 0x7ff8aca478e3 - rustc_query_impl[d5422e89ac02de23]::query_vtables::type_of::execute_query_non_incr::__rust_end_short_backtrace
34: 0x7ff8ad8d57e8 - rustc_hir_analysis[a3e24397d7d8df45]::check::check::check_opaque
35: 0x7ff8ad7b987b - rustc_hir_analysis[a3e24397d7d8df45]::check::check::check_item_type
36: 0x7ff8ad7b04dc - rustc_hir_analysis[a3e24397d7d8df45]::check::wfcheck::check_well_formed
37: 0x7ff8ad7b049f - rustc_query_impl[d5422e89ac02de23]::query_vtables::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
38: 0x7ff8ad7afafb - rustc_query_impl[d5422e89ac02de23]::execution::try_execute_query::<rustc_data_structures[1609676847358c32]::vec_cache::VecCache<rustc_span[2d93c3ee6901fd4d]::def_id::LocalDefId, rustc_middle[5a5f5798a8f38072]::query::erase::ErasedData<[u8; 1usize]>, rustc_middle[5a5f5798a8f38072]::dep_graph::graph::DepNodeIndex>, false>
39: 0x7ff8ad7af895 - rustc_query_impl[d5422e89ac02de23]::query_vtables::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
40: 0x7ff8ad7a8576 - <rustc_middle[5a5f5798a8f38072]::hir::ModuleItems>::par_opaques::<rustc_hir_analysis[a3e24397d7d8df45]::check::wfcheck::check_type_wf::{closure#5}>
41: 0x7ff8ad7ad0bb - rustc_hir_analysis[a3e24397d7d8df45]::check::wfcheck::check_type_wf
42: 0x7ff8ad7acc27 - rustc_query_impl[d5422e89ac02de23]::query_vtables::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
43: 0x7ff8ada76689 - rustc_query_impl[d5422e89ac02de23]::execution::try_execute_query::<rustc_middle[5a5f5798a8f38072]::query::caches::SingleCache<rustc_middle[5a5f5798a8f38072]::query::erase::ErasedData<[u8; 1usize]>>, false>
44: 0x7ff8ada7642d - rustc_query_impl[d5422e89ac02de23]::query_vtables::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
45: 0x7ff8ad1c711a - rustc_hir_analysis[a3e24397d7d8df45]::check_crate
46: 0x7ff8ad0cf233 - rustc_interface[a9b0b26ac5f97aef]::passes::analysis
47: 0x7ff8ada75dca - rustc_query_impl[d5422e89ac02de23]::execution::try_execute_query::<rustc_middle[5a5f5798a8f38072]::query::caches::SingleCache<rustc_middle[5a5f5798a8f38072]::query::erase::ErasedData<[u8; 0usize]>>, false>
48: 0x7ff8ada75b6b - rustc_query_impl[d5422e89ac02de23]::query_vtables::analysis::execute_query_non_incr::__rust_end_short_backtrace
49: 0x7ff8adce7fad - rustc_interface[a9b0b26ac5f97aef]::interface::run_compiler::<(), rustc_driver_impl[4014d772c3bdc445]::run_compiler::{closure#0}>::{closure#2}
50: 0x7ff8addae664 - std[3528600ba3f9fe66]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[a9b0b26ac5f97aef]::util::run_in_thread_with_globals<rustc_interface[a9b0b26ac5f97aef]::util::run_in_thread_pool_with_globals<rustc_interface[a9b0b26ac5f97aef]::interface::run_compiler<(), rustc_driver_impl[4014d772c3bdc445]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
51: 0x7ff8addae40b - <std[3528600ba3f9fe66]::thread::lifecycle::spawn_unchecked<rustc_interface[a9b0b26ac5f97aef]::util::run_in_thread_with_globals<rustc_interface[a9b0b26ac5f97aef]::util::run_in_thread_pool_with_globals<rustc_interface[a9b0b26ac5f97aef]::interface::run_compiler<(), rustc_driver_impl[4014d772c3bdc445]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[9253e626ef1be868]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
52: 0x7ff8addb77db - <std[3528600ba3f9fe66]::sys::thread::unix::Thread>::new::thread_start
53: 0x7ff8a6c980a2 - <unknown>
54: 0x7ff8a6d2080c - <unknown>
55: 0x0 - <unknown>
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.100.0-nightly (74b3f086e 2026-09-12) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [mir_borrowck] borrow-checking `<impl at /tmp/icemaker_global_tempdir.iQ7cEy1zH8N7/rustc_testrunner_tmpdir_reporting.f4c8fWrUpSCp/mvce.rs:3:1: 3:15>::foo`
#1 [type_of_opaque] computing type of opaque `<impl at /tmp/icemaker_global_tempdir.iQ7cEy1zH8N7/rustc_testrunner_tmpdir_reporting.f4c8fWrUpSCp/mvce.rs:3:1: 3:15>::foo::{opaque#0}`
#2 [type_of] computing type of `<impl at /tmp/icemaker_global_tempdir.iQ7cEy1zH8N7/rustc_testrunner_tmpdir_reporting.f4c8fWrUpSCp/mvce.rs:3:1: 3:15>::foo::{opaque#0}`
#3 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.iQ7cEy1zH8N7/rustc_testrunner_tmpdir_reporting.f4c8fWrUpSCp/mvce.rs:3:1: 3:15>::foo::{opaque#0}` is well-formed
#4 [check_type_wf] checking that types are well-formed
#5 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 10 previous errors
Some errors have detailed explanations: E0601, E0658, E0670.
For more information about an error, try `rustc --explain E0601`.
@rustbot label +F-explicit_tail_calls +F-type_alias_impl_trait +F-async_fn_traits +F-unboxed_closures
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 by compiling the auto-reduced example with the listed nightly rustc command and enabled features, then inspect compiler/rustc_borrowck/src/type_check/relate_tys.rs around line 413. Compare the borrow-checking path reached by the example with the ICE output; done means the reproducer no longer triggers an internal compiler error and reports a normal result.
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
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100