[ICE]: rustc panic at `rustc_middle/src/ty/sty.rs:194:33`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
Code
fn main() {
let x = || -> Box<dyn Future<Output = ()>> { Box::new(async move || {}) };
}
Note that compilation error is expected for this code (async closure is not a future).
Tested on latest stable (1.98.1) - everything works fine, it emits compile time error as it should. Panic occurs on nightly.
Tested on older nightly versions as well - bug was introduced in nightly-2026-09-08
UPD:
Looks like this introduced by the new trait solver - disabling new trait solver via -Znext-solver=coherence fixes the issue.
Meta
rustc --version --verbose:
rustc 1.100.0-nightly (feaadeeac 2026-09-19)
binary: rustc
commit-hash: feaadeeaca7db0594da854e7c8c07495341c7439
commit-date: 2026-09-19
host: x86_64-pc-windows-msvc
release: 1.100.0-nightly
LLVM version: 23.1.1
Error output
Backtrace
error: internal compiler error: /rustc-dev/feaadeeaca7db0594da854e7c8c07495341c7439/compiler/rustc_middle\src\ty\sty.rs:194:33: upvar_tys called before capture types are inferred
thread 'rustc' (31128) panicked at /rustc-dev/feaadeeaca7db0594da854e7c8c07495341c7439/compiler/rustc_middle\src\ty\sty.rs:194:33:
Box<dyn Any>
stack backtrace:
0: 0x7ffd85670319 - std::backtrace_rs::backtrace::win64::trace
at /rustc/feaadeeaca7db0594da854e7c8c07495341c7439/library/std\src\..\..\backtrace\src\backtrace\win64.rs:85
1: 0x7ffd85670319 - std::backtrace_rs::backtrace::trace_unsynchronized
at /rustc/feaadeeaca7db0594da854e7c8c07495341c7439/library/std\src\..\..\backtrace\src\backtrace\mod.rs:66
2: 0x7ffd85670319 - std::sys::backtrace::_print_fmt
at /rustc/feaadeeaca7db0594da854e7c8c07495341c7439/library/std\src\sys\backtrace.rs:74
3: 0x7ffd85670319 - std::sys::backtrace::impl$0::print::impl$0::fmt
at /rustc/feaadeeaca7db0594da854e7c8c07495341c7439/library/std\src\sys\backtrace.rs:44
4: 0x7ffd85699bbe - core::fmt::write
at /rustc/feaadeeaca7db0594da854e7c8c07495341c7439/library/core\src\fmt\mod.rs:0
5: 0x7ffd856807c4 - core::io::write::default_write_fmt
at /rustc/feaadeeaca7db0594da854e7c8c07495341c7439/library/core\src\io\write.rs:402
6: 0x7ffd856807c4 - core::io::write::Write::write_fmt<std::sys::stdio::windows::Stderr>
at /rustc/feaadeeaca7db0594da854e7c8c07495341c7439/library/core\src\io\write.rs:335
7: 0x7ffd85644695 - std::sys::backtrace::BacktraceLock::print
at /rustc/feaadeeaca7db0594da854e7c8c07495341c7439/library/std\src\sys\backtrace.rs:47
8: 0x7ffd85644695 - std::panicking::default_hook::closure$0
at /rustc/feaadeeaca7db0594da854e7c8c07495341c7439/library/std\src\panicking.rs:289
9: 0x7ffd856612b0 - std::panicking::default_hook
at /rustc/feaadeeaca7db0594da854e7c8c07495341c7439/library/std\src\panicking.rs:316
10: 0x7ffd872a8c19 - core[de25a91b06af7729]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[ead30ebc69b0c182]::Level, &str), usize), <((rustc_lint_defs[ead30ebc69b0c182]::Level, &str), usize) as core[de25a91b06af7729]::cmp::PartialOrd>::lt>
11: 0x7ffd856616e4 - std::panicking::panic_with_hook
at /rustc/feaadeeaca7db0594da854e7c8c07495341c7439/library/std\src\panicking.rs:819
12: 0x7ffd89a476d8 - <rustc_stable_hash[43b9a28555947319]::stable_hasher::StableHasher<_> as core[de25a91b06af7729]::hash::Hasher>::write_isize::hash_value::<rustc_stable_hash[43b9a28555947319]::sip128::SipHasher128>
13: 0x7ffd89a457b9 - std[eac520faf95c1c47]::sys::backtrace::__rust_end_short_backtrace::<std[eac520faf95c1c47]::panicking::begin_panic<rustc_span[76f5bd11f6a5d11e]::macros::ExplicitBug>::{closure#0}, !>
14: 0x7ffd89a45793 - std[eac520faf95c1c47]::panicking::begin_panic::<rustc_span[76f5bd11f6a5d11e]::macros::ExplicitBug>
15: 0x7ffd89a51147 - rustc_span[76f5bd11f6a5d11e]::macros::bug_impl
16: 0x7ffd89033a32 - RINvMs6_NtCshSCfhVYEcPH_9hashbrown3rawINtB6_8RawTableTTNtNtCsaddGV02oI3i_10rustc_span6def_id5DefIdNtNtCs2whAstjhQcO_5alloc6string6StringEuEE14reserve_rehashNCINvNtB8_3map11make_hasherBQ_uNtCs3CnsjtvLjPA_10rustc_hash13FxBuildHasherE0ECs2hQt6sr7kH4_21rustc_t
17: 0x7ffd8904e9b8 - RINvMs6_NtCshSCfhVYEcPH_9hashbrown3rawINtB6_8RawTableTTNtNtCsaddGV02oI3i_10rustc_span6def_id5DefIdNtNtCs2whAstjhQcO_5alloc6string6StringEuEE14reserve_rehashNCINvNtB8_3map11make_hasherBQ_uNtCs3CnsjtvLjPA_10rustc_hash13FxBuildHasherE0ECs2hQt6sr7kH4_21rustc_t
18: 0x7ffd89033c0e - RINvMs6_NtCshSCfhVYEcPH_9hashbrown3rawINtB6_8RawTableTTNtNtCsaddGV02oI3i_10rustc_span6def_id5DefIdNtNtCs2whAstjhQcO_5alloc6string6StringEuEE14reserve_rehashNCINvNtB8_3map11make_hasherBQ_uNtCs3CnsjtvLjPA_10rustc_hash13FxBuildHasherE0ECs2hQt6sr7kH4_21rustc_t
19: 0x7ffd891793ab - <rustc_trait_selection[1aa5de6e78645eb8]::error_reporting::TypeErrCtxt>::note_obligation_cause
20: 0x7ffd8915d0de - <rustc_trait_selection[1aa5de6e78645eb8]::error_reporting::TypeErrCtxt>::report_selection_error
21: 0x7ffd89190676 - <rustc_arena[acb8355769af7f65]::TypedArena<rustc_middle[86d32e236897f4ff]::traits::specialization_graph::Graph>>::grow
22: 0x7ffd89195464 - <rustc_trait_selection[1aa5de6e78645eb8]::error_reporting::TypeErrCtxt>::report_fulfillment_errors
23: 0x7ffd8589780c - rustc_traits[d245bae7249f1880]::type_op::type_op_ascribe_user_type
24: 0x7ffd8593e010 - rustc_hir_typeck[ef4501f8f36b0c59]::used_trait_imports
25: 0x7ffd859b4532 - rustc_hir_typeck[ef4501f8f36b0c59]::used_trait_imports
26: 0x7ffd859b77a6 - rustc_hir_typeck[ef4501f8f36b0c59]::used_trait_imports
27: 0x7ffd8593e63a - rustc_hir_typeck[ef4501f8f36b0c59]::used_trait_imports
28: 0x7ffd85a7a032 - rustc_hir_typeck[ef4501f8f36b0c59]::intrinsicck::check_transmutes
29: 0x7ffd858f7662 - <hashbrown[d04525962ceca2d7]::raw::RawTable<((rustc_span[76f5bd11f6a5d11e]::def_id::DefId, bool), ())>>::reserve_rehash::<hashbrown[d04525962ceca2d7]::map::make_hasher<(rustc_span[76f5bd11f6a5d11e]::def_id::DefId, bool), (), rustc_hash[2a271d828d87dd64]::FxBuildHasher>::{closure#0}>
30: 0x7ffd8590cf50 - rustc_hir_typeck[ef4501f8f36b0c59]::typeck_root
31: 0x7ffd86794fbb - rustc_query_impl[4a28a2716e294434]::query_system
32: 0x7ffd86682d8a - RINvMs6_NtCshSCfhVYEcPH_9hashbrown3rawINtB6_8RawTableTNtCs2wAFgyskIxl_12rustc_hir_id11ItemLocalIdINtNtCsj4tZXWyL2D5_4core6result6ResultTNtNtCs85RmqjExrHx_9rustc_hir3def7DefKindNtNtCsaddGV02oI3i_10rustc_span6def_id5DefIdENtB2S_15ErrorGuaranteedEEE14reserve_
33: 0x7ffd86794e93 - rustc_query_impl[4a28a2716e294434]::query_system
34: 0x7ffd85afefb9 - rustc_hir_analysis[ccd5d03ad0caa7a4]::check_crate
35: 0x7ffd856c8cdf - rustc_interface[9d77f9d77fcc0fc1]::passes::analysis
36: 0x7ffd851555aa - rustc_query_impl[4a28a2716e294434]::self_profile::alloc_self_profile_query_strings
37: 0x7ffd8504214f - <rustc_privacy[6d76b81509e90e9b]::DefIdsToImplsCollector as rustc_privacy[6d76b81509e90e9b]::DefIdVisitor>::visit_def_id
38: 0x7ffd8515555f - rustc_query_impl[4a28a2716e294434]::self_profile::alloc_self_profile_query_strings
39: 0x7ffd81d6e6f7 - std[eac520faf95c1c47]::sys::backtrace::__rust_begin_short_backtrace::<std[eac520faf95c1c47]::thread::lifecycle::spawn_unchecked<ctrlc[e4d134d4f7dcf38e]::set_handler_inner<rustc_driver_impl[8f96b84ca9b8ea5b]::install_ctrlc_handler::{closure#0}>::{closure#0}, !>::{closure#1}::{closure#0}::{closure#0}, ()>
40: 0x7ffd81d68165 - RINvNtNtCsk9FSb5r6j5z_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCsdwcwkYvrG6b_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCsckjOkAi6t61_17rustc_driver_i
41: 0x7ffd81d73867 - std[eac520faf95c1c47]::sys::backtrace::__rust_begin_short_backtrace::<std[eac520faf95c1c47]::thread::lifecycle::spawn_unchecked<ctrlc[e4d134d4f7dcf38e]::set_handler_inner<rustc_driver_impl[8f96b84ca9b8ea5b]::install_ctrlc_handler::{closure#0}>::{closure#0}, !>::{closure#1}::{closure#0}::{closure#0}, ()>
42: 0x7ffd8566d0c7 - std::sys::thread::windows::impl$0::new::thread_start
at /rustc/feaadeeaca7db0594da854e7c8c07495341c7439/library/std\src\sys\thread\windows.rs:58
43: 0x7ffe8d24cd87 - BaseThreadInitThunk
44: 0x7ffe8e44caec - RtlUserThreadStart
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 reproducing the supplied async-closure example with the reported nightly compiler and compare it with stable, where a compile-time error is expected. Inspect the panic at compiler/rustc_middle/src/ty/sty.rs:194:33 and trace the capture-type inference path involved. Done means the example reports a normal compilation error rather than 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
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100