Skip to content

Commit df9c725

Browse files
alexcrichtonabrown
authored andcommitted
Update to the next version of the witx crate
This commit updates to the 0.9 version of the witx crate implemented in WebAssembly/WASI#395. This new version drastically changes code generation and how we interface with the crate. The intention is to abstract the code generation aspects and allow code generators to implement much more low-level instructions to enable more flexible APIs in the future. Additionally a bunch of `*.witx` files were updated in the WASI repository. It's worth pointing out, however, that `wasi-common` does not change as a result of this change. The shape of the APIs that we need to implement are effectively the same and the only difference is that the shim functions generated by wiggle are a bit different.
1 parent aed6de3 commit df9c725

File tree

24 files changed

+504
-800
lines changed

24 files changed

+504
-800
lines changed

.gitmodules

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
url = https://github.com/WebAssembly/wasm-c-api
77
[submodule "WASI"]
88
path = crates/wasi-common/WASI
9-
url = https://github.com/WebAssembly/WASI
9+
url = https://github.com/alexcrichton/WASI
10+
branch = abis
1011
[submodule "crates/wasi-nn/spec"]
1112
path = crates/wasi-nn/spec
1213
url = https://github.com/WebAssembly/wasi-nn

Cargo.lock

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/wasi-common/WASI

Submodule WASI updated 68 files

crates/wiggle/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ include = ["src/**/*", "LICENSE"]
1212

1313
[dependencies]
1414
thiserror = "1"
15-
witx = { path = "../wasi-common/WASI/tools/witx", version = "0.8.7", optional = true }
15+
witx = { path = "../wasi-common/WASI/tools/witx", version = "0.9", optional = true }
1616
wiggle-macro = { path = "macro", version = "0.23.0" }
1717
tracing = "0.1.15"
1818
bitflags = "1.2"

crates/wiggle/generate/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ include = ["src/**/*", "LICENSE"]
1414
[lib]
1515

1616
[dependencies]
17-
witx = { version = "0.8.7", path = "../../wasi-common/WASI/tools/witx" }
17+
witx = { version = "0.9", path = "../../wasi-common/WASI/tools/witx" }
1818
quote = "1.0"
1919
proc-macro2 = "1.0"
2020
heck = "0.3"

crates/wiggle/generate/src/error_transform.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,14 @@ impl ErrorTransform {
4949

5050
pub fn for_abi_error(&self, tref: &TypeRef) -> Option<&UserErrorType> {
5151
match tref {
52-
TypeRef::Name(nt) => self.m.iter().find(|u| u.abi_type.name == nt.name),
52+
TypeRef::Name(nt) => self.for_name(nt),
5353
TypeRef::Value { .. } => None,
5454
}
5555
}
56+
57+
pub fn for_name(&self, nt: &NamedType) -> Option<&UserErrorType> {
58+
self.m.iter().find(|u| u.abi_type.name == nt.name)
59+
}
5660
}
5761

5862
pub struct UserErrorType {

0 commit comments

Comments
 (0)