From a955ee4e4edfa4e62122bdddeee8c99f22512483 Mon Sep 17 00:00:00 2001 From: Jiaxiao Zhou Date: Mon, 20 May 2024 07:46:07 -0700 Subject: [PATCH 1/3] refactor(*): move anonymous type definition to core (#758) * refactor(*): move anonymous type definition to core Signed-off-by: Jiaxiao Zhou (Mossaka) * refactor(*): define a new trait for anonymous types Signed-off-by: Jiaxiao Zhou (Mossaka) * fixed the rebase problem in gen-c Signed-off-by: Jiaxiao Zhou (Mossaka) * removed comments Signed-off-by: Jiaxiao Zhou (Mossaka) --------- Signed-off-by: Jiaxiao Zhou (Mossaka) --- crates/c/src/lib.rs | 190 ++++++++++++++++++--------------- crates/core/src/lib.rs | 36 ++++++- crates/rust/src/interface.rs | 196 +++++++++++++++++++---------------- 3 files changed, 244 insertions(+), 178 deletions(-) diff --git a/crates/c/src/lib.rs b/crates/c/src/lib.rs index 6c22a0ed2..f76a2520b 100644 --- a/crates/c/src/lib.rs +++ b/crates/c/src/lib.rs @@ -7,8 +7,8 @@ use std::fmt::Write; use std::mem; use wit_bindgen_core::abi::{self, AbiVariant, Bindgen, Bitcast, Instruction, LiftLower, WasmType}; use wit_bindgen_core::{ - dealias, uwrite, uwriteln, wit_parser::*, Direction, Files, InterfaceGenerator as _, Ns, - WorldGenerator, + dealias, uwrite, uwriteln, wit_parser::*, AnonymousTypeGenerator, Direction, Files, + InterfaceGenerator as _, Ns, WorldGenerator, }; use wit_component::StringEncoding; @@ -1341,6 +1341,98 @@ void __wasm_export_{ns}_{snake}_dtor({ns}_{snake}_t* arg) {{ } } +impl<'a> wit_bindgen_core::AnonymousTypeGenerator<'a> for InterfaceGenerator<'a> { + fn resolve(&self) -> &'a Resolve { + self.resolve + } + + fn anonymous_type_handle(&mut self, id: TypeId, handle: &Handle, docs: &Docs) { + self.src.h_defs("\ntypedef "); + let resource = match handle { + Handle::Borrow(id) | Handle::Own(id) => id, + }; + let info = &self.gen.resources[&dealias(self.resolve, *resource)]; + match handle { + Handle::Borrow(_) => self.src.h_defs(&info.borrow), + Handle::Own(_) => self.src.h_defs(&info.own), + } + self.src.h_defs(" "); + self.print_typedef_target(id); + } + + fn anonymous_type_tuple(&mut self, id: TypeId, ty: &Tuple, docs: &Docs) { + self.src.h_defs("\ntypedef "); + self.src.h_defs("struct {\n"); + for (i, t) in ty.types.iter().enumerate() { + let ty = self.gen.type_name(t); + uwriteln!(self.src.h_defs, "{ty} f{i};"); + } + self.src.h_defs("}"); + self.src.h_defs(" "); + self.print_typedef_target(id); + } + + fn anonymous_type_option(&mut self, id: TypeId, ty: &Type, docs: &Docs) { + self.src.h_defs("\ntypedef "); + self.src.h_defs("struct {\n"); + self.src.h_defs("bool is_some;\n"); + let ty = self.gen.type_name(ty); + uwriteln!(self.src.h_defs, "{ty} val;"); + self.src.h_defs("}"); + self.src.h_defs(" "); + self.print_typedef_target(id); + } + + fn anonymous_type_result(&mut self, id: TypeId, ty: &Result_, docs: &Docs) { + self.src.h_defs("\ntypedef "); + self.src.h_defs( + "struct { + bool is_err; + ", + ); + let ok_ty = ty.ok.as_ref(); + let err_ty = ty.err.as_ref(); + if ok_ty.is_some() || err_ty.is_some() { + self.src.h_defs("union {\n"); + if let Some(ok) = ok_ty { + let ty = self.gen.type_name(ok); + uwriteln!(self.src.h_defs, "{ty} ok;"); + } + if let Some(err) = err_ty { + let ty = self.gen.type_name(err); + uwriteln!(self.src.h_defs, "{ty} err;"); + } + self.src.h_defs("} val;\n"); + } + self.src.h_defs("}"); + self.src.h_defs(" "); + self.print_typedef_target(id); + } + + fn anonymous_type_list(&mut self, id: TypeId, ty: &Type, docs: &Docs) { + self.src.h_defs("\ntypedef "); + self.src.h_defs("struct {\n"); + let ty = self.gen.type_name(ty); + uwriteln!(self.src.h_defs, "{ty} *ptr;"); + self.src.h_defs("size_t len;\n"); + self.src.h_defs("}"); + self.src.h_defs(" "); + self.print_typedef_target(id); + } + + fn anonymous_type_future(&mut self, id: TypeId, ty: &Option, docs: &Docs) { + todo!("print_anonymous_type for future"); + } + + fn anonymous_type_stream(&mut self, id: TypeId, ty: &Stream, docs: &Docs) { + todo!("print_anonymous_type for stream"); + } + + fn anonymous_typ_type(&mut self, id: TypeId, ty: &Type, docs: &Docs) { + todo!("print_anonymous_type for typ"); + } +} + pub enum CTypeNameInfo<'a> { Named { name: &'a str }, Anonymous { is_prim: bool }, @@ -1413,6 +1505,17 @@ impl InterfaceGenerator<'_> { continue; } + let kind = &self.resolve.types[ty].kind; + if let TypeDefKind::Handle(handle) = kind { + let resource = match handle { + Handle::Borrow(id) | Handle::Own(id) => id, + }; + let origin = dealias(self.resolve, *resource); + if origin == *resource { + continue; + } + } + self.define_anonymous_type(ty) } } @@ -1421,89 +1524,6 @@ impl InterfaceGenerator<'_> { } } - fn define_anonymous_type(&mut self, ty: TypeId) { - // skip `typedef handle_x handle_y` where `handle_x` is the same as `handle_y` - let kind = &self.resolve.types[ty].kind; - if let TypeDefKind::Handle(handle) = kind { - let resource = match handle { - Handle::Borrow(id) | Handle::Own(id) => id, - }; - let origin = dealias(self.resolve, *resource); - if origin == *resource { - return; - } - } - - self.src.h_defs("\ntypedef "); - let name = &self.gen.type_names[&ty]; - match kind { - TypeDefKind::Type(_) - | TypeDefKind::Flags(_) - | TypeDefKind::Record(_) - | TypeDefKind::Resource - | TypeDefKind::Enum(_) - | TypeDefKind::Variant(_) => { - unreachable!() - } - TypeDefKind::Handle(handle) => { - let resource = match handle { - Handle::Borrow(id) | Handle::Own(id) => id, - }; - let info = &self.gen.resources[&dealias(self.resolve, *resource)]; - match handle { - Handle::Borrow(_) => self.src.h_defs(&info.borrow), - Handle::Own(_) => self.src.h_defs(&info.own), - } - } - TypeDefKind::Tuple(t) => { - self.src.h_defs(&format!("struct {name} {{\n")); - for (i, t) in t.types.iter().enumerate() { - let ty = self.gen.type_name(t); - uwriteln!(self.src.h_defs, "{ty} f{i};"); - } - self.src.h_defs("}"); - } - TypeDefKind::Option(t) => { - self.src.h_defs(&format!("struct {name} {{\n")); - self.src.h_defs("bool is_some;\n"); - let ty = self.gen.type_name(t); - uwriteln!(self.src.h_defs, "{ty} val;"); - self.src.h_defs("}"); - } - TypeDefKind::Result(r) => { - self.src.h_defs(&format!("struct {name} {{\n")); - self.src.h_defs("bool is_err;\n"); - let ok_ty = r.ok.as_ref(); - let err_ty = r.err.as_ref(); - if ok_ty.is_some() || err_ty.is_some() { - self.src.h_defs("union {\n"); - if let Some(ok) = ok_ty { - let ty = self.gen.type_name(ok); - uwriteln!(self.src.h_defs, "{ty} ok;"); - } - if let Some(err) = err_ty { - let ty = self.gen.type_name(err); - uwriteln!(self.src.h_defs, "{ty} err;"); - } - self.src.h_defs("} val;\n"); - } - self.src.h_defs("}"); - } - TypeDefKind::List(t) => { - self.src.h_defs(&format!("struct {name} {{\n")); - let ty = self.gen.type_name(t); - uwriteln!(self.src.h_defs, "{ty} *ptr;"); - self.src.h_defs("size_t len;\n"); - self.src.h_defs("}"); - } - TypeDefKind::Future(_) => todo!("print_anonymous_type for future"), - TypeDefKind::Stream(_) => todo!("print_anonymous_type for stream"), - TypeDefKind::Unknown => unreachable!(), - } - self.src.h_defs(" "); - self.print_typedef_target(ty); - } - fn define_dtor(&mut self, id: TypeId) { let h_helpers_start = self.src.h_helpers.len(); let c_helpers_start = self.src.c_helpers.len(); diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs index 07ed228f0..773707d85 100644 --- a/crates/core/src/lib.rs +++ b/crates/core/src/lib.rs @@ -152,7 +152,6 @@ pub trait InterfaceGenerator<'a> { fn type_alias(&mut self, id: TypeId, name: &str, ty: &Type, docs: &Docs); fn type_list(&mut self, id: TypeId, name: &str, ty: &Type, docs: &Docs); fn type_builtin(&mut self, id: TypeId, name: &str, ty: &Type, docs: &Docs); - fn types(&mut self, iface: InterfaceId) { let iface = &self.resolve().interfaces[iface]; for (name, id) in iface.types.iter() { @@ -181,6 +180,41 @@ pub trait InterfaceGenerator<'a> { } } +pub trait AnonymousTypeGenerator<'a> { + fn resolve(&self) -> &'a Resolve; + + fn anonymous_type_handle(&mut self, id: TypeId, handle: &Handle, docs: &Docs); + fn anonymous_type_tuple(&mut self, id: TypeId, ty: &Tuple, docs: &Docs); + fn anonymous_type_option(&mut self, id: TypeId, ty: &Type, docs: &Docs); + fn anonymous_type_result(&mut self, id: TypeId, ty: &Result_, docs: &Docs); + fn anonymous_type_list(&mut self, id: TypeId, ty: &Type, docs: &Docs); + fn anonymous_type_future(&mut self, id: TypeId, ty: &Option, docs: &Docs); + fn anonymous_type_stream(&mut self, id: TypeId, ty: &Stream, docs: &Docs); + fn anonymous_typ_type(&mut self, id: TypeId, ty: &Type, docs: &Docs); + + fn define_anonymous_type(&mut self, id: TypeId) { + let ty = &self.resolve().types[id]; + match &ty.kind { + TypeDefKind::Flags(_) + | TypeDefKind::Record(_) + | TypeDefKind::Resource + | TypeDefKind::Enum(_) + | TypeDefKind::Variant(_) => { + unreachable!() + } + TypeDefKind::Type(t) => self.anonymous_typ_type(id, t, &ty.docs), + TypeDefKind::Tuple(tuple) => self.anonymous_type_tuple(id, tuple, &ty.docs), + TypeDefKind::Option(t) => self.anonymous_type_option(id, t, &ty.docs), + TypeDefKind::Result(r) => self.anonymous_type_result(id, r, &ty.docs), + TypeDefKind::List(t) => self.anonymous_type_list(id, t, &ty.docs), + TypeDefKind::Future(f) => self.anonymous_type_future(id, f, &ty.docs), + TypeDefKind::Stream(s) => self.anonymous_type_stream(id, s, &ty.docs), + TypeDefKind::Handle(handle) => self.anonymous_type_handle(id, handle, &ty.docs), + TypeDefKind::Unknown => unreachable!(), + } + } +} + pub fn generated_preamble(src: &mut Source, version: &str) { uwriteln!(src, "// Generated by `wit-bindgen` {version}. DO NOT EDIT!") } diff --git a/crates/rust/src/interface.rs b/crates/rust/src/interface.rs index 69407f760..73e7cdcc4 100644 --- a/crates/rust/src/interface.rs +++ b/crates/rust/src/interface.rs @@ -9,7 +9,9 @@ use std::collections::{BTreeMap, BTreeSet}; use std::fmt::Write as _; use std::mem; use wit_bindgen_core::abi::{self, AbiVariant, LiftLower}; -use wit_bindgen_core::{dealias, uwrite, uwriteln, wit_parser::*, Source, TypeInfo}; +use wit_bindgen_core::{ + dealias, uwrite, uwriteln, wit_parser::*, AnonymousTypeGenerator, Source, TypeInfo, +}; pub struct InterfaceGenerator<'a> { pub src: Source, @@ -1198,97 +1200,12 @@ macro_rules! {macro_name} {{ return; } - match &ty.kind { - TypeDefKind::List(t) => self.print_list(t, mode), - - TypeDefKind::Option(t) => { - self.push_str("Option<"); - let mode = self.filter_mode_preserve_top(t, mode); - self.print_ty(t, mode); - self.push_str(">"); - } - - TypeDefKind::Result(r) => { - self.push_str("Result<"); - self.print_optional_ty(r.ok.as_ref(), mode); - self.push_str(","); - self.print_optional_ty(r.err.as_ref(), mode); - self.push_str(">"); - } - - TypeDefKind::Variant(_) => panic!("unsupported anonymous variant"), - - // Tuple-like records are mapped directly to Rust tuples of - // types. Note the trailing comma after each member to - // appropriately handle 1-tuples. - TypeDefKind::Tuple(t) => { - self.push_str("("); - for ty in t.types.iter() { - let mode = self.filter_mode_preserve_top(ty, mode); - self.print_ty(ty, mode); - self.push_str(","); - } - self.push_str(")"); - } - TypeDefKind::Resource => { - panic!("unsupported anonymous type reference: resource") - } - TypeDefKind::Record(_) => { - panic!("unsupported anonymous type reference: record") - } - TypeDefKind::Flags(_) => { - panic!("unsupported anonymous type reference: flags") - } - 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::Handle(Handle::Own(ty)) => { - self.print_ty(&Type::Id(*ty), mode); - } - - TypeDefKind::Handle(Handle::Borrow(ty)) => { - assert!(mode.lifetime.is_some()); - let lt = mode.lifetime.unwrap(); - if self.is_exported_resource(*ty) { - let camel = self.resolve.types[*ty] - .name - .as_deref() - .unwrap() - .to_upper_camel_case(); - let name = format!("{camel}Borrow"); - self.push_str(&self.type_path_with_name(*ty, name)); - self.push_str("<"); - self.push_str(lt); - self.push_str(">"); - } else { - self.push_str("&"); - if lt != "'_" { - self.push_str(lt); - self.push_str(" "); - } - let ty = &Type::Id(*ty); - let mode = self.filter_mode(ty, mode); - self.print_ty(ty, mode); - } - } - - TypeDefKind::Type(t) => self.print_ty(t, mode), - - TypeDefKind::Unknown => unreachable!(), - } + let mut anonymous_type_gen = AnonTypeGenerator { + mode, + resolve: self.resolve, + interface: self, + }; + anonymous_type_gen.define_anonymous_type(id); } fn print_list(&mut self, ty: &Type, mode: TypeMode) { @@ -2259,3 +2176,98 @@ impl<'a> {camel}Borrow<'a>{{ self.src.push_str(";\n"); } } + +struct AnonTypeGenerator<'a, 'b> { + mode: TypeMode, + resolve: &'a Resolve, + interface: &'a mut InterfaceGenerator<'b>, +} + +impl<'a, 'b> wit_bindgen_core::AnonymousTypeGenerator<'a> for AnonTypeGenerator<'a, 'b> { + fn resolve(&self) -> &'a Resolve { + self.resolve + } + + fn anonymous_typ_type(&mut self, id: TypeId, ty: &Type, docs: &Docs) { + self.interface.print_ty(ty, self.mode); + } + + fn anonymous_type_handle(&mut self, id: TypeId, handle: &Handle, docs: &Docs) { + match handle { + Handle::Own(ty) => { + self.interface.print_ty(&Type::Id(*ty), self.mode); + } + Handle::Borrow(ty) => { + assert!(self.mode.lifetime.is_some()); + let lt = self.mode.lifetime.unwrap(); + if self.interface.is_exported_resource(*ty) { + let camel = self.resolve.types[*ty] + .name + .as_deref() + .unwrap() + .to_upper_camel_case(); + let name = format!("{camel}Borrow"); + self.interface + .push_str(&self.interface.type_path_with_name(*ty, name)); + self.interface.push_str("<"); + self.interface.push_str(lt); + self.interface.push_str(">"); + } else { + self.interface.push_str("&"); + if lt != "'_" { + self.interface.push_str(lt); + self.interface.push_str(" "); + } + let ty = &Type::Id(*ty); + let mode = self.interface.filter_mode(ty, self.mode); + self.interface.print_ty(ty, mode); + } + } + } + } + + fn anonymous_type_tuple(&mut self, id: TypeId, ty: &Tuple, docs: &Docs) { + self.interface.push_str("("); + for ty in ty.types.iter() { + let mode = self.interface.filter_mode_preserve_top(ty, self.mode); + self.interface.print_ty(ty, mode); + self.interface.push_str(","); + } + self.interface.push_str(")"); + } + + fn anonymous_type_option(&mut self, id: TypeId, t: &Type, docs: &Docs) { + self.interface.push_str("Option<"); + let mode = self.interface.filter_mode_preserve_top(t, self.mode); + self.interface.print_ty(t, mode); + self.interface.push_str(">"); + } + + fn anonymous_type_result(&mut self, id: TypeId, r: &Result_, docs: &Docs) { + self.interface.push_str("Result<"); + self.interface.print_optional_ty(r.ok.as_ref(), self.mode); + self.interface.push_str(","); + self.interface.print_optional_ty(r.err.as_ref(), self.mode); + self.interface.push_str(">"); + } + + fn anonymous_type_list(&mut self, id: TypeId, ty: &Type, docs: &Docs) { + self.interface.print_list(ty, self.mode) + } + + fn anonymous_type_future(&mut self, id: TypeId, ty: &Option, docs: &Docs) { + self.interface.push_str("Future<"); + self.interface.print_optional_ty(ty.as_ref(), self.mode); + self.interface.push_str(">"); + } + + fn anonymous_type_stream(&mut self, id: TypeId, stream: &Stream, docs: &Docs) { + self.interface.push_str("Stream<"); + self.interface + .print_optional_ty(stream.element.as_ref(), self.mode); + self.interface.push_str(","); + self.interface + .print_optional_ty(stream.end.as_ref(), self.mode); + self.interface.push_str(">"); + } +} From f2b916acbaa0e61789239a0b41420390c3cb01d8 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 20 May 2024 12:25:43 -0500 Subject: [PATCH 2/3] Update wasm-tools dependencies (#951) --- Cargo.lock | 64 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 10 ++++----- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4c4739f03..7ea71c465 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1403,10 +1403,10 @@ name = "test-helpers" version = "0.0.0" dependencies = [ "codegen-macro", - "wasm-encoder 0.207.0", + "wasm-encoder 0.208.0", "wit-bindgen-core", "wit-component", - "wit-parser 0.207.0", + "wit-parser 0.208.0", ] [[package]] @@ -1681,18 +1681,18 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.207.0" +version = "0.208.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d996306fb3aeaee0d9157adbe2f670df0236caf19f6728b221e92d0f27b3fe17" +checksum = "bbc0fb39838056aeb096b2e7dd94bb2f0c2df3c9fb4d1055f2cb3c35c286ee71" dependencies = [ "leb128", ] [[package]] name = "wasm-metadata" -version = "0.207.0" +version = "0.208.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2c44e62d325ce9253f88c01f0f67be121356767d12f2f13e701fdcd99e1f5b0" +checksum = "0477c12795d0de6243d03e0101e6a21b24a5f2f350f2e2bf9c80da274e68d243" dependencies = [ "anyhow", "indexmap", @@ -1700,8 +1700,8 @@ dependencies = [ "serde_derive", "serde_json", "spdx", - "wasm-encoder 0.207.0", - "wasmparser 0.207.0", + "wasm-encoder 0.208.0", + "wasmparser 0.208.0", ] [[package]] @@ -1717,9 +1717,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.207.0" +version = "0.208.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e19bb9f8ab07616da582ef8adb24c54f1424c7ec876720b7da9db8ec0626c92c" +checksum = "5d20bf2b2d07ec86bab7a05ae4e3a290e5b333319cd73253bc79bfedb6c59c83" dependencies = [ "ahash", "bitflags 2.5.0", @@ -2053,24 +2053,24 @@ dependencies = [ [[package]] name = "wast" -version = "207.0.0" +version = "208.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e40be9fd494bfa501309487d2dc0b3f229be6842464ecbdc54eac2679c84c93" +checksum = "0450a853119b35441264ca99bd90be37d6f85f99decc4d993795ad396ed56b97" dependencies = [ "bumpalo", "leb128", "memchr", "unicode-width", - "wasm-encoder 0.207.0", + "wasm-encoder 0.208.0", ] [[package]] name = "wat" -version = "1.207.0" +version = "1.208.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb2b15e2d5f300f5e1209e7dc237f2549edbd4203655b6c6cab5cf180561ee7" +checksum = "72fd5b4d1e1fb745f2eb6e8004563ffbf0858681c11a79f4ec663ee31907080d" dependencies = [ - "wast 207.0.0", + "wast 208.0.0", ] [[package]] @@ -2330,11 +2330,11 @@ dependencies = [ "clap", "heck 0.5.0", "test-helpers", - "wasm-encoder 0.207.0", + "wasm-encoder 0.208.0", "wasm-metadata", "wit-bindgen-core", "wit-component", - "wit-parser 0.207.0", + "wit-parser 0.208.0", ] [[package]] @@ -2345,8 +2345,8 @@ dependencies = [ "clap", "heck 0.5.0", "test-artifacts", - "wasm-encoder 0.207.0", - "wasmparser 0.207.0", + "wasm-encoder 0.208.0", + "wasmparser 0.208.0", "wasmtime", "wasmtime-wasi", "wit-bindgen-c", @@ -2357,7 +2357,7 @@ dependencies = [ "wit-bindgen-rust", "wit-bindgen-teavm-java", "wit-component", - "wit-parser 0.207.0", + "wit-parser 0.208.0", ] [[package]] @@ -2366,7 +2366,7 @@ version = "0.24.0" dependencies = [ "anyhow", "heck 0.5.0", - "wit-parser 0.207.0", + "wit-parser 0.208.0", ] [[package]] @@ -2378,9 +2378,9 @@ dependencies = [ "heck 0.5.0", "indexmap", "test-helpers", - "wasm-encoder 0.207.0", + "wasm-encoder 0.208.0", "wasm-metadata", - "wasmparser 0.207.0", + "wasmparser 0.208.0", "wit-bindgen-core", "wit-component", ] @@ -2460,9 +2460,9 @@ dependencies = [ [[package]] name = "wit-component" -version = "0.207.0" +version = "0.208.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a411ff9c471737091b2c1a738a25031029fc4d0b8f1a60bef0e68906e9f6534b" +checksum = "ad0397074e61e235635133f1301d1808545e4cb2701d117dc2aca128e65168ae" dependencies = [ "anyhow", "bitflags 2.5.0", @@ -2471,11 +2471,11 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "wasm-encoder 0.207.0", + "wasm-encoder 0.208.0", "wasm-metadata", - "wasmparser 0.207.0", + "wasmparser 0.208.0", "wat", - "wit-parser 0.207.0", + "wit-parser 0.208.0", ] [[package]] @@ -2498,9 +2498,9 @@ dependencies = [ [[package]] name = "wit-parser" -version = "0.207.0" +version = "0.208.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c83dab33a9618d86cfe3563cc864deffd08c17efc5db31a3b7cd1edeffe6e1" +checksum = "27e6bf94e83a0633ae1790912fbe3a97c2fd1ea7956fc58be18aa03517b1b887" dependencies = [ "anyhow", "id-arena", @@ -2511,7 +2511,7 @@ dependencies = [ "serde_derive", "serde_json", "unicode-xid", - "wasmparser 0.207.0", + "wasmparser 0.208.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index fa0c7641b..4c96fcb03 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,11 +28,11 @@ pulldown-cmark = { version = "0.9", default-features = false } clap = { version = "4.3.19", features = ["derive"] } indexmap = "2.0.0" -wasmparser = "0.207.0" -wasm-encoder = "0.207.0" -wasm-metadata = "0.207.0" -wit-parser = "0.207.0" -wit-component = "0.207.0" +wasmparser = "0.208.0" +wasm-encoder = "0.208.0" +wasm-metadata = "0.208.0" +wit-parser = "0.208.0" +wit-component = "0.208.0" wit-bindgen-core = { path = 'crates/core', version = '0.24.0' } wit-bindgen-c = { path = 'crates/c', version = '0.24.0' } From 9b50b8e78940af080ed3b7c0238e11b04a4bd17b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 12:38:56 -0500 Subject: [PATCH 3/3] Release wit-bindgen 0.25.0 (#952) [automatically-tag-and-release-this-commit] Co-authored-by: Auto Release Process --- Cargo.lock | 22 +++++++++--------- Cargo.toml | 18 +++++++------- crates/core/Cargo.toml | 2 +- crates/guest-rust/Cargo.toml | 4 ++-- crates/guest-rust/rt/src/cabi_realloc.c | 4 ++-- crates/guest-rust/rt/src/cabi_realloc.o | Bin 261 -> 261 bytes crates/guest-rust/rt/src/cabi_realloc.rs | 2 +- .../rt/src/libwit_bindgen_cabi_realloc.a | Bin 412 -> 412 bytes 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7ea71c465..084086534 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2316,7 +2316,7 @@ dependencies = [ [[package]] name = "wit-bindgen" -version = "0.24.0" +version = "0.25.0" dependencies = [ "wit-bindgen-rt", "wit-bindgen-rust-macro", @@ -2324,7 +2324,7 @@ dependencies = [ [[package]] name = "wit-bindgen-c" -version = "0.24.0" +version = "0.25.0" dependencies = [ "anyhow", "clap", @@ -2339,7 +2339,7 @@ dependencies = [ [[package]] name = "wit-bindgen-cli" -version = "0.24.0" +version = "0.25.0" dependencies = [ "anyhow", "clap", @@ -2362,7 +2362,7 @@ dependencies = [ [[package]] name = "wit-bindgen-core" -version = "0.24.0" +version = "0.25.0" dependencies = [ "anyhow", "heck 0.5.0", @@ -2371,7 +2371,7 @@ dependencies = [ [[package]] name = "wit-bindgen-csharp" -version = "0.24.0" +version = "0.25.0" dependencies = [ "anyhow", "clap", @@ -2387,7 +2387,7 @@ dependencies = [ [[package]] name = "wit-bindgen-go" -version = "0.24.0" +version = "0.25.0" dependencies = [ "anyhow", "clap", @@ -2399,7 +2399,7 @@ dependencies = [ [[package]] name = "wit-bindgen-markdown" -version = "0.24.0" +version = "0.25.0" dependencies = [ "anyhow", "clap", @@ -2411,14 +2411,14 @@ dependencies = [ [[package]] name = "wit-bindgen-rt" -version = "0.24.0" +version = "0.25.0" dependencies = [ "bitflags 2.5.0", ] [[package]] name = "wit-bindgen-rust" -version = "0.24.0" +version = "0.25.0" dependencies = [ "anyhow", "clap", @@ -2435,7 +2435,7 @@ dependencies = [ [[package]] name = "wit-bindgen-rust-macro" -version = "0.24.0" +version = "0.25.0" dependencies = [ "anyhow", "proc-macro2", @@ -2447,7 +2447,7 @@ dependencies = [ [[package]] name = "wit-bindgen-teavm-java" -version = "0.24.0" +version = "0.25.0" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index 4c96fcb03..e67db8d76 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ resolver = "2" [workspace.package] edition = "2021" -version = "0.24.0" +version = "0.25.0" [workspace.dependencies] anyhow = "1.0.72" @@ -34,14 +34,14 @@ wasm-metadata = "0.208.0" wit-parser = "0.208.0" wit-component = "0.208.0" -wit-bindgen-core = { path = 'crates/core', version = '0.24.0' } -wit-bindgen-c = { path = 'crates/c', version = '0.24.0' } -wit-bindgen-rust = { path = "crates/rust", version = "0.24.0" } -wit-bindgen-teavm-java = { path = 'crates/teavm-java', version = '0.24.0' } -wit-bindgen-go = { path = 'crates/go', version = '0.24.0' } -wit-bindgen-csharp = { path = 'crates/csharp', version = '0.24.0' } -wit-bindgen-markdown = { path = 'crates/markdown', version = '0.24.0' } -wit-bindgen = { path = 'crates/guest-rust', version = '0.24.0', default-features = false } +wit-bindgen-core = { path = 'crates/core', version = '0.25.0' } +wit-bindgen-c = { path = 'crates/c', version = '0.25.0' } +wit-bindgen-rust = { path = "crates/rust", version = "0.25.0" } +wit-bindgen-teavm-java = { path = 'crates/teavm-java', version = '0.25.0' } +wit-bindgen-go = { path = 'crates/go', version = '0.25.0' } +wit-bindgen-csharp = { path = 'crates/csharp', version = '0.25.0' } +wit-bindgen-markdown = { path = 'crates/markdown', version = '0.25.0' } +wit-bindgen = { path = 'crates/guest-rust', version = '0.25.0', default-features = false } [[bin]] name = "wit-bindgen" diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index ffb3d5149..209f2be29 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -17,4 +17,4 @@ doctest = false [dependencies] wit-parser = { workspace = true } anyhow = { workspace = true } -heck = { workspace = true } \ No newline at end of file +heck = { workspace = true } diff --git a/crates/guest-rust/Cargo.toml b/crates/guest-rust/Cargo.toml index aba955e9c..2101bba50 100644 --- a/crates/guest-rust/Cargo.toml +++ b/crates/guest-rust/Cargo.toml @@ -12,8 +12,8 @@ Used when compiling Rust programs to the component model. """ [dependencies] -wit-bindgen-rust-macro = { path = "./macro", optional = true, version = "0.24.0" } -wit-bindgen-rt = { path = "./rt", version = "0.24.0", features = ["bitflags"] } +wit-bindgen-rust-macro = { path = "./macro", optional = true, version = "0.25.0" } +wit-bindgen-rt = { path = "./rt", version = "0.25.0", features = ["bitflags"] } [features] default = ["macros", "realloc"] diff --git a/crates/guest-rust/rt/src/cabi_realloc.c b/crates/guest-rust/rt/src/cabi_realloc.c index d3931ce3e..30f906650 100644 --- a/crates/guest-rust/rt/src/cabi_realloc.c +++ b/crates/guest-rust/rt/src/cabi_realloc.c @@ -2,9 +2,9 @@ #include -extern void *cabi_realloc_wit_bindgen_0_24_0(void *ptr, size_t old_size, size_t align, size_t new_size); +extern void *cabi_realloc_wit_bindgen_0_25_0(void *ptr, size_t old_size, size_t align, size_t new_size); __attribute__((__weak__, __export_name__("cabi_realloc"))) void *cabi_realloc(void *ptr, size_t old_size, size_t align, size_t new_size) { - return cabi_realloc_wit_bindgen_0_24_0(ptr, old_size, align, new_size); + return cabi_realloc_wit_bindgen_0_25_0(ptr, old_size, align, new_size); } diff --git a/crates/guest-rust/rt/src/cabi_realloc.o b/crates/guest-rust/rt/src/cabi_realloc.o index b5d7bd0fc04909aa54ce42b1b1d7f9218a9fa3f5..86f3e4fbfa8ac08229405bc262685f88be661fea 100644 GIT binary patch delta 11 ScmZo=YGs<>$7njye;WW4Hv_o< delta 11 ScmZo=YGs<>$7nLqe;WW4GXuB) diff --git a/crates/guest-rust/rt/src/cabi_realloc.rs b/crates/guest-rust/rt/src/cabi_realloc.rs index 91dad5f8e..5af6bf491 100644 --- a/crates/guest-rust/rt/src/cabi_realloc.rs +++ b/crates/guest-rust/rt/src/cabi_realloc.rs @@ -1,7 +1,7 @@ // This file is generated by ./ci/rebuild-libcabi-realloc.sh #[no_mangle] -pub unsafe extern "C" fn cabi_realloc_wit_bindgen_0_24_0( +pub unsafe extern "C" fn cabi_realloc_wit_bindgen_0_25_0( old_ptr: *mut u8, old_len: usize, align: usize, diff --git a/crates/guest-rust/rt/src/libwit_bindgen_cabi_realloc.a b/crates/guest-rust/rt/src/libwit_bindgen_cabi_realloc.a index 9bb3385d8d5ab37cd19b0eedb828ca5ccb032f7f..6e3befd97d8211ce037d47775727dded38c2b7d5 100644 GIT binary patch delta 11 TcmbQkJcoJ06GqdCPqzaA8pZ_{ delta 11 TcmbQkJcoJ06GoGXPqzaA8o~t?