Skip to content

Commit

Permalink
Update the wasm-tools family of crates, disallow empty component types (
Browse files Browse the repository at this point in the history
#6777)

* Remove unused WIT files from Wasmtime

These files aren't actually read by anything currently. They were added
historically and a previous refactoring in #6390 forgot to remove them.
No tests or build process reads them so this deletes them to get them
out of the way.

* Update dependencies on wasm-tools crates.

This commit updates the deps on the wasm-tools family of crates to bring
in a few fixes for WIT/component-related things. Primarily though this
brings in an update to the component model where empty types are now
disallowed.

Some tests using empty types were adjusted to use non-empty types, but
many tests were also simply removed as they existed to test what would
happen with empty types which now no longer needs to be tested.

* Update `stream-error` in preview2

Add a `dummy` field to make it a non-empty structure. It's expected that
this will change to something else more "official" in the future, but
for now this is here to keep everything compiling.

* Update component fuzzing to avoid empty types

Empty types are no longer valid

* Update crates/wasi/wit/deps/io/streams.wit

Co-authored-by: Peter Huene <peter@huene.dev>

---------

Co-authored-by: Peter Huene <peter@huene.dev>
  • Loading branch information
alexcrichton and peterhuene authored Jul 26, 2023
1 parent dcafb57 commit 7b9189b
Show file tree
Hide file tree
Showing 34 changed files with 177 additions and 2,731 deletions.
110 changes: 55 additions & 55 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,15 @@ rustix = "0.38.4"
wit-bindgen = { version = "0.7.0", default-features = false }

# wasm-tools family:
wasmparser = "0.109.0"
wat = "1.0.68"
wast = "62.0.0"
wasmprinter = "0.2.61"
wasm-encoder = "0.31.0"
wasm-smith = "0.12.12"
wasm-mutate = "0.2.29"
wit-parser = "0.9.1"
wit-component = "0.13.0"
wasmparser = "0.110.0"
wat = "1.0.69"
wast = "62.0.1"
wasmprinter = "0.2.62"
wasm-encoder = "0.31.1"
wasm-smith = "0.12.13"
wasm-mutate = "0.2.30"
wit-parser = "0.9.2"
wit-component = "0.13.1"

# Non-Bytecode Alliance maintained dependencies:
# --------------------------
Expand Down
10 changes: 5 additions & 5 deletions crates/misc/component-fuzz-util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ pub enum Type {
// don't let the fuzzer go too wild since `wasmparser`'s validator currently
// has hard limits in the 1000-ish range on the number of fields a record
// may contain.
Record(VecInRange<Type, 0, 200>),
Record(VecInRange<Type, 1, 200>),

// Tuples can only have up to 16 type parameters in wasmtime right now for
// the static API, but the standard library only supports `Debug` up to 11
// elements, so compromise at an even 10.
Tuple(VecInRange<Type, 0, 10>),
Tuple(VecInRange<Type, 1, 10>),

// Like records, allow a good number of variants, but variants require at
// least one case.
Expand Down Expand Up @@ -178,9 +178,9 @@ impl Type {
err: Type::generate_opt(u, depth - 1, fuel)?.map(Box::new),
},
21 => {
// Generate 0 flags all the way up to 65 flags which exercises
// the 0 to 3 x u32 cases.
let amt = u.int_in_range(0..=(*fuel).min(65))?;
// Generate 1 flag all the way up to 65 flags which exercises
// the 1 to 3 x u32 cases.
let amt = u.int_in_range(1..=(*fuel).min(65))?;
*fuel -= amt;
Type::Flags(amt)
}
Expand Down
Loading

0 comments on commit 7b9189b

Please sign in to comment.