From c85e9389ee06f757f3358c22bdae4697f6b402e7 Mon Sep 17 00:00:00 2001 From: Nuke Date: Mon, 29 Apr 2024 18:35:54 -0600 Subject: [PATCH 1/2] Update to wit-bindgen-rt 0.23.0 --- .../examples/tutorial/adder/Cargo.lock | 7 ++++-- .../examples/tutorial/adder/Cargo.toml | 2 +- .../examples/tutorial/adder/src/bindings.rs | 20 ++++++++++++----- .../examples/tutorial/calculator/Cargo.lock | 7 ++++-- .../examples/tutorial/calculator/Cargo.toml | 2 +- .../tutorial/calculator/src/bindings.rs | 22 ++++++++++++++----- .../examples/tutorial/command/Cargo.lock | 7 ++++-- .../examples/tutorial/command/Cargo.toml | 2 +- .../examples/tutorial/command/src/bindings.rs | 12 +++++----- 9 files changed, 57 insertions(+), 24 deletions(-) diff --git a/component-model/examples/tutorial/adder/Cargo.lock b/component-model/examples/tutorial/adder/Cargo.lock index aedbf23..b6115e7 100644 --- a/component-model/examples/tutorial/adder/Cargo.lock +++ b/component-model/examples/tutorial/adder/Cargo.lock @@ -18,6 +18,9 @@ checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "wit-bindgen-rt" -version = "0.20.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "781989c70b3300b1be7ffbc7095e3b56c4f208f0c109cb5d1d943b297918dd8a" +checksum = "d6ccd4c6a69667c75474ddb30c36773c5e70cdca099ec2e293005458886ac81b" +dependencies = [ + "bitflags", +] diff --git a/component-model/examples/tutorial/adder/Cargo.toml b/component-model/examples/tutorial/adder/Cargo.toml index a7d91dd..1f51a60 100644 --- a/component-model/examples/tutorial/adder/Cargo.toml +++ b/component-model/examples/tutorial/adder/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] bitflags = "2.4.2" -wit-bindgen-rt = "0.20.0" +wit-bindgen-rt = { version = "0.23.0", features = ["bitflags"] } [lib] crate-type = ["cdylib"] diff --git a/component-model/examples/tutorial/adder/src/bindings.rs b/component-model/examples/tutorial/adder/src/bindings.rs index bc59a35..d991f90 100644 --- a/component-model/examples/tutorial/adder/src/bindings.rs +++ b/component-model/examples/tutorial/adder/src/bindings.rs @@ -1,9 +1,12 @@ -// Generated by `wit-bindgen` 0.21.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.24.0. DO NOT EDIT! // Options used: +#[allow(dead_code)] pub mod exports { + #[allow(dead_code)] pub mod docs { + #[allow(dead_code)] pub mod calculator { - #[allow(clippy::all)] + #[allow(dead_code, clippy::all)] pub mod add { #[used] #[doc(hidden)] @@ -14,6 +17,8 @@ pub mod exports { #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_add_cabi(arg0: i32, arg1: i32) -> i32 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); let result0 = T::add(arg0 as u32, arg1 as u32); _rt::as_i32(result0) } @@ -39,6 +44,11 @@ pub mod exports { } mod _rt { + #[cfg(target_arch = "wasm32")] + pub fn run_ctors_once() { + wit_bindgen_rt::run_ctors_once(); + } + pub fn as_i32(t: T) -> i32 { t.as_i32() } @@ -139,14 +149,14 @@ macro_rules! __export_adder_impl { pub(crate) use __export_adder_impl as export; #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:wit-bindgen:0.21.0:adder:encoded world"] +#[link_section = "component-type:wit-bindgen:0.24.0:adder:encoded world"] #[doc(hidden)] pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 213] = *b"\ \0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07Z\x01A\x02\x01A\x02\x01\ B\x02\x01@\x02\x01ay\x01by\0y\x04\0\x03add\x01\0\x04\x01\x19docs:calculator/add@\ 0.1.0\x05\0\x04\x01\x1bdocs:calculator/adder@0.1.0\x04\0\x0b\x0b\x01\0\x05adder\x03\ -\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.201.0\x10wit-\ -bindgen-rust\x060.21.0"; +\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.202.0\x10wit-\ +bindgen-rust\x060.24.0"; #[inline(never)] #[doc(hidden)] diff --git a/component-model/examples/tutorial/calculator/Cargo.lock b/component-model/examples/tutorial/calculator/Cargo.lock index b25a9f1..7e73edd 100644 --- a/component-model/examples/tutorial/calculator/Cargo.lock +++ b/component-model/examples/tutorial/calculator/Cargo.lock @@ -18,6 +18,9 @@ dependencies = [ [[package]] name = "wit-bindgen-rt" -version = "0.20.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "781989c70b3300b1be7ffbc7095e3b56c4f208f0c109cb5d1d943b297918dd8a" +checksum = "d6ccd4c6a69667c75474ddb30c36773c5e70cdca099ec2e293005458886ac81b" +dependencies = [ + "bitflags", +] diff --git a/component-model/examples/tutorial/calculator/Cargo.toml b/component-model/examples/tutorial/calculator/Cargo.toml index 0d412b0..c32c55d 100644 --- a/component-model/examples/tutorial/calculator/Cargo.toml +++ b/component-model/examples/tutorial/calculator/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] bitflags = "2.4.2" -wit-bindgen-rt = "0.20.0" +wit-bindgen-rt = { version = "0.23.0", features = ["bitflags"] } [lib] crate-type = ["cdylib"] diff --git a/component-model/examples/tutorial/calculator/src/bindings.rs b/component-model/examples/tutorial/calculator/src/bindings.rs index c17b39f..94b1483 100644 --- a/component-model/examples/tutorial/calculator/src/bindings.rs +++ b/component-model/examples/tutorial/calculator/src/bindings.rs @@ -1,8 +1,10 @@ -// Generated by `wit-bindgen` 0.21.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.24.0. DO NOT EDIT! // Options used: +#[allow(dead_code)] pub mod docs { + #[allow(dead_code)] pub mod calculator { - #[allow(clippy::all)] + #[allow(dead_code, clippy::all)] pub mod add { #[used] #[doc(hidden)] @@ -31,10 +33,13 @@ pub mod docs { } } } +#[allow(dead_code)] pub mod exports { + #[allow(dead_code)] pub mod docs { + #[allow(dead_code)] pub mod calculator { - #[allow(clippy::all)] + #[allow(dead_code, clippy::all)] pub mod calculate { #[used] #[doc(hidden)] @@ -76,6 +81,8 @@ pub mod exports { arg1: i32, arg2: i32, ) -> i32 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); let result0 = T::eval_expression(Op::_lift(arg0 as u8), arg1 as u32, arg2 as u32); _rt::as_i32(result0) @@ -171,6 +178,11 @@ mod _rt { self as i32 } } + + #[cfg(target_arch = "wasm32")] + pub fn run_ctors_once() { + wit_bindgen_rt::run_ctors_once(); + } } /// Generates `#[no_mangle]` functions to export the specified type as the @@ -202,7 +214,7 @@ macro_rules! __export_calculator_impl { pub(crate) use __export_calculator_impl as export; #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:wit-bindgen:0.21.0:calculator:encoded world"] +#[link_section = "component-type:wit-bindgen:0.24.0:calculator:encoded world"] #[doc(hidden)] pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 313] = *b"\ \0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xb8\x01\x01A\x02\x01\ @@ -211,7 +223,7 @@ ator/add@0.1.0\x05\0\x01B\x04\x01m\x01\x03add\x04\0\x02op\x03\0\0\x01@\x03\x02op \x01\x01xy\x01yy\0y\x04\0\x0feval-expression\x01\x02\x04\x01\x1fdocs:calculator/\ calculate@0.1.0\x05\x01\x04\x01\x20docs:calculator/calculator@0.1.0\x04\0\x0b\x10\ \x01\0\x0acalculator\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-comp\ -onent\x070.201.0\x10wit-bindgen-rust\x060.21.0"; +onent\x070.202.0\x10wit-bindgen-rust\x060.24.0"; #[inline(never)] #[doc(hidden)] diff --git a/component-model/examples/tutorial/command/Cargo.lock b/component-model/examples/tutorial/command/Cargo.lock index add3b6f..a407106 100644 --- a/component-model/examples/tutorial/command/Cargo.lock +++ b/component-model/examples/tutorial/command/Cargo.lock @@ -239,6 +239,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "wit-bindgen-rt" -version = "0.20.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "781989c70b3300b1be7ffbc7095e3b56c4f208f0c109cb5d1d943b297918dd8a" +checksum = "d6ccd4c6a69667c75474ddb30c36773c5e70cdca099ec2e293005458886ac81b" +dependencies = [ + "bitflags", +] diff --git a/component-model/examples/tutorial/command/Cargo.toml b/component-model/examples/tutorial/command/Cargo.toml index dbc3dd5..d015eab 100644 --- a/component-model/examples/tutorial/command/Cargo.toml +++ b/component-model/examples/tutorial/command/Cargo.toml @@ -14,4 +14,4 @@ world = "app" anyhow = "1" clap = { version = "4.3.19", features = ["derive"] } bitflags = "2.4.2" -wit-bindgen-rt = "0.20.0" +wit-bindgen-rt = { version = "0.23.0", features = ["bitflags"] } diff --git a/component-model/examples/tutorial/command/src/bindings.rs b/component-model/examples/tutorial/command/src/bindings.rs index d006fc9..1dbe7d8 100644 --- a/component-model/examples/tutorial/command/src/bindings.rs +++ b/component-model/examples/tutorial/command/src/bindings.rs @@ -1,8 +1,10 @@ -// Generated by `wit-bindgen` 0.21.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.24.0. DO NOT EDIT! // Options used: +#[allow(dead_code)] pub mod docs { + #[allow(dead_code)] pub mod calculator { - #[allow(clippy::all)] + #[allow(dead_code, clippy::all)] pub mod calculate { #[used] #[doc(hidden)] @@ -132,15 +134,15 @@ mod _rt { } #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:wit-bindgen:0.21.0:app:encoded world"] +#[link_section = "component-type:wit-bindgen:0.24.0:app:encoded world"] #[doc(hidden)] pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 246] = *b"\ \0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07}\x01A\x02\x01A\x02\x01\ B\x04\x01m\x01\x03add\x04\0\x02op\x03\0\0\x01@\x03\x02op\x01\x01xy\x01yy\0y\x04\0\ \x0feval-expression\x01\x02\x03\x01\x1fdocs:calculator/calculate@0.1.0\x05\0\x04\ \x01\x19docs:calculator/app@0.1.0\x04\0\x0b\x09\x01\0\x03app\x03\0\0\0G\x09produ\ -cers\x01\x0cprocessed-by\x02\x0dwit-component\x070.201.0\x10wit-bindgen-rust\x06\ -0.21.0"; +cers\x01\x0cprocessed-by\x02\x0dwit-component\x070.202.0\x10wit-bindgen-rust\x06\ +0.24.0"; #[inline(never)] #[doc(hidden)] From ae223be3e977316c753817958e696e0582d1d0b7 Mon Sep 17 00:00:00 2001 From: Dan Shields Date: Thu, 2 May 2024 14:41:42 -0500 Subject: [PATCH 2/2] update to use wit-bindgen-rt-0.24.0 -- https://github.com/bytecodealliance/cargo-component/pull/283 --- component-model/examples/tutorial/adder/Cargo.lock | 4 ++-- component-model/examples/tutorial/adder/Cargo.toml | 2 +- component-model/examples/tutorial/calculator/Cargo.lock | 8 ++++---- component-model/examples/tutorial/calculator/Cargo.toml | 2 +- component-model/examples/tutorial/command/Cargo.lock | 4 ++-- component-model/examples/tutorial/command/Cargo.toml | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/component-model/examples/tutorial/adder/Cargo.lock b/component-model/examples/tutorial/adder/Cargo.lock index b6115e7..2b32d89 100644 --- a/component-model/examples/tutorial/adder/Cargo.lock +++ b/component-model/examples/tutorial/adder/Cargo.lock @@ -18,9 +18,9 @@ checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "wit-bindgen-rt" -version = "0.23.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ccd4c6a69667c75474ddb30c36773c5e70cdca099ec2e293005458886ac81b" +checksum = "3b0780cf7046630ed70f689a098cd8d56c5c3b22f2a7379bbdb088879963ff96" dependencies = [ "bitflags", ] diff --git a/component-model/examples/tutorial/adder/Cargo.toml b/component-model/examples/tutorial/adder/Cargo.toml index 1f51a60..a6dfd29 100644 --- a/component-model/examples/tutorial/adder/Cargo.toml +++ b/component-model/examples/tutorial/adder/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] bitflags = "2.4.2" -wit-bindgen-rt = { version = "0.23.0", features = ["bitflags"] } +wit-bindgen-rt = { version = "0.24.0", features = ["bitflags"] } [lib] crate-type = ["cdylib"] diff --git a/component-model/examples/tutorial/calculator/Cargo.lock b/component-model/examples/tutorial/calculator/Cargo.lock index 7e73edd..3b6c9fd 100644 --- a/component-model/examples/tutorial/calculator/Cargo.lock +++ b/component-model/examples/tutorial/calculator/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "calculator" @@ -18,9 +18,9 @@ dependencies = [ [[package]] name = "wit-bindgen-rt" -version = "0.23.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ccd4c6a69667c75474ddb30c36773c5e70cdca099ec2e293005458886ac81b" +checksum = "3b0780cf7046630ed70f689a098cd8d56c5c3b22f2a7379bbdb088879963ff96" dependencies = [ "bitflags", ] diff --git a/component-model/examples/tutorial/calculator/Cargo.toml b/component-model/examples/tutorial/calculator/Cargo.toml index c32c55d..762844f 100644 --- a/component-model/examples/tutorial/calculator/Cargo.toml +++ b/component-model/examples/tutorial/calculator/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] bitflags = "2.4.2" -wit-bindgen-rt = { version = "0.23.0", features = ["bitflags"] } +wit-bindgen-rt = { version = "0.24.0", features = ["bitflags"] } [lib] crate-type = ["cdylib"] diff --git a/component-model/examples/tutorial/command/Cargo.lock b/component-model/examples/tutorial/command/Cargo.lock index a407106..5e091db 100644 --- a/component-model/examples/tutorial/command/Cargo.lock +++ b/component-model/examples/tutorial/command/Cargo.lock @@ -239,9 +239,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "wit-bindgen-rt" -version = "0.23.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ccd4c6a69667c75474ddb30c36773c5e70cdca099ec2e293005458886ac81b" +checksum = "3b0780cf7046630ed70f689a098cd8d56c5c3b22f2a7379bbdb088879963ff96" dependencies = [ "bitflags", ] diff --git a/component-model/examples/tutorial/command/Cargo.toml b/component-model/examples/tutorial/command/Cargo.toml index d015eab..c395a7e 100644 --- a/component-model/examples/tutorial/command/Cargo.toml +++ b/component-model/examples/tutorial/command/Cargo.toml @@ -14,4 +14,4 @@ world = "app" anyhow = "1" clap = { version = "4.3.19", features = ["derive"] } bitflags = "2.4.2" -wit-bindgen-rt = { version = "0.23.0", features = ["bitflags"] } +wit-bindgen-rt = { version = "0.24.0", features = ["bitflags"] }