Skip to content

ICE: used byval ABI for unsized layout #124806

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

#![feature(abi_x86_interrupt)] #![feature(unsized_fn_params)] struct Test; impl Test { pub extern "x86-interrupt" fn test(_a: str) {} }

original:

struct Test; impl Test { pub extern "x86-interrupt" fn test(_a: str) { } }

Version information

rustc 1.80.0-nightly (25e3949aa 2024-05-06) binary: rustc commit-hash: 25e3949aa1b24b3f62a72c1f713830aa1d1efcd4 commit-date: 2024-05-06 host: x86_64-unknown-linux-gnu release: 1.80.0-nightly LLVM version: 18.1.4 

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(abi_x86_interrupt) -Zcrate-attr=feature(unsized_fn_params) -Clink-dead-code=true --crate-type=lib

Program output

warning: struct `Test` is never constructed --> /tmp/icemaker_global_tempdir.cFeBgsJNprxL/rustc_testrunner_tmpdir_reporting.zx6V8PkPVkHF/mvce.rs:1:8 | 1 | struct Test; | ^^^^ | = note: `#[warn(dead_code)]` on by default warning: associated function `test` is never used --> /tmp/icemaker_global_tempdir.cFeBgsJNprxL/rustc_testrunner_tmpdir_reporting.zx6V8PkPVkHF/mvce.rs:4:35 | 3 | impl Test { | --------- associated function in this implementation 4 | pub extern "x86-interrupt" fn test(_a: str) {} | ^^^^ warning: `extern` fn uses type `str`, which is not FFI-safe --> /tmp/icemaker_global_tempdir.cFeBgsJNprxL/rustc_testrunner_tmpdir_reporting.zx6V8PkPVkHF/mvce.rs:4:44 | 4 | pub extern "x86-interrupt" fn test(_a: str) {} | ^^^ not FFI-safe | = help: consider using `*const u8` and a length instead = note: string slices have no C equivalent = note: `#[warn(improper_ctypes_definitions)]` on by default thread 'rustc' panicked at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/compiler/rustc_target/src/abi/call/mod.rs:662:9: used byval ABI for unsized layout stack backtrace: 0: 0x7520ddde0b35 - std::backtrace_rs::backtrace::libunwind::trace::h0237a9d37919b3ec at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5 1: 0x7520ddde0b35 - std::backtrace_rs::backtrace::trace_unsynchronized::h4c8f70ef1acfdb78 at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7520ddde0b35 - std::sys_common::backtrace::_print_fmt::h5b738224e75de754 at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/library/std/src/sys_common/backtrace.rs:68:5 3: 0x7520ddde0b35 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf9f7d71c4c529ad8 at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7520dde2fcfb - core::fmt::rt::Argument::fmt::h03b0e1b7a27ddedf at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/library/core/src/fmt/rt.rs:165:63 5: 0x7520dde2fcfb - core::fmt::write::h248446ba3e345fa4 at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/library/core/src/fmt/mod.rs:1157:21 6: 0x7520dddd58ff - std::io::Write::write_fmt::hac9e4b182ba2857c at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/library/std/src/io/mod.rs:1835:15 7: 0x7520ddde090e - std::sys_common::backtrace::_print::h54e0c4dd786df1a7 at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/library/std/src/sys_common/backtrace.rs:47:5 8: 0x7520ddde090e - std::sys_common::backtrace::print::h18113f9dcd919587 at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/library/std/src/sys_common/backtrace.rs:34:9 9: 0x7520ddde3279 - std::panicking::default_hook::{{closure}}::hebc9d09f9aaaef06 10: 0x7520ddde2fbd - std::panicking::default_hook::h2248d0b2ea6d5c7c at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/library/std/src/panicking.rs:298:9 11: 0x7520da6b6c00 - std[b086d9f741814aa7]::panicking::update_hook::<alloc[9e77a608ae7548d9]::boxed::Box<rustc_driver_impl[cd242fc3f331fee7]::install_ice_hook::{closure#0}>>::{closure#0} 12: 0x7520ddde3976 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hebac1653221b3ca4 at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/library/alloc/src/boxed.rs:2036:9 13: 0x7520ddde3976 - std::panicking::rust_panic_with_hook::h2753b01180f345fa at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/library/std/src/panicking.rs:799:13 14: 0x7520ddde36eb - std::panicking::begin_panic_handler::{{closure}}::h59aac591d532bbdd at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/library/std/src/panicking.rs:656:13 15: 0x7520ddde0ff9 - std::sys_common::backtrace::__rust_end_short_backtrace::h80dab8854c18c59d at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/library/std/src/sys_common/backtrace.rs:171:18 16: 0x7520ddde3457 - rust_begin_unwind at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/library/std/src/panicking.rs:652:5 17: 0x7520dde2c2c3 - core::panicking::panic_fmt::hb8f3ed7d1c2faf0e at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/library/core/src/panicking.rs:72:14 18: 0x7520d935c141 - <rustc_target[184f43d5e0345301]::abi::call::ArgAbi<rustc_middle[dafa6f84b775271f]::ty::Ty>>::make_indirect_byval 19: 0x7520dc7255a2 - rustc_ty_utils[d072b78cb198a2f9]::abi::fn_abi_new_uncached 20: 0x7520dbc77faa - rustc_ty_utils[d072b78cb198a2f9]::abi::fn_abi_of_instance 21: 0x7520dbc76877 - rustc_query_impl[bc46c06982da3aa2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bc46c06982da3aa2]::query_impl::fn_abi_of_instance::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dafa6f84b775271f]::query::erase::Erased<[u8; 16usize]>> 22: 0x7520dbc7480f - rustc_query_system[9914171e3cd4e2f]::query::plumbing::try_execute_query::<rustc_query_impl[bc46c06982da3aa2]::DynamicConfig<rustc_query_system[9914171e3cd4e2f]::query::caches::DefaultCache<rustc_middle[dafa6f84b775271f]::ty::ParamEnvAnd<(rustc_middle[dafa6f84b775271f]::ty::instance::Instance, &rustc_middle[dafa6f84b775271f]::ty::list::RawList<(), rustc_middle[dafa6f84b775271f]::ty::Ty>)>, rustc_middle[dafa6f84b775271f]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[bc46c06982da3aa2]::plumbing::QueryCtxt, false> 23: 0x7520dbc74469 - rustc_query_impl[bc46c06982da3aa2]::query_impl::fn_abi_of_instance::get_query_non_incr::__rust_end_short_backtrace 24: 0x7520d8b44005 - <rustc_codegen_llvm[b4dd3527c9c5b42e]::context::CodegenCx as rustc_codegen_ssa[d63ee8fd2fa91707]::traits::declare::PreDefineMethods>::predefine_fn 25: 0x7520dc6d2a13 - rustc_codegen_llvm[b4dd3527c9c5b42e]::base::compile_codegen_unit::module_codegen 26: 0x7520dc6ced16 - <rustc_codegen_llvm[b4dd3527c9c5b42e]::LlvmCodegenBackend as rustc_codegen_ssa[d63ee8fd2fa91707]::traits::backend::ExtraBackendMethods>::compile_codegen_unit 27: 0x7520dc927fdd - rustc_codegen_ssa[d63ee8fd2fa91707]::base::codegen_crate::<rustc_codegen_llvm[b4dd3527c9c5b42e]::LlvmCodegenBackend> 28: 0x7520dc8214cc - <rustc_codegen_llvm[b4dd3527c9c5b42e]::LlvmCodegenBackend as rustc_codegen_ssa[d63ee8fd2fa91707]::traits::backend::CodegenBackend>::codegen_crate 29: 0x7520dc820e5f - rustc_interface[5201622961cc16ec]::passes::start_codegen 30: 0x7520dc8204da - <rustc_interface[5201622961cc16ec]::queries::Queries>::codegen_and_build_linker 31: 0x7520dc62522e - rustc_interface[5201622961cc16ec]::interface::run_compiler::<core[9c1df39db662c9eb]::result::Result<(), rustc_span[6cb8761197abd2a5]::ErrorGuaranteed>, rustc_driver_impl[cd242fc3f331fee7]::run_compiler::{closure#0}>::{closure#1} 32: 0x7520dc60f989 - std[b086d9f741814aa7]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[5201622961cc16ec]::util::run_in_thread_with_globals<rustc_interface[5201622961cc16ec]::util::run_in_thread_pool_with_globals<rustc_interface[5201622961cc16ec]::interface::run_compiler<core[9c1df39db662c9eb]::result::Result<(), rustc_span[6cb8761197abd2a5]::ErrorGuaranteed>, rustc_driver_impl[cd242fc3f331fee7]::run_compiler::{closure#0}>::{closure#1}, core[9c1df39db662c9eb]::result::Result<(), rustc_span[6cb8761197abd2a5]::ErrorGuaranteed>>::{closure#0}, core[9c1df39db662c9eb]::result::Result<(), rustc_span[6cb8761197abd2a5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9c1df39db662c9eb]::result::Result<(), rustc_span[6cb8761197abd2a5]::ErrorGuaranteed>> 33: 0x7520dc60f736 - <<std[b086d9f741814aa7]::thread::Builder>::spawn_unchecked_<rustc_interface[5201622961cc16ec]::util::run_in_thread_with_globals<rustc_interface[5201622961cc16ec]::util::run_in_thread_pool_with_globals<rustc_interface[5201622961cc16ec]::interface::run_compiler<core[9c1df39db662c9eb]::result::Result<(), rustc_span[6cb8761197abd2a5]::ErrorGuaranteed>, rustc_driver_impl[cd242fc3f331fee7]::run_compiler::{closure#0}>::{closure#1}, core[9c1df39db662c9eb]::result::Result<(), rustc_span[6cb8761197abd2a5]::ErrorGuaranteed>>::{closure#0}, core[9c1df39db662c9eb]::result::Result<(), rustc_span[6cb8761197abd2a5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9c1df39db662c9eb]::result::Result<(), rustc_span[6cb8761197abd2a5]::ErrorGuaranteed>>::{closure#2} as core[9c1df39db662c9eb]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 34: 0x7520ddded7bb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha0c4bf88c896ff7b at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/library/alloc/src/boxed.rs:2022:9 35: 0x7520ddded7bb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::had08bec978f53e77 at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/library/alloc/src/boxed.rs:2022:9 36: 0x7520ddded7bb - std::sys::pal::unix::thread::Thread::new::thread_start::haa511dd1bba6b653 at /rustc/25e3949aa1b24b3f62a72c1f713830aa1d1efcd4/library/std/src/sys/pal/unix/thread.rs:108:17 37: 0x7520ddb8c55a - <unknown> 38: 0x7520ddc09a3c - <unknown> 39: 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.80.0-nightly (25e3949aa 2024-05-06) running on x86_64-unknown-linux-gnu note: compiler flags: -Z crate-attr=feature(abi_x86_interrupt) -Z crate-attr=feature(unsized_fn_params) -C link-dead-code=true --crate-type lib -Z dump-mir-dir=dir query stack during panic: #0 [fn_abi_of_instance] computing call ABI of `<impl at /tmp/icemaker_global_tempdir.cFeBgsJNprxL/rustc_testrunner_tmpdir_reporting.zx6V8PkPVkHF/mvce.rs:3:1: 3:10>::test` end of query stack warning: 3 warnings emitted 

@rustbot label +F-abi_x86_interrupt +F-unsized_fn_params

Metadata

Metadata

Assignees

Labels

A-hardware-interruptsArea: Code for handling the "interrupt ABI" of various processorsC-bugCategory: This is a bug.F-abi_x86_interruptF-unsized_fn_params`#![feature(unsized_fn_params)]`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