Skip to content

ICE upvar_tys called before capture types are inferred #162440

Closed

Description

@matthiaskrgr

snippet:

fn main() {
    Some([0]).map(|s| s[..]);
}

Version information

rustc 1.100.0-nightly (752b9bf87 2026-09-07)
binary: rustc
commit-hash: 752b9bf8798c2ffc1d3fe2b804c04454366fc6d6
commit-date: 2026-09-07
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.1

Possibly related line of code:

UpvarArgs::CoroutineClosure(args) => args.as_coroutine_closure().tupled_upvars_ty(),
};
match tupled_tys.kind() {
TyKind::Error(_) => ty::List::empty(),
TyKind::Tuple(..) => self.tupled_upvars_ty().tuple_fields(),
TyKind::Infer(_) => bug!("upvar_tys called before capture types are inferred"),
ty => bug!("Unexpected representation of upvar types tuple {:?}", ty),
}
}
#[inline]
pub fn tupled_upvars_ty(self) -> Ty<'tcx> {

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time
    --> /tmp/icemaker_global_tempdir.y4oxhmSBkaRU/rustc_testrunner_tmpdir_reporting.4aRXUhCYUxEe/mvce.rs:2:15
     |
   2 |     Some([0]).map(|s| s[..]);
     |               ^^^ doesn't have a size known at compile-time
     |
     = help: the trait `Sized` is not implemented for `[{integer}]`
note: required by an implicit `Sized` bound in `Option::<T>::map`
    --> /home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/core/src/option.rs:1160:22
     |
1160 |     pub const fn map<U, F>(self, f: F) -> Option<U>
     |                      ^ required by the implicit `Sized` requirement on this type parameter in `Option::<T>::map`

error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time
 --> /tmp/icemaker_global_tempdir.y4oxhmSBkaRU/rustc_testrunner_tmpdir_reporting.4aRXUhCYUxEe/mvce.rs:2:23
  |
2 |     Some([0]).map(|s| s[..]);
  |                       ^^^^^ doesn't have a size known at compile-time
  |
  = help: the trait `Sized` is not implemented for `[{integer}]`
  = note: the return type of a function must have a statically known size

error: internal compiler error: /rustc-dev/752b9bf8798c2ffc1d3fe2b804c04454366fc6d6/compiler/rustc_middle/src/ty/sty.rs:200:33: upvar_tys called before capture types are inferred


