Skip to content

ICE: invalid abi for platform should have reported an error: "efiapi" #145370

@pmur

Description

@pmur

Code

I think a cherry-pick into 1.89.0 (7e0eb3b) produces a valid ICE error message due to calling a function with an unsupported abi. Though, the place where the expected error should be generated is only a warning in 1.89. I think the warning will be an error in 1.90.

# Setup rust 1.89.0 git clone https://github.com/rust-osdev/uefi-rs.git cd uefi-rs/uefi cargo build 

Generates warnings like:

warning: the calling convention "efiapi" is not supported on this target --> uefi-raw/src/protocol/acpi.rs:9:29 | 9 | pub install_acpi_table: unsafe extern "efiapi" fn( | _____________________________^ 10 | | this: *const Self, 11 | | acpi_table_buffer: *const c_void, 12 | | acpi_table_size: usize, 13 | | table_key: *mut usize, 14 | | ) -> Status, | |_______________^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260> = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default 

And if the function is called, generates an ICE:

error: internal compiler error: invalid abi for platform should have reported an error: "efiapi" --> uefi/src/proto/acpi.rs:53:13 | 53 | (self.0.install_acpi_table)(&self.0, acpi_table_ptr, acpi_table_size, &mut table_key) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 

And a simplified reproducer:

pub struct Foo { x: extern "efiapi" fn(), } pub fn foo_func(f: Foo) { (f.x)(); }

Meta

rustc --version --verbose:

rustc 1.89.0 (29483883e 2025-08-04) binary: rustc commit-hash: 29483883eed69d5fb4db01964cdf2af4d86e9cb2 commit-date: 2025-08-04 host: powerpc64le-unknown-linux-gnu release: 1.89.0 LLVM version: 20.1.7 

Error output

note: delayed at compiler/rustc_hir_typeck/src/callee.rs:162:39 - disabled backtrace --> uefi/src/proto/pci/root_bridge.rs:127:13 | 127 | / (self.io_access.read)( 128 | | self.proto, 129 | | width_mode, 130 | | addr.into(), 131 | | data.len(), 132 | | data.as_mut_ptr().cast(), 133 | | ) | |_____________^ error: internal compiler error: invalid abi for platform should have reported an error: "efiapi" --> uefi/src/proto/pci/root_bridge.rs:150:13 | 150 | / (self.io_access.write)( 151 | | self.proto, 152 | | width_mode, 153 | | addr.into(), 154 | | data.len(), 155 | | data.as_ptr().cast(), 156 | | ) | |_____________^ | 

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions