Skip to content

ICE on const fn param of type ... (C-variadics) #164319

Description

@fmease

Reproducer:

fn f(const X: ...) {}

Compiler Output (Abridged):

error: `...` is not supported for non-extern functions
 --> <anon>:1:6
  |
1 | fn f(const X: ...) {}
  |      ^^^^^^^^^^^^
  |
  = help: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list

error[E0658]: function arg const generics are experimental
 --> <anon>:1:6
  |
1 | fn f(const X: ...) {}
  |      ^^^^^
  |
  = note: see issue #163261 <https://github.com/rust-lang/rust/issues/163261> for more information
  = help: add `#![feature(function_arg_const_generics)]` to the crate attributes to enable
  = note: this compiler was built on 2026-10-14; consider upgrading it if it is out of date


thread 'rustc' (844825) panicked at /rustc-dev/d8ef4f3fe7031514cbd7d056b7b058814987ecec/compiler/rustc_hir_typeck/src/check.rs:60:39:
called `Option::unwrap()` on a `None` value
Compiler Output (Full)error: `...` is not supported for non-extern functions --> <anon>:1:6 | 1 | fn f(const X: ...) {} | ^^^^^^^^^^^^ | = help: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list error[E0658]: function arg const generics are experimental --> <anon>:1:6 | 1 | fn f(const X: ...) {} | ^^^^^ | = note: see issue #163261 <https://github.com/rust-lang/rust/issues/163261> for more information = help: add `#![feature(function_arg_const_generics)]` to the crate attributes to enable = note: this compiler was built on 2026-10-14; consider upgrading it if it is out of date thread 'rustc' (844825) panicked at /rustc-dev/d8ef4f3fe7031514cbd7d056b7b058814987ecec/compiler/rustc_hir_typeck/src/check.rs:60:39: called `Option::unwrap()` on a `None` value stack backtrace: 0: 0x7f2d79e45ed6 - <<std[d09574b126e6dfc7]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[ac9ef1e527615842]::fmt::Display>::fmt 1: 0x7f2d7a40ff69 - core[ac9ef1e527615842]::fmt::write 2: 0x7f2d7829578c - <std[d09574b126e6dfc7]::sys::stdio::unix::Stderr as core[ac9ef1e527615842]::io::write::Write>::write_fmt 3: 0x7f2d79e173ea - std[d09574b126e6dfc7]::panicking::default_hook::{closure#0} 4: 0x7f2d79e39855 - std[d09574b126e6dfc7]::panicking::default_hook 5: 0x7f2d78bda679 - std[d09574b126e6dfc7]::panicking::update_hook::<alloc[d9c8df61c6f087e7]::boxed::Box<rustc_driver_impl[7e14fe9f3ec30f67]::install_ice_hook::{closure#1}>>::{closure#0} 6: 0x7f2d79e39cf2 - std[d09574b126e6dfc7]::panicking::panic_with_hook 7: 0x7f2d79e174d4 - std[d09574b126e6dfc7]::panicking::panic_handler::{closure#0} 8: 0x7f2d79e0ed89 - std[d09574b126e6dfc7]::sys::backtrace::__rust_end_short_backtrace::<std[d09574b126e6dfc7]::panicking::panic_handler::{closure#0}, !> 9: 0x7f2d79e191cd - __rustc[9a0f8d7e9b68a4c3]::rust_begin_unwind 10: 0x7f2d75c4b86c - core[ac9ef1e527615842]::panicking::panic_fmt 11: 0x7f2d76e37872 - core[ac9ef1e527615842]::panicking::panic 12: 0x7f2d7645b049 - core[ac9ef1e527615842]::option::unwrap_failed 13: 0x7f2d7a854ea8 - rustc_hir_typeck[a81b59665ff6a06b]::check::check_fn 14: 0x7f2d7b8879c4 - rustc_hir_typeck[a81b59665ff6a06b]::typeck_with_inspect::{closure#0} 15: 0x7f2d7b885d70 - rustc_query_impl[5823b503668262ba]::query_vtables::typeck_root::invoke_provider_fn::__rust_begin_short_backtrace 16: 0x7f2d7abddd4e - rustc_query_impl[5823b503668262ba]::execution::try_execute_query::<rustc_data_structures[db47a2c23590d872]::vec_cache::VecCache<rustc_span[4c527b0337203665]::def_id::LocalDefId, rustc_middle[4dfcce87f818a1d3]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[4dfcce87f818a1d3]::dep_graph::graph::DepNodeIndex>, false> 17: 0x7f2d7abdd96b - rustc_query_impl[5823b503668262ba]::query_vtables::typeck_root::execute_query_non_incr::__rust_end_short_backtrace 18: 0x7f2d7aaf1216 - <rustc_middle[4dfcce87f818a1d3]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[2bc216ffff112df2]::check_crate::{closure#1}>::{closure#0} 19: 0x7f2d7aaf08c7 - rustc_hir_analysis[2bc216ffff112df2]::check_crate 20: 0x7f2d7abda739 - rustc_interface[89bc294aa3c9d902]::passes::analysis 21: 0x7f2d7b4f7b1f - rustc_query_impl[5823b503668262ba]::execution::try_execute_query::<rustc_middle[4dfcce87f818a1d3]::query::caches::SingleCache<rustc_middle[4dfcce87f818a1d3]::query::erase::ErasedData<[u8; 0usize]>>, false> 22: 0x7f2d7b4f78b1 - rustc_query_impl[5823b503668262ba]::query_vtables::analysis::execute_query_non_incr::__rust_end_short_backtrace 23: 0x7f2d7b6e5a47 - rustc_interface[89bc294aa3c9d902]::interface::run_compiler::<(), rustc_driver_impl[7e14fe9f3ec30f67]::compiler_entrypoint::{closure#0}>::{closure#2} 24: 0x7f2d7b777042 - std[d09574b126e6dfc7]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[89bc294aa3c9d902]::util::run_in_thread_with_globals<rustc_interface[89bc294aa3c9d902]::util::run_in_thread_pool_with_globals<rustc_interface[89bc294aa3c9d902]::interface::run_compiler<(), rustc_driver_impl[7e14fe9f3ec30f67]::compiler_entrypoint::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()> 25: 0x7f2d7b776ded - <std[d09574b126e6dfc7]::thread::lifecycle::spawn_unchecked<rustc_interface[89bc294aa3c9d902]::util::run_in_thread_with_globals<rustc_interface[89bc294aa3c9d902]::util::run_in_thread_pool_with_globals<rustc_interface[89bc294aa3c9d902]::interface::run_compiler<(), rustc_driver_impl[7e14fe9f3ec30f67]::compiler_entrypoint::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[ac9ef1e527615842]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 26: 0x7f2d7b7722ad - <std[d09574b126e6dfc7]::sys::thread::unix::Thread>::new::thread_start 27: 0x7f2d74698042 - <unknown> 28: 0x7f2d7472072c - <unknown> 29: 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: rustc 1.101.0-nightly (d8ef4f3fe 2026-10-14) running on x86_64-unknown-linux-gnu note: compiler flags: --crate-type lib -Z unstable-options query stack during panic: #0 [typeck_root] type-checking `f` #1 [analysis] running analysis passes on crate `rust_out` end of query stack error: aborting due to 2 previous errors

Meta:

rustc 1.101.0-nightly (d8ef4f3fe 2026-10-14)
binary: rustc
commit-hash: d8ef4f3fe7031514cbd7d056b7b058814987ecec
commit-date: 2026-10-14
host: x86_64-unknown-linux-gnu
release: 1.101.0-nightly
LLVM version: 23.1.3

Activity

  1. added
    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.
    C-bugCategory: This is a bug.
    on Oct 14, 2026
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 14, 2026
  3. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 14, 2026
  4. fmease commented on Oct 14, 2026

    @fmease
    MemberAuthor

    cc @bit-aloo (#162727)

    fn f(const X: ...) {} should probably be made syntactically ill-formed just like fn f<const X: ...>() {} is.

  5. bit-aloo commented on Oct 14, 2026

    @bit-aloo
    Member

    Ah! Thanks. @rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.F-function_arg_const_generics`#![feature(function_arg_const_generics)]`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

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions