Skip to content

[ICE]: None in tupled_args_count.unwrap().try_into().unwrap() #158482

Description

@matthiaskrgr

original:

#![feature(splat)]
struct Foo {}
trait BarTrait {
    fn trait_assoc<W>(w: W, #[splat] _s: (u32, u8));
}
impl BarTrait for Foo {
    fn trait_assoc<W>(_w: W, #[splat] _s: (u32, u8)) {}
}
fn main() {
    Foo::trait_assoc()
}

Version information

rustc 1.98.0-nightly (267c4057b 2026-06-27)
binary: rustc
commit-hash: 267c4057bad01b0cf9733081d170c1358b4b3674
commit-date: 2026-06-27
host: x86_64-unknown-linux-gnu
release: 1.98.0-nightly
LLVM version: 22.1.8

Possibly related line of code:

self.write_splatted_call(
call_expr.hir_id,
call_span,
fn_def_id,
callee_generic_args,
first_tupled_arg_index.try_into().unwrap(),
tupled_args_count.unwrap().try_into().unwrap(),
);
}
formal_input_tys.splice(
first_tupled_arg_index..=first_tupled_arg_index,
detup_formal_arg_tys.iter(),

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

Program output

warning: the feature `splat` is incomplete and may not be safe to use and/or cause compiler crashes
 --> a.rs:1:12
  |
1 | #![feature(splat)]
  |            ^^^^^
  |
  = note: see issue #153629 <https://github.com/rust-lang/rust/issues/153629> for more information
  = note: `#[warn(incomplete_features)]` on by default


thread 'rustc' (589728) panicked at /rustc-dev/267c4057bad01b0cf9733081d170c1358b4b3674/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:714:39:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7f73450e0dd9 - <<std[5adfb42b05986d41]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[6c0acdb6a595595b]::fmt::Display>::fmt
   1:     0x7f734580f088 - core[6c0acdb6a595595b]::fmt::write
   2:     0x7f73450f7446 - <std[5adfb42b05986d41]::sys::stdio::unix::Stderr as std[5adfb42b05986d41]::io::Write>::write_fmt
   3:     0x7f73450b5f3e - std[5adfb42b05986d41]::panicking::default_hook::{closure#0}
   4:     0x7f73450d3953 - std[5adfb42b05986d41]::panicking::default_hook
   5:     0x7f73440ca981 - std[5adfb42b05986d41]::panicking::update_hook::<alloc[fbe4c4dcc7b8aa88]::boxed::Box<rustc_driver_impl[42758a1aa22d3683]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f73450d3da2 - std[5adfb42b05986d41]::panicking::panic_with_hook
   7:     0x7f73450b6034 - std[5adfb42b05986d41]::panicking::panic_handler::{closure#0}
   8:     0x7f73450aa4e9 - std[5adfb42b05986d41]::sys::backtrace::__rust_end_short_backtrace::<std[5adfb42b05986d41]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f73450b7a6d - __rustc[df92bba9bf60c803]::rust_begin_unwind
  10:     0x7f73421ab95c - core[6c0acdb6a595595b]::panicking::panic_fmt
  11:     0x7f73427902b2 - core[6c0acdb6a595595b]::panicking::panic
  12:     0x7f734224a9d9 - core[6c0acdb6a595595b]::option::unwrap_failed
  13:     0x7f7345b6359d - <rustc_hir_typeck[e5edbe439b2e5bca]::fn_ctxt::FnCtxt>::check_expr_call
  14:     0x7f7345b33ad1 - <rustc_hir_typeck[e5edbe439b2e5bca]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  15:     0x7f7345b06da3 - <rustc_hir_typeck[e5edbe439b2e5bca]::fn_ctxt::FnCtxt>::check_expr_block
  16:     0x7f7345b33aab - <rustc_hir_typeck[e5edbe439b2e5bca]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  17:     0x7f7345aee819 - rustc_hir_typeck[e5edbe439b2e5bca]::check::check_fn
  18:     0x7f73469b469c - rustc_hir_typeck[e5edbe439b2e5bca]::typeck_with_inspect::{closure#0}
  19:     0x7f73469b3030 - rustc_query_impl[3556ad9cd89326b4]::query_impl::typeck_root::invoke_provider_fn::__rust_begin_short_backtrace
  20:     0x7f7345bf4f69 - rustc_query_impl[3556ad9cd89326b4]::execution::try_execute_query::<rustc_data_structures[638d5ab76b52e7de]::vec_cache::VecCache<rustc_span[70c9d822d1c56b66]::def_id::LocalDefId, rustc_middle[609d1ad3d24e1e94]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[609d1ad3d24e1e94]::dep_graph::graph::DepNodeIndex>, false>
  21:     0x7f7345bf49c3 - rustc_query_impl[3556ad9cd89326b4]::query_impl::typeck_root::execute_query_non_incr::__rust_end_short_backtrace
  22:     0x7f7345bf272d - <rustc_middle[609d1ad3d24e1e94]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[3ee1161489fed852]::check_crate::{closure#1}>::{closure#0}
  23:     0x7f7345bf2121 - rustc_hir_analysis[3ee1161489fed852]::check_crate
  24:     0x7f7345bf5c7a - rustc_interface[e4bd750e553f61f3]::passes::analysis
  25:     0x7f7346930947 - rustc_query_impl[3556ad9cd89326b4]::execution::try_execute_query::<rustc_middle[609d1ad3d24e1e94]::query::caches::SingleCache<rustc_middle[609d1ad3d24e1e94]::query::erase::ErasedData<[u8; 0usize]>>, false>
  26:     0x7f7346930629 - rustc_query_impl[3556ad9cd89326b4]::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
  27:     0x7f73468f5cc0 - rustc_interface[e4bd750e553f61f3]::interface::run_compiler::<(), rustc_driver_impl[42758a1aa22d3683]::run_compiler::{closure#0}>::{closure#1}
  28:     0x7f734693bcba - std[5adfb42b05986d41]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[e4bd750e553f61f3]::util::run_in_thread_with_globals<rustc_interface[e4bd750e553f61f3]::util::run_in_thread_pool_with_globals<rustc_interface[e4bd750e553f61f3]::interface::run_compiler<(), rustc_driver_impl[42758a1aa22d3683]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  29:     0x7f734693ba6d - <std[5adfb42b05986d41]::thread::lifecycle::spawn_unchecked<rustc_interface[e4bd750e553f61f3]::util::run_in_thread_with_globals<rustc_interface[e4bd750e553f61f3]::util::run_in_thread_pool_with_globals<rustc_interface[e4bd750e553f61f3]::interface::run_compiler<(), rustc_driver_impl[42758a1aa22d3683]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[6c0acdb6a595595b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  30:     0x7f734693fdd2 - <std[5adfb42b05986d41]::sys::thread::unix::Thread>::new::thread_start
  31:     0x7f73402981b9 - <unknown>
  32:     0x7f734031d21c - <unknown>
  33:                0x0 - <unknown>

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 `/tmp/im/splat/rustc-ice-2026-06-27T11_14_47-589726.txt` to your bug report

note: rustc 1.98.0-nightly (267c4057b 2026-06-27) 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
warning: 1 warning emitted

@rustbot label +F-splat

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.F-splat`#![feature(splat)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions