Skip to content

Tracking issue for wasm32-unknown-unknown's future-incompat warning for C ABI changes #138762

Closed

Description

@alexcrichton

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:

  1. Pin to a stable compiler and don't update until the default has changed.
  2. 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.
  3. 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.
  4. 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

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Mar 21, 2025
  2. changed the title [-]Tracking issue for wasm32-unknown-unknown's future-incompat warning[/-] [+]Tracking issue for wasm32-unknown-unknown's future-incompat warning for C ABI changes[/+] on Mar 21, 2025
  3. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    O-wasmTarget: WASM (WebAssembly), http://webassembly.org/
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    A-ABIArea: Concerning the application binary interface (ABI)
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Mar 21, 2025
  4. added a commit that references this issue on Mar 22, 2025
  5. added a commit that references this issue on Mar 24, 2025
  6. added 4 commits that reference this issue on Mar 25, 2025
  7. 16 remaining items

  8. added a commit that references this issue on Apr 24, 2025
  9. added a commit that references this issue on Apr 24, 2025
  10. added a commit that references this issue on Apr 24, 2025
  11. added a commit that references this issue on Jun 14, 2025
  12. added 2 commits that reference this issue on Jun 15, 2025
  13. added 2 commits that reference this issue on Jun 15, 2025
  14. added a commit that references this issue on Jun 16, 2025
  15. added a commit that references this issue on Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ABIArea: Concerning the application binary interface (ABI)C-future-incompatibilityCategory: Future-incompatibility lintsC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCO-wasmTarget: WASM (WebAssembly), http://webassembly.org/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