thread 'rustc' (2995014) panicked at /rustc-dev/752b9bf8798c2ffc1d3fe2b804c04454366fc6d6/compiler/rustc_middle/src/ty/sty.rs:200:33:
Box<dyn Any>
stack backtrace:
   0:     0x7f6b7ead5b46 - <<std[7799338267317a1]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[feb819e0aab98535]::fmt::Display>::fmt
   1:     0x7f6b7f2081cf - core[feb819e0aab98535]::fmt::write
   2:     0x7f6b7eaeac0c - <std[7799338267317a1]::sys::stdio::unix::Stderr as core[feb819e0aab98535]::io::write::Write>::write_fmt
   3:     0x7f6b7eaa83ea - std[7799338267317a1]::panicking::default_hook::{closure#0}
   4:     0x7f6b7eac9e43 - std[7799338267317a1]::panicking::default_hook
   5:     0x7f6b7da1338f - std[7799338267317a1]::panicking::update_hook::<alloc[eddc929262330b86]::boxed::Box<rustc_driver_impl[93e22c4ae85d6128]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f6b7eaca2e2 - std[7799338267317a1]::panicking::panic_with_hook
   7:     0x7f6b7da41c44 - std[7799338267317a1]::panicking::begin_panic::<rustc_errors[ccb98f0a5bff281a]::ExplicitBug>::{closure#0}
   8:     0x7f6b7da3a71e - std[7799338267317a1]::sys::backtrace::__rust_end_short_backtrace::<std[7799338267317a1]::panicking::begin_panic<rustc_errors[ccb98f0a5bff281a]::ExplicitBug>::{closure#0}, !>
   9:     0x7f6b7da387be - std[7799338267317a1]::panicking::begin_panic::<rustc_errors[ccb98f0a5bff281a]::ExplicitBug>
  10:     0x7f6b7da4d511 - <rustc_errors[ccb98f0a5bff281a]::diagnostic::BugAbort as rustc_errors[ccb98f0a5bff281a]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7f6b7dff4cb9 - rustc_middle[95f7c36db503aa5c]::util::bug::opt_span_bug_fmt::<rustc_span[aab65db9cf037f3]::span_encoding::Span>::{closure#0}
  12:     0x7f6b7dff50f2 - rustc_middle[95f7c36db503aa5c]::ty::context::tls::with_opt::<rustc_middle[95f7c36db503aa5c]::util::bug::opt_span_bug_fmt<rustc_span[aab65db9cf037f3]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  13:     0x7f6b7dfdfeb0 - rustc_middle[95f7c36db503aa5c]::ty::context::tls::with_context_opt::<rustc_middle[95f7c36db503aa5c]::ty::context::tls::with_opt<rustc_middle[95f7c36db503aa5c]::util::bug::opt_span_bug_fmt<rustc_span[aab65db9cf037f3]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  14:     0x7f6b7aca83d4 - rustc_middle[95f7c36db503aa5c]::util::bug::bug_fmt
  15:     0x7f6b7e7e4b70 - <rustc_trait_selection[b2c49a93e168dccb]::error_reporting::TypeErrCtxt>::note_closure_capture::<rustc_span[aab65db9cf037f3]::ErrorGuaranteed>
  16:     0x7f6b7e7f9e1f - <rustc_trait_selection[b2c49a93e168dccb]::error_reporting::TypeErrCtxt>::note_obligation_cause_code_inner::<rustc_span[aab65db9cf037f3]::ErrorGuaranteed, rustc_middle[95f7c36db503aa5c]::ty::predicate::Predicate>
  17:     0x7f6b7e7e4c36 - <rustc_trait_selection[b2c49a93e168dccb]::error_reporting::TypeErrCtxt>::note_obligation_cause_code::<rustc_span[aab65db9cf037f3]::ErrorGuaranteed, rustc_middle[95f7c36db503aa5c]::ty::predicate::Predicate>
  18:     0x7f6b7e8f1d1c - <rustc_trait_selection[b2c49a93e168dccb]::error_reporting::TypeErrCtxt>::note_obligation_cause
  19:     0x7f6b7e8de797 - <rustc_trait_selection[b2c49a93e168dccb]::error_reporting::TypeErrCtxt>::report_selection_error
  20:     0x7f6b7e905fc9 - <rustc_trait_selection[b2c49a93e168dccb]::error_reporting::TypeErrCtxt>::report_fulfillment_error
  21:     0x7f6b7d298d3c - <rustc_trait_selection[b2c49a93e168dccb]::error_reporting::TypeErrCtxt>::report_fulfillment_errors
  22:     0x7f6b7f2f3426 - <rustc_hir_typeck[74465e21f53f1374]::fn_ctxt::FnCtxt>::resolve_vars_with_obligations::<rustc_middle[95f7c36db503aa5c]::ty::Ty>
  23:     0x7f6b7fd33cde - <rustc_hir_typeck[74465e21f53f1374]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  24:     0x7f6b7fd28105 - <rustc_hir_typeck[74465e21f53f1374]::fn_ctxt::FnCtxt>::check_expr_block
  25:     0x7f6b7fd2f155 - <rustc_hir_typeck[74465e21f53f1374]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  26:     0x7f6b7fd13258 - rustc_hir_typeck[74465e21f53f1374]::check::check_fn
  27:     0x7f6b8067a55b - rustc_hir_typeck[74465e21f53f1374]::typeck_with_inspect::{closure#0}
  28:     0x7f6b80678b7a - rustc_query_impl[bdd1a1285068393]::query_vtables::typeck_root::invoke_provider_fn::__rust_begin_short_backtrace
  29:     0x7f6b7f879535 - rustc_query_impl[bdd1a1285068393]::execution::try_execute_query::<rustc_data_structures[b3e0016b95cb4620]::vec_cache::VecCache<rustc_span[aab65db9cf037f3]::def_id::LocalDefId, rustc_middle[95f7c36db503aa5c]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[95f7c36db503aa5c]::dep_graph::graph::DepNodeIndex>, false>
  30:     0x7f6b7f879167 - rustc_query_impl[bdd1a1285068393]::query_vtables::typeck_root::execute_query_non_incr::__rust_end_short_backtrace
  31:     0x7f6b7f93566f - <rustc_middle[95f7c36db503aa5c]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[3f6e10ab2280337c]::check_crate::{closure#1}>::{closure#0}
  32:     0x7f6b7f93492e - rustc_hir_analysis[3f6e10ab2280337c]::check_crate
  33:     0x7f6b7f87aaf3 - rustc_interface[1845d939591a8dca]::passes::analysis
  34:     0x7f6b8049d7ca - rustc_query_impl[bdd1a1285068393]::execution::try_execute_query::<rustc_middle[95f7c36db503aa5c]::query::caches::SingleCache<rustc_middle[95f7c36db503aa5c]::query::erase::ErasedData<[u8; 0usize]>>, false>
  35:     0x7f6b8049d56b - rustc_query_impl[bdd1a1285068393]::query_vtables::analysis::execute_query_non_incr::__rust_end_short_backtrace
  36:     0x7f6b8054bb4c - rustc_interface[1845d939591a8dca]::interface::run_compiler::<(), rustc_driver_impl[93e22c4ae85d6128]::run_compiler::{closure#0}>::{closure#2}
  37:     0x7f6b80628f42 - std[7799338267317a1]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[1845d939591a8dca]::util::run_in_thread_with_globals<rustc_interface[1845d939591a8dca]::util::run_in_thread_pool_with_globals<rustc_interface[1845d939591a8dca]::interface::run_compiler<(), rustc_driver_impl[93e22c4ae85d6128]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  38:     0x7f6b80628ced - <std[7799338267317a1]::thread::lifecycle::spawn_unchecked<rustc_interface[1845d939591a8dca]::util::run_in_thread_with_globals<rustc_interface[1845d939591a8dca]::util::run_in_thread_pool_with_globals<rustc_interface[1845d939591a8dca]::interface::run_compiler<(), rustc_driver_impl[93e22c4ae85d6128]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[feb819e0aab98535]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  39:     0x7f6b80631607 - <std[7799338267317a1]::sys::thread::unix::Thread>::new::thread_start
  40:     0x7f6b796980a2 - <unknown>
  41:     0x7f6b7972080c - <unknown>
  42:                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 (752b9bf87 2026-09-07) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck_root] type-checking `main`
#1 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0277`.

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Sep 7, 2026
  2. matthiaskrgr commented on Sep 7, 2026

    @matthiaskrgr
    MemberAuthor

    yesterday:

    
    error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time
        --> a.rs:2:15
         |
       2 |     Some([0]).map(|s| s[..]);
         |               ^^^ doesn't have a size known at compile-time
         |
         = help: the trait `Sized` is not implemented for `[{integer}]`
    note: required by an implicit `Sized` bound in `Option::<T>::map`
        --> /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:1160:22
         |
    1160 |     pub const fn map<U, F>(self, f: F) -> Option<U>
         |                      ^ required by the implicit `Sized` requirement on this type parameter in `Option::<T>::map`
    
    error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time
     --> a.rs:2:23
      |
    2 |     Some([0]).map(|s| s[..]);
      |                       ^^^^^ doesn't have a size known at compile-time
      |
      = help: the trait `Sized` is not implemented for `[{integer}]`
      = note: the return type of a function must have a statically known size
    
    error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time
        --> a.rs:2:19
         |
       2 |     Some([0]).map(|s| s[..]);
         |               --- ---^^^^^^
         |               |   |
         |               |   doesn't have a size known at compile-time
         |               |   within this `{closure@a.rs:2:19: 2:22}`
         |               required by a bound introduced by this call
         |
         = help: within `{closure@a.rs:2:19: 2:22}`, the trait `Sized` is not implemented for `[{integer}]`
    note: required because it's used within this closure
        --> a.rs:2:19
         |
       2 |     Some([0]).map(|s| s[..]);
         |                   ^^^
    note: required by a bound in `Option::<T>::map`
        --> /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:1162:12
         |
    1160 |     pub const fn map<U, F>(self, f: F) -> Option<U>
         |                  --- required by a bound in this associated function
    1161 |     where
    1162 |         F: [const] FnOnce(T) -> U + [const] Destruct,
         |            ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Option::<T>::map`
    
    error: aborting due to 3 previous errors
    
    For more information about this error, try `rustc --explain E0277`.
    

    today:

    error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time
        --> a.rs:2:15
         |
       2 |     Some([0]).map(|s| s[..]);
         |               ^^^ doesn't have a size known at compile-time
         |
         = help: the trait `Sized` is not implemented for `[{integer}]`
    note: required by an implicit `Sized` bound in `Option::<T>::map`
        --> /home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/core/src/option.rs:1160:22
         |
    1160 |     pub const fn map<U, F>(self, f: F) -> Option<U>
         |                      ^ required by the implicit `Sized` requirement on this type parameter in `Option::<T>::map`
    
    error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time
     --> a.rs:2:23
      |
    2 |     Some([0]).map(|s| s[..]);
      |                       ^^^^^ doesn't have a size known at compile-time
      |
      = help: the trait `Sized` is not implemented for `[{integer}]`
      = note: the return type of a function must have a statically known size
    
    error: internal compiler error: /rustc-dev/752b9bf8798c2ffc1d3fe2b804c04454366fc6d6/compiler/rustc_middle/src/ty/sty.rs:200:33: upvar_tys called before capture types are inferred
    
    
    thread 'rustc' (2995917) panicked at /rustc-dev/752b9bf8798c2ffc1d3fe2b804c04454366fc6d6/compiler/rustc_middle/src/ty/sty.rs:200:33:
    Box<dyn Any>
    stack backtrace:
       0:     0x7fd8440d5b46 - <<std[7799338267317a1]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[feb819e0aab98535]::fmt::Display>::fmt
       1:     0x7fd8448081cf - core[feb819e0aab98535]::fmt::write
       2:     0x7fd8440eac0c - <std[7799338267317a1]::sys::stdio::unix::Stderr as core[feb819e0aab98535]::io::write::Write>::write_fmt
       3:     0x7fd8440a83ea - std[7799338267317a1]::panicking::default_hook::{closure#0}
       4:     0x7fd8440c9e43 - std[7799338267317a1]::panicking::default_hook
       5:     0x7fd84301338f - std[7799338267317a1]::panicking::update_hook::<alloc[eddc929262330b86]::boxed::Box<rustc_driver_impl[93e22c4ae85d6128]::install_ice_hook::{closure#1}>>::{closure#0}
       6:     0x7fd8440ca2e2 - std[7799338267317a1]::panicking::panic_with_hook
       7:     0x7fd843041c44 - std[7799338267317a1]::panicking::begin_panic::<rustc_errors[ccb98f0a5bff281a]::ExplicitBug>::{closure#0}
       8:     0x7fd84303a71e - std[7799338267317a1]::sys::backtrace::__rust_end_short_backtrace::<std[7799338267317a1]::panicking::begin_panic<rustc_errors[ccb98f0a5bff281a]::ExplicitBug>::{closure#0}, !>
       9:     0x7fd8430387be - std[7799338267317a1]::panicking::begin_panic::<rustc_errors[ccb98f0a5bff281a]::ExplicitBug>
      10:     0x7fd84304d511 - <rustc_errors[ccb98f0a5bff281a]::diagnostic::BugAbort as rustc_errors[ccb98f0a5bff281a]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
      11:     0x7fd8435f4cb9 - rustc_middle[95f7c36db503aa5c]::util::bug::opt_span_bug_fmt::<rustc_span[aab65db9cf037f3]::span_encoding::Span>::{closure#0}
      12:     0x7fd8435f50f2 - rustc_middle[95f7c36db503aa5c]::ty::context::tls::with_opt::<rustc_middle[95f7c36db503aa5c]::util::bug::opt_span_bug_fmt<rustc_span[aab65db9cf037f3]::span_encoding::Span>::{closure#0}, !>::{closure#0}
      13:     0x7fd8435dfeb0 - rustc_middle[95f7c36db503aa5c]::ty::context::tls::with_context_opt::<rustc_middle[95f7c36db503aa5c]::ty::context::tls::with_opt<rustc_middle[95f7c36db503aa5c]::util::bug::opt_span_bug_fmt<rustc_span[aab65db9cf037f3]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
      14:     0x7fd8402a83d4 - rustc_middle[95f7c36db503aa5c]::util::bug::bug_fmt
      15:     0x7fd843de4b70 - <rustc_trait_selection[b2c49a93e168dccb]::error_reporting::TypeErrCtxt>::note_closure_capture::<rustc_span[aab65db9cf037f3]::ErrorGuaranteed>
      16:     0x7fd843df9e1f - <rustc_trait_selection[b2c49a93e168dccb]::error_reporting::TypeErrCtxt>::note_obligation_cause_code_inner::<rustc_span[aab65db9cf037f3]::ErrorGuaranteed, rustc_middle[95f7c36db503aa5c]::ty::predicate::Predicate>
      17:     0x7fd843de4c36 - <rustc_trait_selection[b2c49a93e168dccb]::error_reporting::TypeErrCtxt>::note_obligation_cause_code::<rustc_span[aab65db9cf037f3]::ErrorGuaranteed, rustc_middle[95f7c36db503aa5c]::ty::predicate::Predicate>
      18:     0x7fd843ef1d1c - <rustc_trait_selection[b2c49a93e168dccb]::error_reporting::TypeErrCtxt>::note_obligation_cause
      19:     0x7fd843ede797 - <rustc_trait_selection[b2c49a93e168dccb]::error_reporting::TypeErrCtxt>::report_selection_error
      20:     0x7fd843f05fc9 - <rustc_trait_selection[b2c49a93e168dccb]::error_reporting::TypeErrCtxt>::report_fulfillment_error
      21:     0x7fd842898d3c - <rustc_trait_selection[b2c49a93e168dccb]::error_reporting::TypeErrCtxt>::report_fulfillment_errors
      22:     0x7fd8448f3426 - <rustc_hir_typeck[74465e21f53f1374]::fn_ctxt::FnCtxt>::resolve_vars_with_obligations::<rustc_middle[95f7c36db503aa5c]::ty::Ty>
      23:     0x7fd845333cde - <rustc_hir_typeck[74465e21f53f1374]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
      24:     0x7fd845328105 - <rustc_hir_typeck[74465e21f53f1374]::fn_ctxt::FnCtxt>::check_expr_block
      25:     0x7fd84532f155 - <rustc_hir_typeck[74465e21f53f1374]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
      26:     0x7fd845313258 - rustc_hir_typeck[74465e21f53f1374]::check::check_fn
      27:     0x7fd845c7a55b - rustc_hir_typeck[74465e21f53f1374]::typeck_with_inspect::{closure#0}
      28:     0x7fd845c78b7a - rustc_query_impl[bdd1a1285068393]::query_vtables::typeck_root::invoke_provider_fn::__rust_begin_short_backtrace
      29:     0x7fd844e79535 - rustc_query_impl[bdd1a1285068393]::execution::try_execute_query::<rustc_data_structures[b3e0016b95cb4620]::vec_cache::VecCache<rustc_span[aab65db9cf037f3]::def_id::LocalDefId, rustc_middle[95f7c36db503aa5c]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[95f7c36db503aa5c]::dep_graph::graph::DepNodeIndex>, false>
      30:     0x7fd844e79167 - rustc_query_impl[bdd1a1285068393]::query_vtables::typeck_root::execute_query_non_incr::__rust_end_short_backtrace
      31:     0x7fd844f3566f - <rustc_middle[95f7c36db503aa5c]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[3f6e10ab2280337c]::check_crate::{closure#1}>::{closure#0}
      32:     0x7fd844f3492e - rustc_hir_analysis[3f6e10ab2280337c]::check_crate
      33:     0x7fd844e7aaf3 - rustc_interface[1845d939591a8dca]::passes::analysis
      34:     0x7fd845a9d7ca - rustc_query_impl[bdd1a1285068393]::execution::try_execute_query::<rustc_middle[95f7c36db503aa5c]::query::caches::SingleCache<rustc_middle[95f7c36db503aa5c]::query::erase::ErasedData<[u8; 0usize]>>, false>
      35:     0x7fd845a9d56b - rustc_query_impl[bdd1a1285068393]::query_vtables::analysis::execute_query_non_incr::__rust_end_short_backtrace
      36:     0x7fd845b4bb4c - rustc_interface[1845d939591a8dca]::interface::run_compiler::<(), rustc_driver_impl[93e22c4ae85d6128]::run_compiler::{closure#0}>::{closure#2}
      37:     0x7fd845c28f42 - std[7799338267317a1]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[1845d939591a8dca]::util::run_in_thread_with_globals<rustc_interface[1845d939591a8dca]::util::run_in_thread_pool_with_globals<rustc_interface[1845d939591a8dca]::interface::run_compiler<(), rustc_driver_impl[93e22c4ae85d6128]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
      38:     0x7fd845c28ced - <std[7799338267317a1]::thread::lifecycle::spawn_unchecked<rustc_interface[1845d939591a8dca]::util::run_in_thread_with_globals<rustc_interface[1845d939591a8dca]::util::run_in_thread_pool_with_globals<rustc_interface[1845d939591a8dca]::interface::run_compiler<(), rustc_driver_impl[93e22c4ae85d6128]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[feb819e0aab98535]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
      39:     0x7fd845c31607 - <std[7799338267317a1]::sys::thread::unix::Thread>::new::thread_start
      40:     0x7fd83ec980a2 - <unknown>
      41:     0x7fd83ed2080c - <unknown>
      42:                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: please attach the file at `/tmp/upvar/rustc-ice-2026-09-07T17_23_13-2995915.txt` to your bug report
    
    note: rustc 1.100.0-nightly (752b9bf87 2026-09-07) running on x86_64-unknown-linux-gnu
    
    query stack during panic:
    #0 [typeck_root] type-checking `main`
    #1 [analysis] running analysis passes on crate `a`
    end of query stack
    error: aborting due to 3 previous errors
    
    For more information about this error, try `rustc --explain E0277`.
    

    my guess would be its related to #161624

  3. added
    A-diagnosticsArea: Messages for errors, warnings, and lints
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    regression-untriagedUntriaged performance or correctness regression.
    on Sep 7, 2026
  4. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Sep 7, 2026
  5. added
    WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)
    and removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Sep 8, 2026
  6. matthiaskrgr commented on Sep 8, 2026

    @matthiaskrgr
    MemberAuthor

    Ooh its a next-solver thing! >.<
    I was wondering how this could have passed in our testsuite without ICEing but we use coherence there :/

  7. added 2 commits that reference this issue on Sep 8, 2026
  8. added a commit that references this issue on Sep 9, 2026
  9. BuilderEd commented on Sep 19, 2026

    @BuilderEd

    Another reproducer for this ICE, found by an automated compiler-testing
    campaign; sharing in case it is a useful extra test case for #162595.

    pub trait Sieve {
        fn strain(&self, xs: &[u64], f: &dyn Fn(&u64) -> u64) -> &u64;
        def_sieve!();
    }
    macro_rules! def_sieve {
        () => {
            fn sift(&self, xs: &[u64]) -> u64 {
                let a = self.strain(xs, &|v: u64| v.wrapping_mul(127));
                0
            }
        };
    }
    use def_sieve;
    pub struct Pan(pub Vec<u64>);
    impl Sieve for Pan {
        fn strain(&self, xs: &[u64], f: &dyn Fn(&u64) -> u64) -> &u64 {
            &self.0[0]
        }
    }
    pub fn temper_fold(t: (u64, Option<u16>, Result<u32, u16>, &[u64])) -> u64 {
        match t {
            (a, None, Err(_), [x, ..]) => x,
            (a, None | Some(_), Ok(_) | Err(_), rest @ ..) if rest.len() == 0 => 5,
            _ => 0,
        }
    }

    Expected: the two pattern errors (rest @ is not allowed in a tuple,
    .. patterns are not allowed here) and a clean rejection. Actual: additionally

    error: internal compiler error: compiler/rustc_middle/src/ty/sty.rs:194:33:
    upvar_tys called before capture types are inferred
    

    with the same backtrace path as the original report
    (note_closure_capture -> note_obligation_cause_code_inner ->
    report_selection_error -> report_fulfillment_errors).

    Versions tested:

    • nightly-2026-09-07 (5a2be9f): this input is rejected cleanly (E0277
      CoerceUnsized errors on the closures, no ICE). I did not test the
      issue-body snippet on this toolchain; it is reported against a master
      build of the same date (752b9bf)
    • nightly-2026-09-12 (0fc1413): ICE
    • nightly-2026-09-18 (420ed2a): ICE (newest nightly I tested)

    The reproducer combines two ingredients: a closure coerced to &dyn Fn
    inside a macro-generated trait method, and the invalid tuple pattern
    elsewhere in the crate. I did not isolate which ingredient drives error
    reporting into note_closure_capture before capture types are inferred
    (the issue-body snippet ICEs without any pattern error, so the closure
    error path may be the driver here too). Happy to file this as a separate
    issue if the trigger turns out to be distinct.

  10. RashingPro commented on Sep 21, 2026

    @RashingPro

    #163072 contains another code snippet triggering this, just in case

  11. added a commit that references this issue on Sep 24, 2026
    be3bb9f
  12. added a commit that references this issue on Sep 24, 2026
    7b9efef
  13. added a commit that references this issue on Sep 25, 2026
    eb3e475
  14. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Sep 27, 2026
  15. added a commit that references this issue on Sep 30, 2026
    27546fb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)regression-untriagedUntriaged performance or correctness regression.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions