Skip to content

Commit

Permalink
Update wasm-tools crates
Browse files Browse the repository at this point in the history
Pull in recent updates and denying memory64 support in components during
validation.
  • Loading branch information
alexcrichton committed Jan 8, 2025
1 parent ef1ec37 commit bdc9427
Show file tree
Hide file tree
Showing 10 changed files with 157 additions and 135 deletions.
159 changes: 80 additions & 79 deletions Cargo.lock

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -285,16 +285,16 @@ wit-bindgen = { version = "0.35.0", default-features = false }
wit-bindgen-rust-macro = { version = "0.35.0", default-features = false }

# wasm-tools family:
wasmparser = { version = "0.221.2", default-features = false, features = ['simd'] }
wat = "1.221.2"
wast = "221.0.2"
wasmprinter = "0.221.2"
wasm-encoder = "0.221.2"
wasm-smith = "0.221.2"
wasm-mutate = "0.221.2"
wit-parser = "0.221.2"
wit-component = "0.221.2"
wasm-wave = "0.221.2"
wasmparser = { version = "0.223.0", default-features = false, features = ['simd'] }
wat = "1.223.0"
wast = "223.0.0"
wasmprinter = "0.223.0"
wasm-encoder = "0.223.0"
wasm-smith = "0.223.0"
wasm-mutate = "0.223.0"
wit-parser = "0.223.0"
wit-component = "0.223.0"
wasm-wave = "0.223.0"

