Open
Description
This issue is intended to be a tracking issue for the future-incompat warning being added in #138601. This lint is notifying users of an upcoming change to the C ABI used by the wasm32-unknown-unknown
target, notably around passing aggregates-by-value in parameter position. An exampe of code that will change is:
#[repr(C)]
pub struct Pair {
x: u32,
y: u32,
}
#[unsafe(no_mangle)]
pub extern "C" fn pair_add(pair: Pair) -> u32 {
pair.x + pair.y
}
where today this generates:
(func $pair_add (param i32 i32) (result i32)
local.get 1
local.get 0
i32.add
)
but in the future this will generate:
(func (param i32) (result i32)
local.get 0
i32.load offset=4
local.get 0
i32.load
i32.add
)
More details about this change and its history can be found in the blog post associated with this change. In short though users need to do one of the following to resolve the warnings:
- Pin to a stable compiler and don't update until the default has changed.
- Update to nightly, pass
-Zwasm-c-abi=spec
, and then use that until the default changes. This means signatures will change immediately and work will be necessary to port external JS for example. - Update to nightly, pass
-Zwasm-c-abi=legacy
. This will silence the warnings but be warned that code will still break in the future when the ABI changes. - Update function signatures to not pass aggregates-by-value, but instead pass them by reference. This works both today and with the future ABI.
The current plan is to change the default ABI mid-summer 2025. This'll get updated with exact timelines as things happen. More background can be found in #122532
Implementation history
Metadata
Metadata
Assignees
Labels
Area: Concerning the application binary interface (ABI)Category: Future-incompatibility lintsCategory: An issue tracking the progress of sth. like the implementation of an RFCTarget: WASM (WebAssembly), http://webassembly.org/Relevant to the compiler team, which will review and decide on the PR/issue.