WebAssembly / WebAssembly/WASI

What is the ABI of the Result<> type?

Open
#499 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

S-inactive
Dominant language
Rust
Stars
5.8k
Forks
333
Avg merge
2d 13h
Merged PRs (30d)
3

Description

snapshot_docs
uses Result<> type

For example,
args_sizes_get() -> Result<(size, size), errno>

This type does not seems to be a C type, but looks like a type in the Rust programming language.

I do not find ABI definition in BasicCABI, for type similar to Result<>

Does Result<> has the same layout as

#[repr(C)]
enum Result<T, E> {
   Ok(T),
   Err(E),
}

What the layout of the following Result<>?
args_get(argv: Pointer<Pointer<u8>>, argv_buf: Pointer<u8>) -> Result<(), errno>
args_sizes_get() -> Result<(size, size), errno>
fd_write(fd: fd, iovs: ciovec_array) -> Result<size, errno>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with snapshot_docs/docs.md and the BasicCABI.md reference named in the issue, then trace how WASI result types are specified and represented at the ABI boundary. A complete resolution would document whether Result<> has a defined layout and clarify the layouts of the listed function results, with examples that remove the current ambiguity.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
documentation, operating-systems
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.