Skip to content

[ICE] due to #[splat] in a function pointer type #158603

Description

@theemathas

Code

#![feature(splat)]
#![expect(incomplete_features)]

fn main() {
    let x: fn(#[splat] (i32,)) = None.unwrap();
    x(1);
}

cc @teor2345

Meta

Reproducible on the playground with version 1.98.0-nightly (2026-06-29 096694416a4184070914)

Error output

error: internal compiler error: /rustc-dev/096694416a41840709140eb0fd0ca193d1a3e6ba/compiler/rustc_mir_build/src/thir/cx/expr.rs:1229:13: no splatted def for function or method callee
 --> src/main.rs:6:5
  |
6 |     x(1);
  |     ^^^^


thread 'rustc' (105) panicked at /rustc-dev/096694416a41840709140eb0fd0ca193d1a3e6ba/compiler/rustc_mir_build/src/thir/cx/expr.rs:1229:13:
Box<dyn Any>
Backtrace

stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::diagnostic::BugAbort as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
   2: <rustc_errors::DiagCtxtHandle>::span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
   3: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   5: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   6: rustc_middle::util::bug::span_bug_fmt::<rustc_span::span_encoding::Span>
   7: <rustc_mir_build::thir::cx::ThirBuildCx>::convert_splatted_callee
   8: <rustc_mir_build::thir::cx::ThirBuildCx>::mirror_expr
   9: <rustc_mir_build::thir::cx::ThirBuildCx>::mirror_stmts::{closure#0}
  10: <rustc_mir_build::thir::cx::ThirBuildCx>::mirror_expr
  11: rustc_mir_build::thir::cx::thir_body
      [... omitted 1 frame ...]
  12: rustc_mir_build::check_unsafety::check_unsafety
  13: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 0]>, rustc_middle::dep_graph::graph::DepNodeIndex>, false>
  14: <rustc_middle::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface::passes::run_required_analyses::{closure#2}::{closure#0}>::{closure#0}
  15: rustc_interface::passes::analysis
  16: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, false>
  17: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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 `/playground/rustc-ice-2026-06-30T07_24_48-103.txt` to your bug report

note: rustc 1.98.0-nightly (096694416 2026-06-29) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [thir_body] building THIR for `main`
#1 [check_unsafety] unsafety-checking `main`
#2 [analysis] running analysis passes on crate `playground`
end of query stack

Metadata

Metadata

Assignees

No one assigned

    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
    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