Skip to content

ICE: arguments using PassMode::Indirect are currently not supported for tail calls #144754

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

#![feature(explicit_tail_calls)]
#![crate_type = "lib"]

pub const fn test(s: String) -> String {
    const fn takes_string(s: String) -> String {
        s
    }

    become takes_string(s);
}

original:

#![expect(incomplete_features)]
#![feature(explicit_tail_calls)]
#![crate_type="lib"]

pub const fn test(s: String) -> String {
    const fn takes_string(s: String) -> String {
        s
    }

    become takes_string(s);
}

Version information

rustc 1.90.0-nightly (adcb3d3b4 2025-07-31)
binary: rustc
commit-hash: adcb3d3b4cd3b7c4cde642f3ed537037f293738e
commit-date: 2025-07-31
host: x86_64-unknown-linux-gnu
release: 1.90.0-nightly
LLVM version: 20.1.8

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

Program output

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

error: internal compiler error: /rustc-dev/adcb3d3b4cd3b7c4cde642f3ed537037f293738e/compiler/rustc_codegen_ssa/src/mir/block.rs:1059:17: arguments using PassMode::Indirect are currently not supported for tail calls
 --> /tmp/icemaker_global_tempdir.WLxf9KfAFHUH/rustc_testrunner_tmpdir_reporting.kBs2tQwhjJYu/mvce.rs:9:12
  |
9 |     become takes_string(s);
  |            ^^^^^^^^^^^^^^^


thread 'rustc' panicked at /rustc-dev/adcb3d3b4cd3b7c4cde642f3ed537037f293738e/compiler/rustc_codegen_ssa/src/mir/block.rs:1059:17:
Box<dyn Any>
stack backtrace:
   0:     0x723da39eb653 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::he1a7167e1873f128
   1:     0x723da4202cf7 - core::fmt::write::hdd082200b2e7e952
   2:     0x723da39e1123 - std::io::Write::write_fmt::h0f6e18c78f7bdcae
   3:     0x723da39eb4b2 - std::sys::backtrace::BacktraceLock::print::hf819d59eb55a3dcc
   4:     0x723da39eef57 - std::panicking::default_hook::{{closure}}::h6076875181d8df4a
   5:     0x723da39eeabb - std::panicking::default_hook::hc6d726a7d35b23e7
   6:     0x723da2a57c83 - std[66aaf2c6a377548e]::panicking::update_hook::<alloc[8819ca7851639877]::boxed::Box<rustc_driver_impl[87c1aa980d595c19]::install_ice_hook::{closure#1}>>::{closure#0}
   7:     0x723da39ef79e - std::panicking::rust_panic_with_hook::h145efd09ed4d81a9
   8:     0x723da2a91771 - std[66aaf2c6a377548e]::panicking::begin_panic::<rustc_errors[47f8e7e848e552f4]::ExplicitBug>::{closure#0}
   9:     0x723da2a865a6 - std[66aaf2c6a377548e]::sys::backtrace::__rust_end_short_backtrace::<std[66aaf2c6a377548e]::panicking::begin_panic<rustc_errors[47f8e7e848e552f4]::ExplicitBug>::{closure#0}, !>
  10:     0x723da2a86397 - std[66aaf2c6a377548e]::panicking::begin_panic::<rustc_errors[47f8e7e848e552f4]::ExplicitBug>
  11:     0x723da2a9b191 - <rustc_errors[47f8e7e848e552f4]::diagnostic::BugAbort as rustc_errors[47f8e7e848e552f4]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x723da301284c - <rustc_errors[47f8e7e848e552f4]::DiagCtxtHandle>::span_bug::<rustc_span[e37d5da3b4f967fc]::span_encoding::Span, alloc[8819ca7851639877]::string::String>
  13:     0x723da30a7317 - rustc_middle[ff7c21e26af912db]::util::bug::opt_span_bug_fmt::<rustc_span[e37d5da3b4f967fc]::span_encoding::Span>::{closure#0}
  14:     0x723da3086b5a - rustc_middle[ff7c21e26af912db]::ty::context::tls::with_opt::<rustc_middle[ff7c21e26af912db]::util::bug::opt_span_bug_fmt<rustc_span[e37d5da3b4f967fc]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  15:     0x723da30869cb - rustc_middle[ff7c21e26af912db]::ty::context::tls::with_context_opt::<rustc_middle[ff7c21e26af912db]::ty::context::tls::with_opt<rustc_middle[ff7c21e26af912db]::util::bug::opt_span_bug_fmt<rustc_span[e37d5da3b4f967fc]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  16:     0x723da0bf5e07 - rustc_middle[ff7c21e26af912db]::util::bug::span_bug_fmt::<rustc_span[e37d5da3b4f967fc]::span_encoding::Span>
  17:     0x723da5662e56 - rustc_codegen_ssa[52ca72b5863d24ff]::mir::codegen_mir::<rustc_codegen_llvm[736698c59006c786]::builder::GenericBuilder<rustc_codegen_llvm[736698c59006c786]::context::FullCx>>
  18:     0x723da4688f8a - rustc_codegen_llvm[736698c59006c786]::base::compile_codegen_unit::module_codegen
  19:     0x723da539a5d9 - <rustc_codegen_llvm[736698c59006c786]::LlvmCodegenBackend as rustc_codegen_ssa[52ca72b5863d24ff]::traits::backend::ExtraBackendMethods>::compile_codegen_unit
  20:     0x723da53984f7 - <rustc_codegen_llvm[736698c59006c786]::LlvmCodegenBackend as rustc_codegen_ssa[52ca72b5863d24ff]::traits::backend::CodegenBackend>::codegen_crate
  21:     0x723da52a218a - <rustc_interface[77dcf312b63517cd]::queries::Linker>::codegen_and_build_linker
  22:     0x723da529fd3c - rustc_interface[77dcf312b63517cd]::passes::create_and_enter_global_ctxt::<core[3cf706f36e30eb55]::option::Option<rustc_interface[77dcf312b63517cd]::queries::Linker>, rustc_driver_impl[87c1aa980d595c19]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
  23:     0x723da54eb871 - rustc_interface[77dcf312b63517cd]::interface::run_compiler::<(), rustc_driver_impl[87c1aa980d595c19]::run_compiler::{closure#0}>::{closure#1}
  24:     0x723da53ad1c1 - std[66aaf2c6a377548e]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[77dcf312b63517cd]::util::run_in_thread_with_globals<rustc_interface[77dcf312b63517cd]::util::run_in_thread_pool_with_globals<rustc_interface[77dcf312b63517cd]::interface::run_compiler<(), rustc_driver_impl[87c1aa980d595c19]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  25:     0x723da53acea2 - <<std[66aaf2c6a377548e]::thread::Builder>::spawn_unchecked_<rustc_interface[77dcf312b63517cd]::util::run_in_thread_with_globals<rustc_interface[77dcf312b63517cd]::util::run_in_thread_pool_with_globals<rustc_interface[77dcf312b63517cd]::interface::run_compiler<(), rustc_driver_impl[87c1aa980d595c19]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[3cf706f36e30eb55]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  26:     0x723da53b2fc5 - std::sys::pal::unix::thread::Thread::new::thread_start::hd67f5fb492cecf93
  27:     0x723d9ec5f7eb - <unknown>
  28:     0x723d9ece318c - <unknown>
  29:                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.90.0-nightly (adcb3d3b4 2025-07-31) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to 1 previous error; 1 warning emitted


@rustbot label +F-explicit_tail_calls

Metadata

Metadata

Assignees

No one assigned

    Labels

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