# Non-Bytecode Alliance maintained dependencies:
# --------------------------
Expand Down
29 changes: 29 additions & 0 deletions crates/environ/src/component/translate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,32 @@ impl<'a, 'data> Translator<'a, 'data> {
| wasmparser::CanonicalFunction::ThreadHwConcurrency => {
bail!("unsupported intrinsic")
}

wasmparser::CanonicalFunction::TaskBackpressure
| wasmparser::CanonicalFunction::TaskPoll { .. }
| wasmparser::CanonicalFunction::TaskYield { .. }
| wasmparser::CanonicalFunction::SubtaskDrop
| wasmparser::CanonicalFunction::StreamNew { .. }
| wasmparser::CanonicalFunction::StreamRead { .. }
| wasmparser::CanonicalFunction::StreamWrite { .. }
| wasmparser::CanonicalFunction::StreamCancelRead { .. }
| wasmparser::CanonicalFunction::StreamCancelWrite { .. }
| wasmparser::CanonicalFunction::StreamCloseReadable { .. }
| wasmparser::CanonicalFunction::StreamCloseWritable { .. }
| wasmparser::CanonicalFunction::FutureNew { .. }
| wasmparser::CanonicalFunction::FutureRead { .. }
| wasmparser::CanonicalFunction::FutureWrite { .. }
| wasmparser::CanonicalFunction::FutureCancelRead { .. }
| wasmparser::CanonicalFunction::FutureCancelWrite { .. }
| wasmparser::CanonicalFunction::FutureCloseReadable { .. }
| wasmparser::CanonicalFunction::FutureCloseWritable { .. }
| wasmparser::CanonicalFunction::ErrorContextNew { .. }
| wasmparser::CanonicalFunction::ErrorContextDebugMessage { .. }
| wasmparser::CanonicalFunction::ErrorContextDrop
| wasmparser::CanonicalFunction::TaskReturn { .. }
| wasmparser::CanonicalFunction::TaskWait { .. } => {
bail!("unsupported intrinsic")
}
};
self.result.initializers.push(init);
}
Expand Down Expand Up @@ -920,6 +946,9 @@ impl<'a, 'data> Translator<'a, 'data> {
let idx = FuncIndex::from_u32(*idx);
ret.post_return = Some(idx);
}
wasmparser::CanonicalOption::Async | wasmparser::CanonicalOption::Callback(_) => {
todo!()
}
}
}
return ret;
Expand Down
3 changes: 3 additions & 0 deletions crates/environ/src/component/types_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ impl ComponentTypesBuilder {
ComponentDefinedType::Borrow(r) => {
InterfaceType::Borrow(self.resource_id(r.resource()))
}
ComponentDefinedType::Future(_)
| ComponentDefinedType::Stream(_)
| ComponentDefinedType::ErrorContext => bail!("unsupported async type"),
};
let info = self.type_information(&ret);
if info.depth > MAX_TYPE_DEPTH {
Expand Down
2 changes: 2 additions & 0 deletions crates/wasmtime/src/engine/serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ impl Metadata<'_> {
component_model_nested_names,
component_model_more_flags,
component_model_multiple_returns,
component_model_async,
legacy_exceptions,
gc_types,
stack_switching,
Expand All @@ -252,6 +253,7 @@ impl Metadata<'_> {
assert!(!shared_everything_threads);
assert!(!legacy_exceptions);
assert!(!stack_switching);
assert!(!component_model_async);

Metadata {
target: engine.compiler().triple().to_string(),
Expand Down
9 changes: 4 additions & 5 deletions crates/wit-bindgen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1666,6 +1666,7 @@ impl<'a> InterfaceGenerator<'a> {
TypeDefKind::Type(t) => self.type_alias(id, name, t, &ty.docs),
TypeDefKind::Future(_) => todo!("generate for future"),
TypeDefKind::Stream(_) => todo!("generate for stream"),
TypeDefKind::ErrorContext => todo!("generate for error-context"),
TypeDefKind::Handle(handle) => self.type_handle(id, name, handle, &ty.docs),
TypeDefKind::Resource => self.type_resource(id, name, ty, &ty.docs),
TypeDefKind::Unknown => unreachable!(),
Expand Down Expand Up @@ -3237,6 +3238,7 @@ fn type_contains_lists(ty: Type, resolve: &Resolve) -> bool {
Type::Id(id) => match &resolve.types[id].kind {
TypeDefKind::Resource
| TypeDefKind::Unknown
| TypeDefKind::ErrorContext
| TypeDefKind::Flags(_)
| TypeDefKind::Handle(_)
| TypeDefKind::Enum(_) => false,
Expand All @@ -3258,11 +3260,8 @@ fn type_contains_lists(ty: Type, resolve: &Resolve) -> bool {
.iter()
.any(|case| option_type_contains_lists(case.ty, resolve)),
TypeDefKind::Type(ty) => type_contains_lists(*ty, resolve),
TypeDefKind::Future(ty) => option_type_contains_lists(*ty, resolve),
TypeDefKind::Stream(Stream { element, end }) => {
option_type_contains_lists(*element, resolve)
|| option_type_contains_lists(*end, resolve)
}
TypeDefKind::Future(_) => todo!(),
TypeDefKind::Stream(_) => todo!(),
TypeDefKind::List(_) => true,
},

Expand Down
18 changes: 5 additions & 13 deletions crates/wit-bindgen/src/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ pub trait RustGenerator<'a> {
| TypeDefKind::Enum(_)
| TypeDefKind::Tuple(_)
| TypeDefKind::Handle(_)
| TypeDefKind::Resource => true,
| TypeDefKind::Resource
| TypeDefKind::ErrorContext => true,
TypeDefKind::Type(Type::Id(t)) => {
needs_generics(resolve, &resolve.types[*t].kind)
}
Expand Down Expand Up @@ -165,18 +166,9 @@ pub trait RustGenerator<'a> {
TypeDefKind::Enum(_) => {
panic!("unsupported anonymous type reference: enum")
}
TypeDefKind::Future(ty) => {
self.push_str("Future<");
self.print_optional_ty(ty.as_ref(), mode);
self.push_str(">");
}
TypeDefKind::Stream(stream) => {
self.push_str("Stream<");
self.print_optional_ty(stream.element.as_ref(), mode);
self.push_str(",");
self.print_optional_ty(stream.end.as_ref(), mode);
self.push_str(">");
}
TypeDefKind::Future(_) => todo!(),
TypeDefKind::Stream(_) => todo!(),
TypeDefKind::ErrorContext => todo!(),

TypeDefKind::Handle(handle) => {
self.print_handle(handle);
Expand Down
10 changes: 3 additions & 7 deletions crates/wit-bindgen/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,9 @@ impl Types {
info = self.optional_type_info(resolve, r.ok.as_ref());
info |= self.optional_type_info(resolve, r.err.as_ref());
}
TypeDefKind::Future(ty) => {
info = self.optional_type_info(resolve, ty.as_ref());
}
TypeDefKind::Stream(stream) => {
info = self.optional_type_info(resolve, stream.element.as_ref());
info |= self.optional_type_info(resolve, stream.end.as_ref());
}
TypeDefKind::Future(_) => todo!(),
TypeDefKind::Stream(_) => todo!(),
TypeDefKind::ErrorContext => todo!(),
TypeDefKind::Handle(_) => info.has_handle = true,
TypeDefKind::Resource => {}
TypeDefKind::Unknown => unreachable!(),
Expand Down
2 changes: 1 addition & 1 deletion supply-chain/audits.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4197,7 +4197,7 @@ end = "2025-12-02"
criteria = "safe-to-deploy"
user-id = 539 # Josh Stone (cuviper)
start = "2020-01-15"
end = "2024-07-06"
end = "2026-01-08"

[[trusted.io-extras]]
criteria = "safe-to-deploy"
Expand Down
40 changes: 20 additions & 20 deletions supply-chain/imports.lock
Original file line number Diff line number Diff line change
Expand Up @@ -980,8 +980,8 @@ user-login = "Amanieu"
user-name = "Amanieu d'Antras"

[[publisher.indexmap]]
version = "2.2.6"
when = "2024-03-23"
version = "2.7.0"
when = "2024-12-01"
user-id = 539
user-login = "cuviper"
user-name = "Josh Stone"
Expand Down Expand Up @@ -1368,8 +1368,8 @@ user-id = 73222
user-login = "wasmtime-publish"

[[publisher.wasm-encoder]]
version = "0.221.2"
when = "2024-12-02"
version = "0.223.0"
when = "2025-01-08"
user-id = 73222
user-login = "wasmtime-publish"

Expand All @@ -1380,14 +1380,14 @@ user-id = 73222
user-login = "wasmtime-publish"

[[publisher.wasm-metadata]]
version = "0.221.2"
when = "2024-12-02"
version = "0.223.0"
when = "2025-01-08"
user-id = 73222
user-login = "wasmtime-publish"

[[publisher.wasm-wave]]
version = "0.221.2"
when = "2024-12-02"
version = "0.223.0"
when = "2025-01-08"
user-id = 73222
user-login = "wasmtime-publish"

Expand All @@ -1398,14 +1398,14 @@ user-id = 73222
user-login = "wasmtime-publish"

[[publisher.wasmparser]]
version = "0.221.2"
when = "2024-12-02"
version = "0.223.0"
when = "2025-01-08"
user-id = 73222
user-login = "wasmtime-publish"

[[publisher.wasmprinter]]
version = "0.221.2"
when = "2024-12-02"
version = "0.223.0"
when = "2025-01-08"
user-id = 73222
user-login = "wasmtime-publish"

Expand Down Expand Up @@ -1554,14 +1554,14 @@ user-id = 73222
user-login = "wasmtime-publish"

[[publisher.wast]]
version = "221.0.2"
when = "2024-12-02"
version = "223.0.0"
when = "2025-01-08"
user-id = 73222
user-login = "wasmtime-publish"

[[publisher.wat]]
version = "1.221.2"
when = "2024-12-02"
version = "1.223.0"
when = "2025-01-08"
user-id = 73222
user-login = "wasmtime-publish"

Expand Down Expand Up @@ -1822,8 +1822,8 @@ user-id = 73222
user-login = "wasmtime-publish"

[[publisher.wit-component]]
version = "0.221.2"
when = "2024-12-02"
version = "0.223.0"
when = "2025-01-08"
user-id = 73222
user-login = "wasmtime-publish"

Expand All @@ -1834,8 +1834,8 @@ user-id = 73222
user-login = "wasmtime-publish"

[[publisher.wit-parser]]
version = "0.221.2"
when = "2024-12-02"
version = "0.223.0"
when = "2025-01-08"
user-id = 73222
user-login = "wasmtime-publish"

Expand Down

0 comments on commit bdc9427

Please sign in to comment.