diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5c54a4c..15ccb3a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -72,6 +72,6 @@ jobs: run: | ./ci/vendor-wit.sh git diff --exit-code - - run: cargo install wit-bindgen-cli@0.39.0 --locked + - run: cargo install wit-bindgen-cli@0.45.0 --locked - run: ./ci/regenerate.sh - run: git diff --exit-code diff --git a/Cargo.toml b/Cargo.toml index c124e43..f226d9f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,17 +24,18 @@ wasi = { version = "0.14", path = ".", default-features = false } members = ["./crates/*"] [dependencies] -wit-bindgen-rt = { version = "0.39.0", features = ["bitflags"] } +wit-bindgen = { version = "0.45.0", default-features = false } # When built as part of libstd core = { version = "1.0", optional = true, package = "rustc-std-workspace-core" } -rustc-std-workspace-alloc = { version = "1.0", optional = true } +alloc = { version = "1.0", optional = true, package = "rustc-std-workspace-alloc" } [features] -default = ["std"] +default = ["std", "bitflags"] std = [] +bitflags = ["wit-bindgen/bitflags"] # Unstable feature to support being a libstd dependency -rustc-dep-of-std = ["core", "rustc-std-workspace-alloc"] +rustc-dep-of-std = ["core", "alloc", "wit-bindgen/rustc-dep-of-std"] [[example]] name = "cli-command-no_std" diff --git a/ci/regenerate.sh b/ci/regenerate.sh index d7b6fe5..ea8c4d7 100755 --- a/ci/regenerate.sh +++ b/ci/regenerate.sh @@ -5,8 +5,12 @@ set -ex generate() { file="$1" shift - wit-bindgen rust wit --async none --out-dir src --std-feature "$@" --format \ - --runtime-path wit_bindgen_rt + wit-bindgen rust wit --out-dir src --std-feature "$@" --format + + sed -z -i 's/#\[unsafe(\n link_section = "\(.*\)"\n)\]/\ +#[cfg_attr(feature = "rustc-dep-of-std", unsafe(link_section = "\1-in-libstd"))]\ +#[cfg_attr(not(feature = "rustc-dep-of-std"), unsafe(link_section = "\1"))]\ +/' $file } # Generate the main body of the bindings which includes all imports from the two diff --git a/src/bindings.rs b/src/bindings.rs index 7862471..da99a26 100644 --- a/src/bindings.rs +++ b/src/bindings.rs @@ -1,13 +1,12 @@ -// Generated by `wit-bindgen` 0.39.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.45.0. DO NOT EDIT! // Options used: // * std_feature -// * runtime_path: "wit_bindgen_rt" // * type_section_suffix: "rust-wasi-from-crates-io" #[rustfmt::skip] #[allow(dead_code, clippy::all)] pub mod wasi { pub mod cli { - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod environment { #[used] #[doc(hidden)] @@ -22,84 +21,124 @@ pub mod wasi { /// Morally, these are a value import, but until value imports are available /// in the component model, this import function should return the same /// values each time it is called. + #[allow(async_fn_in_trait)] pub fn get_environment() -> _rt::Vec<(_rt::String, _rt::String)> { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 2 * ::core::mem::size_of::<*const u8>()], + ); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2 + * ::core::mem::size_of::<*const u8>()], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:cli/environment@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "get-environment"] fn wit_import1(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: *mut u8) { + unsafe extern "C" fn wit_import1(_: *mut u8) { unreachable!() } wit_import1(ptr0); let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0.add(4).cast::(); + let l3 = *ptr0 + .add(::core::mem::size_of::<*const u8>()) + .cast::(); let base10 = l2; let len10 = l3; let mut result10 = _rt::Vec::with_capacity(len10); for i in 0..len10 { - let base = base10.add(i * 16); + let base = base10 + .add(i * (4 * ::core::mem::size_of::<*const u8>())); let e10 = { let l4 = *base.add(0).cast::<*mut u8>(); - let l5 = *base.add(4).cast::(); + let l5 = *base + .add(::core::mem::size_of::<*const u8>()) + .cast::(); let len6 = l5; let bytes6 = _rt::Vec::from_raw_parts(l4.cast(), len6, len6); - let l7 = *base.add(8).cast::<*mut u8>(); - let l8 = *base.add(12).cast::(); + let l7 = *base + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l8 = *base + .add(3 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len9 = l8; let bytes9 = _rt::Vec::from_raw_parts(l7.cast(), len9, len9); (_rt::string_lift(bytes6), _rt::string_lift(bytes9)) }; result10.push(e10); } - _rt::cabi_dealloc(base10, len10 * 16, 4); + _rt::cabi_dealloc( + base10, + len10 * (4 * ::core::mem::size_of::<*const u8>()), + ::core::mem::size_of::<*const u8>(), + ); let result11 = result10; result11 } } #[allow(unused_unsafe, clippy::all)] /// Get the POSIX-style arguments to the program. + #[allow(async_fn_in_trait)] pub fn get_arguments() -> _rt::Vec<_rt::String> { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 2 * ::core::mem::size_of::<*const u8>()], + ); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2 + * ::core::mem::size_of::<*const u8>()], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:cli/environment@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "get-arguments"] fn wit_import1(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: *mut u8) { + unsafe extern "C" fn wit_import1(_: *mut u8) { unreachable!() } wit_import1(ptr0); let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0.add(4).cast::(); + let l3 = *ptr0 + .add(::core::mem::size_of::<*const u8>()) + .cast::(); let base7 = l2; let len7 = l3; let mut result7 = _rt::Vec::with_capacity(len7); for i in 0..len7 { - let base = base7.add(i * 8); + let base = base7 + .add(i * (2 * ::core::mem::size_of::<*const u8>())); let e7 = { let l4 = *base.add(0).cast::<*mut u8>(); - let l5 = *base.add(4).cast::(); + let l5 = *base + .add(::core::mem::size_of::<*const u8>()) + .cast::(); let len6 = l5; let bytes6 = _rt::Vec::from_raw_parts(l4.cast(), len6, len6); _rt::string_lift(bytes6) }; result7.push(e7); } - _rt::cabi_dealloc(base7, len7 * 8, 4); + _rt::cabi_dealloc( + base7, + len7 * (2 * ::core::mem::size_of::<*const u8>()), + ::core::mem::size_of::<*const u8>(), + ); let result8 = result7; result8 } @@ -107,20 +146,29 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Return a path that programs should use as their initial current working /// directory, interpreting `.` as shorthand for this. + #[allow(async_fn_in_trait)] pub fn initial_cwd() -> Option<_rt::String> { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 3 * ::core::mem::size_of::<*const u8>()], + ); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 3 + * ::core::mem::size_of::<*const u8>()], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:cli/environment@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "initial-cwd"] fn wit_import1(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: *mut u8) { + unsafe extern "C" fn wit_import1(_: *mut u8) { unreachable!() } wit_import1(ptr0); @@ -129,8 +177,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l3 = *ptr0.add(4).cast::<*mut u8>(); - let l4 = *ptr0.add(8).cast::(); + let l3 = *ptr0 + .add(::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l4 = *ptr0 + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len5 = l4; let bytes5 = _rt::Vec::from_raw_parts( l3.cast(), @@ -147,13 +199,14 @@ pub mod wasi { } } } - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod exit { #[used] #[doc(hidden)] static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; #[allow(unused_unsafe, clippy::all)] /// Exit the current instance and any linked instances. + #[allow(async_fn_in_trait)] pub fn exit(status: Result<(), ()>) -> () { unsafe { let result0 = match status { @@ -162,35 +215,36 @@ pub mod wasi { }; #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:cli/exit@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "exit"] fn wit_import1(_: i32); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32) { + unsafe extern "C" fn wit_import1(_: i32) { unreachable!() } wit_import1(result0); } } } - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod stdin { #[used] #[doc(hidden)] static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; pub type InputStream = super::super::super::wasi::io::streams::InputStream; #[allow(unused_unsafe, clippy::all)] + #[allow(async_fn_in_trait)] pub fn get_stdin() -> InputStream { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:cli/stdin@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "get-stdin"] fn wit_import0() -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0() -> i32 { + unsafe extern "C" fn wit_import0() -> i32 { unreachable!() } let ret = wit_import0(); @@ -200,23 +254,24 @@ pub mod wasi { } } } - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod stdout { #[used] #[doc(hidden)] static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; pub type OutputStream = super::super::super::wasi::io::streams::OutputStream; #[allow(unused_unsafe, clippy::all)] + #[allow(async_fn_in_trait)] pub fn get_stdout() -> OutputStream { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:cli/stdout@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "get-stdout"] fn wit_import0() -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0() -> i32 { + unsafe extern "C" fn wit_import0() -> i32 { unreachable!() } let ret = wit_import0(); @@ -226,23 +281,24 @@ pub mod wasi { } } } - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod stderr { #[used] #[doc(hidden)] static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; pub type OutputStream = super::super::super::wasi::io::streams::OutputStream; #[allow(unused_unsafe, clippy::all)] + #[allow(async_fn_in_trait)] pub fn get_stderr() -> OutputStream { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:cli/stderr@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "get-stderr"] fn wit_import0() -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0() -> i32 { + unsafe extern "C" fn wit_import0() -> i32 { unreachable!() } let ret = wit_import0(); @@ -257,7 +313,7 @@ pub mod wasi { /// In the future, this may include functions for disabling echoing, /// disabling input buffering so that keyboard events are sent through /// immediately, querying supported features, and so on. - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod terminal_input { #[used] #[doc(hidden)] @@ -273,7 +329,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -288,16 +344,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for TerminalInput { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:cli/terminal-input@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]terminal-input"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:cli/terminal-input@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]terminal-input"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -307,7 +365,7 @@ pub mod wasi { /// In the future, this may include functions for querying the terminal /// size, being notified of terminal size changes, querying supported /// features, and so on. - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod terminal_output { #[used] #[doc(hidden)] @@ -323,7 +381,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -338,23 +396,25 @@ pub mod wasi { unsafe impl _rt::WasmResource for TerminalOutput { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:cli/terminal-output@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]terminal-output"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:cli/terminal-output@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]terminal-output"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } } /// An interface providing an optional `terminal-input` for stdin as a /// link-time authority. - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod terminal_stdin { #[used] #[doc(hidden)] @@ -364,6 +424,7 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// If stdin is connected to a terminal, return a `terminal-input` handle /// allowing further interaction with it. + #[allow(async_fn_in_trait)] pub fn get_terminal_stdin() -> Option { unsafe { #[repr(align(4))] @@ -372,12 +433,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:cli/terminal-stdin@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "get-terminal-stdin"] fn wit_import1(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: *mut u8) { + unsafe extern "C" fn wit_import1(_: *mut u8) { unreachable!() } wit_import1(ptr0); @@ -401,7 +462,7 @@ pub mod wasi { } /// An interface providing an optional `terminal-output` for stdout as a /// link-time authority. - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod terminal_stdout { #[used] #[doc(hidden)] @@ -411,6 +472,7 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// If stdout is connected to a terminal, return a `terminal-output` handle /// allowing further interaction with it. + #[allow(async_fn_in_trait)] pub fn get_terminal_stdout() -> Option { unsafe { #[repr(align(4))] @@ -419,12 +481,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:cli/terminal-stdout@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "get-terminal-stdout"] fn wit_import1(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: *mut u8) { + unsafe extern "C" fn wit_import1(_: *mut u8) { unreachable!() } wit_import1(ptr0); @@ -448,7 +510,7 @@ pub mod wasi { } /// An interface providing an optional `terminal-output` for stderr as a /// link-time authority. - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod terminal_stderr { #[used] #[doc(hidden)] @@ -458,6 +520,7 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// If stderr is connected to a terminal, return a `terminal-output` handle /// allowing further interaction with it. + #[allow(async_fn_in_trait)] pub fn get_terminal_stderr() -> Option { unsafe { #[repr(align(4))] @@ -466,12 +529,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:cli/terminal-stderr@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "get-terminal-stderr"] fn wit_import1(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: *mut u8) { + unsafe extern "C" fn wit_import1(_: *mut u8) { unreachable!() } wit_import1(ptr0); @@ -503,7 +566,7 @@ pub mod wasi { /// /// A monotonic clock is a clock which has an unspecified initial value, and /// successive reads of the clock will produce non-decreasing values. - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod monotonic_clock { #[used] #[doc(hidden)] @@ -521,16 +584,17 @@ pub mod wasi { /// /// The clock is monotonic, therefore calling this function repeatedly will /// produce a sequence of non-decreasing values. + #[allow(async_fn_in_trait)] pub fn now() -> Instant { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "now"] fn wit_import0() -> i64; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0() -> i64 { + unsafe extern "C" fn wit_import0() -> i64 { unreachable!() } let ret = wit_import0(); @@ -540,16 +604,17 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Query the resolution of the clock. Returns the duration of time /// corresponding to a clock tick. + #[allow(async_fn_in_trait)] pub fn resolution() -> Duration { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "resolution"] fn wit_import0() -> i64; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0() -> i64 { + unsafe extern "C" fn wit_import0() -> i64 { unreachable!() } let ret = wit_import0(); @@ -559,16 +624,17 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Create a `pollable` which will resolve once the specified instant /// has occurred. + #[allow(async_fn_in_trait)] pub fn subscribe_instant(when: Instant) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "subscribe-instant"] fn wit_import0(_: i64) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i64) -> i32 { + unsafe extern "C" fn wit_import0(_: i64) -> i32 { unreachable!() } let ret = wit_import0(_rt::as_i64(when)); @@ -580,16 +646,17 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Create a `pollable` that will resolve after the specified duration has /// elapsed from the time this function is invoked. + #[allow(async_fn_in_trait)] pub fn subscribe_duration(when: Duration) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "subscribe-duration"] fn wit_import0(_: i64) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i64) -> i32 { + unsafe extern "C" fn wit_import0(_: i64) -> i32 { unreachable!() } let ret = wit_import0(_rt::as_i64(when)); @@ -613,7 +680,7 @@ pub mod wasi { /// monotonic, making it unsuitable for measuring elapsed time. /// /// It is intended for reporting the current date and time for humans. - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod wall_clock { #[used] #[doc(hidden)] @@ -650,6 +717,7 @@ pub mod wasi { /// /// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16 /// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time + #[allow(async_fn_in_trait)] pub fn now() -> Datetime { unsafe { #[repr(align(8))] @@ -658,12 +726,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:clocks/wall-clock@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "now"] fn wit_import1(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: *mut u8) { + unsafe extern "C" fn wit_import1(_: *mut u8) { unreachable!() } wit_import1(ptr0); @@ -680,6 +748,7 @@ pub mod wasi { /// Query the resolution of the clock. /// /// The nanoseconds field of the output is always less than 1000000000. + #[allow(async_fn_in_trait)] pub fn resolution() -> Datetime { unsafe { #[repr(align(8))] @@ -688,12 +757,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:clocks/wall-clock@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "resolution"] fn wit_import1(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: *mut u8) { + unsafe extern "C" fn wit_import1(_: *mut u8) { unreachable!() } wit_import1(ptr0); @@ -733,7 +802,7 @@ pub mod wasi { /// [WASI filesystem path resolution]. /// /// [WASI filesystem path resolution]: https://github.com/WebAssembly/wasi-filesystem/blob/main/path-resolution.md - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod types { #[used] #[doc(hidden)] @@ -806,7 +875,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn _lift(val: u8) -> DescriptorType { if !cfg!(debug_assertions) { - return ::core::mem::transmute(val); + return unsafe { ::core::mem::transmute(val) }; } match val { 0 => DescriptorType::Unknown, @@ -821,7 +890,7 @@ pub mod wasi { } } } - wit_bindgen_rt::bitflags::bitflags! { + wit_bindgen::rt::bitflags::bitflags! { #[doc = " Descriptor flags."] #[doc = ""] #[doc = " Note: This was called `fdflags` in earlier versions of WASI."] #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] pub @@ -865,14 +934,14 @@ pub mod wasi { " This may only be set on directories."] const MUTATE_DIRECTORY = 1 << 5; } } - wit_bindgen_rt::bitflags::bitflags! { + wit_bindgen::rt::bitflags::bitflags! { #[doc = " Flags determining the method of how paths are resolved."] #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] pub struct PathFlags : u8 { #[doc = " As long as the resolved path corresponds to a symbolic link, it is"] #[doc = " expanded."] const SYMLINK_FOLLOW = 1 << 0; } } - wit_bindgen_rt::bitflags::bitflags! { + wit_bindgen::rt::bitflags::bitflags! { #[doc = " Open flags used by `open-at`."] #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] pub struct OpenFlags : u8 { #[doc = @@ -1240,7 +1309,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn _lift(val: u8) -> ErrorCode { if !cfg!(debug_assertions) { - return ::core::mem::transmute(val); + return unsafe { ::core::mem::transmute(val) }; } match val { 0 => ErrorCode::Access, @@ -1328,7 +1397,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn _lift(val: u8) -> Advice { if !cfg!(debug_assertions) { - return ::core::mem::transmute(val); + return unsafe { ::core::mem::transmute(val) }; } match val { 0 => Advice::Normal, @@ -1374,7 +1443,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -1389,16 +1458,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for Descriptor { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]descriptor"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]descriptor"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -1412,7 +1483,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -1427,16 +1498,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for DirectoryEntryStream { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]directory-entry-stream"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]directory-entry-stream"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -1450,6 +1523,7 @@ pub mod wasi { /// file and they do not interfere with each other. /// /// Note: This allows using `read-stream`, which is similar to `read` in POSIX. + #[allow(async_fn_in_trait)] pub fn read_via_stream( &self, offset: Filesize, @@ -1463,12 +1537,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.read-via-stream"] fn wit_import1(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, _rt::as_i64(offset), ptr0); @@ -1504,6 +1578,7 @@ pub mod wasi { /// /// Note: This allows using `write-stream`, which is similar to `write` in /// POSIX. + #[allow(async_fn_in_trait)] pub fn write_via_stream( &self, offset: Filesize, @@ -1517,12 +1592,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.write-via-stream"] fn wit_import1(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, _rt::as_i64(offset), ptr0); @@ -1558,6 +1633,7 @@ pub mod wasi { /// /// Note: This allows using `write-stream`, which is similar to `write` with /// `O_APPEND` in POSIX. + #[allow(async_fn_in_trait)] pub fn append_via_stream(&self) -> Result { unsafe { #[repr(align(4))] @@ -1568,12 +1644,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.append-via-stream"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -1606,6 +1682,7 @@ pub mod wasi { /// Provide file advisory information on a descriptor. /// /// This is similar to `posix_fadvise` in POSIX. + #[allow(async_fn_in_trait)] pub fn advise( &self, offset: Filesize, @@ -1621,12 +1698,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.advise"] fn wit_import1(_: i32, _: i64, _: i64, _: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1( + unsafe extern "C" fn wit_import1( _: i32, _: i64, _: i64, @@ -1669,6 +1746,7 @@ pub mod wasi { /// opened for writing. /// /// Note: This is similar to `fdatasync` in POSIX. + #[allow(async_fn_in_trait)] pub fn sync_data(&self) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] @@ -1679,12 +1757,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.sync-data"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -1715,6 +1793,7 @@ pub mod wasi { /// /// Note: This returns the value that was the `fs_flags` value returned /// from `fdstat_get` in earlier versions of WASI. + #[allow(async_fn_in_trait)] pub fn get_flags(&self) -> Result { unsafe { #[repr(align(1))] @@ -1725,12 +1804,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.get-flags"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -1769,6 +1848,7 @@ pub mod wasi { /// /// Note: This returns the value that was the `fs_filetype` value returned /// from `fdstat_get` in earlier versions of WASI. + #[allow(async_fn_in_trait)] pub fn get_type(&self) -> Result { unsafe { #[repr(align(1))] @@ -1779,12 +1859,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.get-type"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -1816,6 +1896,7 @@ pub mod wasi { /// extra bytes are filled with zeros. /// /// Note: This was called `fd_filestat_set_size` in earlier versions of WASI. + #[allow(async_fn_in_trait)] pub fn set_size(&self, size: Filesize) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] @@ -1826,12 +1907,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.set-size"] fn wit_import1(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, _rt::as_i64(size), ptr0); @@ -1861,6 +1942,7 @@ pub mod wasi { /// Note: This is similar to `futimens` in POSIX. /// /// Note: This was called `fd_filestat_set_times` in earlier versions of WASI. + #[allow(async_fn_in_trait)] pub fn set_times( &self, data_access_timestamp: NewTimestamp, @@ -1897,7 +1979,7 @@ pub mod wasi { let ptr4 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.set-times"] fn wit_import5( _: i32, @@ -1911,7 +1993,7 @@ pub mod wasi { ); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import5( + unsafe extern "C" fn wit_import5( _: i32, _: i32, _: i64, @@ -1965,26 +2047,38 @@ pub mod wasi { /// In the future, this may change to return a `stream`. /// /// Note: This is similar to `pread` in POSIX. + #[allow(async_fn_in_trait)] pub fn read( &self, length: Filesize, offset: Filesize, ) -> Result<(_rt::Vec, bool), ErrorCode> { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 16]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 4 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 16], + [::core::mem::MaybeUninit::uninit(); 4 + * ::core::mem::size_of::<*const u8>()], ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.read"] fn wit_import1(_: i32, _: i64, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i64, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1( + _: i32, + _: i64, + _: i64, + _: *mut u8, + ) { unreachable!() } wit_import1( @@ -1997,10 +2091,18 @@ pub mod wasi { let result8 = match l2 { 0 => { let e = { - let l3 = *ptr0.add(4).cast::<*mut u8>(); - let l4 = *ptr0.add(8).cast::(); + let l3 = *ptr0 + .add(::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l4 = *ptr0 + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len5 = l4; - let l6 = i32::from(*ptr0.add(12).cast::()); + let l6 = i32::from( + *ptr0 + .add(3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); ( _rt::Vec::from_raw_parts(l3.cast(), len5, len5), _rt::bool_lift(l6 as u8), @@ -2010,7 +2112,9 @@ pub mod wasi { } 1 => { let e = { - let l7 = i32::from(*ptr0.add(4).cast::()); + let l7 = i32::from( + *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), + ); ErrorCode::_lift(l7 as u8) }; Err(e) @@ -2032,6 +2136,7 @@ pub mod wasi { /// In the future, this may change to take a `stream`. /// /// Note: This is similar to `pwrite` in POSIX. + #[allow(async_fn_in_trait)] pub fn write( &self, buffer: &[u8], @@ -2049,7 +2154,7 @@ pub mod wasi { let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.write"] fn wit_import2( _: i32, @@ -2060,7 +2165,7 @@ pub mod wasi { ); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import2( + unsafe extern "C" fn wit_import2( _: i32, _: *mut u8, _: usize, @@ -2109,6 +2214,7 @@ pub mod wasi { /// This always returns a new stream which starts at the beginning of the /// directory. Multiple streams may be active on the same directory, and they /// do not interfere with each other. + #[allow(async_fn_in_trait)] pub fn read_directory(&self) -> Result { unsafe { #[repr(align(4))] @@ -2119,12 +2225,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.read-directory"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -2158,6 +2264,7 @@ pub mod wasi { /// opened for writing. /// /// Note: This is similar to `fsync` in POSIX. + #[allow(async_fn_in_trait)] pub fn sync(&self) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] @@ -2168,12 +2275,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.sync"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -2201,6 +2308,7 @@ pub mod wasi { /// Create a directory. /// /// Note: This is similar to `mkdirat` in POSIX. + #[allow(async_fn_in_trait)] pub fn create_directory_at(&self, path: &str) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] @@ -2214,12 +2322,12 @@ pub mod wasi { let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.create-directory-at"] fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import2( + unsafe extern "C" fn wit_import2( _: i32, _: *mut u8, _: usize, @@ -2258,6 +2366,7 @@ pub mod wasi { /// modified, use `metadata-hash`. /// /// Note: This was called `fd_filestat_get` in earlier versions of WASI. + #[allow(async_fn_in_trait)] pub fn stat(&self) -> Result { unsafe { #[repr(align(8))] @@ -2268,12 +2377,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.stat"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -2362,6 +2471,7 @@ pub mod wasi { /// discussion of alternatives. /// /// Note: This was called `path_filestat_get` in earlier versions of WASI. + #[allow(async_fn_in_trait)] pub fn stat_at( &self, path_flags: PathFlags, @@ -2380,7 +2490,7 @@ pub mod wasi { let ptr2 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.stat-at"] fn wit_import3( _: i32, @@ -2391,7 +2501,7 @@ pub mod wasi { ); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import3( + unsafe extern "C" fn wit_import3( _: i32, _: i32, _: *mut u8, @@ -2491,6 +2601,7 @@ pub mod wasi { /// /// Note: This was called `path_filestat_set_times` in earlier versions of /// WASI. + #[allow(async_fn_in_trait)] pub fn set_times_at( &self, path_flags: PathFlags, @@ -2533,7 +2644,7 @@ pub mod wasi { let ptr6 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.set-times-at"] fn wit_import7( _: i32, @@ -2550,7 +2661,7 @@ pub mod wasi { ); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import7( + unsafe extern "C" fn wit_import7( _: i32, _: i32, _: *mut u8, @@ -2606,6 +2717,7 @@ pub mod wasi { /// `error-code::not-permitted` if the old path is not a file. /// /// Note: This is similar to `linkat` in POSIX. + #[allow(async_fn_in_trait)] pub fn link_at( &self, old_path_flags: PathFlags, @@ -2629,7 +2741,7 @@ pub mod wasi { let ptr3 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.link-at"] fn wit_import4( _: i32, @@ -2643,7 +2755,7 @@ pub mod wasi { ); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import4( + unsafe extern "C" fn wit_import4( _: i32, _: i32, _: *mut u8, @@ -2698,6 +2810,7 @@ pub mod wasi { /// `error-code::read-only`. /// /// Note: This is similar to `openat` in POSIX. + #[allow(async_fn_in_trait)] pub fn open_at( &self, path_flags: PathFlags, @@ -2720,7 +2833,7 @@ pub mod wasi { let ptr4 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.open-at"] fn wit_import5( _: i32, @@ -2733,7 +2846,7 @@ pub mod wasi { ); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import5( + unsafe extern "C" fn wit_import5( _: i32, _: i32, _: *mut u8, @@ -2783,12 +2896,19 @@ pub mod wasi { /// filesystem, this function fails with `error-code::not-permitted`. /// /// Note: This is similar to `readlinkat` in POSIX. + #[allow(async_fn_in_trait)] pub fn readlink_at(&self, path: &str) -> Result<_rt::String, ErrorCode> { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 12]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 3 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 12], + [::core::mem::MaybeUninit::uninit(); 3 + * ::core::mem::size_of::<*const u8>()], ); let vec0 = path; let ptr0 = vec0.as_ptr().cast::(); @@ -2796,12 +2916,12 @@ pub mod wasi { let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.readlink-at"] fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import2( + unsafe extern "C" fn wit_import2( _: i32, _: *mut u8, _: usize, @@ -2814,8 +2934,12 @@ pub mod wasi { let result8 = match l3 { 0 => { let e = { - let l4 = *ptr1.add(4).cast::<*mut u8>(); - let l5 = *ptr1.add(8).cast::(); + let l4 = *ptr1 + .add(::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l5 = *ptr1 + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len6 = l5; let bytes6 = _rt::Vec::from_raw_parts( l4.cast(), @@ -2828,7 +2952,9 @@ pub mod wasi { } 1 => { let e = { - let l7 = i32::from(*ptr1.add(4).cast::()); + let l7 = i32::from( + *ptr1.add(::core::mem::size_of::<*const u8>()).cast::(), + ); ErrorCode::_lift(l7 as u8) }; Err(e) @@ -2846,6 +2972,7 @@ pub mod wasi { /// Return `error-code::not-empty` if the directory is not empty. /// /// Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX. + #[allow(async_fn_in_trait)] pub fn remove_directory_at(&self, path: &str) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] @@ -2859,12 +2986,12 @@ pub mod wasi { let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.remove-directory-at"] fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import2( + unsafe extern "C" fn wit_import2( _: i32, _: *mut u8, _: usize, @@ -2897,6 +3024,7 @@ pub mod wasi { /// Rename a filesystem object. /// /// Note: This is similar to `renameat` in POSIX. + #[allow(async_fn_in_trait)] pub fn rename_at( &self, old_path: &str, @@ -2918,7 +3046,7 @@ pub mod wasi { let ptr2 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.rename-at"] fn wit_import3( _: i32, @@ -2931,7 +3059,7 @@ pub mod wasi { ); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import3( + unsafe extern "C" fn wit_import3( _: i32, _: *mut u8, _: usize, @@ -2978,6 +3106,7 @@ pub mod wasi { /// `error-code::not-permitted`. /// /// Note: This is similar to `symlinkat` in POSIX. + #[allow(async_fn_in_trait)] pub fn symlink_at( &self, old_path: &str, @@ -2998,7 +3127,7 @@ pub mod wasi { let ptr2 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.symlink-at"] fn wit_import3( _: i32, @@ -3010,7 +3139,7 @@ pub mod wasi { ); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import3( + unsafe extern "C" fn wit_import3( _: i32, _: *mut u8, _: usize, @@ -3053,6 +3182,7 @@ pub mod wasi { /// /// Return `error-code::is-directory` if the path refers to a directory. /// Note: This is similar to `unlinkat(fd, path, 0)` in POSIX. + #[allow(async_fn_in_trait)] pub fn unlink_file_at(&self, path: &str) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] @@ -3066,12 +3196,12 @@ pub mod wasi { let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.unlink-file-at"] fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import2( + unsafe extern "C" fn wit_import2( _: i32, _: *mut u8, _: usize, @@ -3107,16 +3237,17 @@ pub mod wasi { /// same device (`st_dev`) and inode (`st_ino` or `d_ino`) numbers. /// wasi-filesystem does not expose device and inode numbers, so this function /// may be used instead. + #[allow(async_fn_in_trait)] pub fn is_same_object(&self, other: &Descriptor) -> bool { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.is-same-object"] fn wit_import0(_: i32, _: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32, _: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32, _: i32) -> i32 { unreachable!() } let ret = wit_import0( @@ -3148,6 +3279,7 @@ pub mod wasi { /// computed hash. /// /// However, none of these is required. + #[allow(async_fn_in_trait)] pub fn metadata_hash(&self) -> Result { unsafe { #[repr(align(8))] @@ -3158,12 +3290,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.metadata-hash"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -3199,6 +3331,7 @@ pub mod wasi { /// to by a directory descriptor and a relative path. /// /// This performs the same hash computation as `metadata-hash`. + #[allow(async_fn_in_trait)] pub fn metadata_hash_at( &self, path_flags: PathFlags, @@ -3217,7 +3350,7 @@ pub mod wasi { let ptr2 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]descriptor.metadata-hash-at"] fn wit_import3( _: i32, @@ -3228,7 +3361,7 @@ pub mod wasi { ); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import3( + unsafe extern "C" fn wit_import3( _: i32, _: i32, _: *mut u8, @@ -3273,24 +3406,31 @@ pub mod wasi { impl DirectoryEntryStream { #[allow(unused_unsafe, clippy::all)] /// Read a single directory entry from a `directory-entry-stream`. + #[allow(async_fn_in_trait)] pub fn read_directory_entry( &self, ) -> Result, ErrorCode> { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 20]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 5 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 20], + [::core::mem::MaybeUninit::uninit(); 5 + * ::core::mem::size_of::<*const u8>()], ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]directory-entry-stream.read-directory-entry"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -3298,14 +3438,24 @@ pub mod wasi { let result9 = match l2 { 0 => { let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); + let l3 = i32::from( + *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), + ); match l3 { 0 => None, 1 => { let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - let l5 = *ptr0.add(12).cast::<*mut u8>(); - let l6 = *ptr0.add(16).cast::(); + let l4 = i32::from( + *ptr0 + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); + let l5 = *ptr0 + .add(3 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l6 = *ptr0 + .add(4 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len7 = l6; let bytes7 = _rt::Vec::from_raw_parts( l5.cast(), @@ -3326,7 +3476,9 @@ pub mod wasi { } 1 => { let e = { - let l8 = i32::from(*ptr0.add(4).cast::()); + let l8 = i32::from( + *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), + ); ErrorCode::_lift(l8 as u8) }; Err(e) @@ -3348,6 +3500,7 @@ pub mod wasi { /// /// Note that this function is fallible because not all stream-related /// errors are filesystem-related errors. + #[allow(async_fn_in_trait)] pub fn filesystem_error_code(err: &Error) -> Option { unsafe { #[repr(align(1))] @@ -3356,12 +3509,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "filesystem-error-code"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((err).handle() as i32, ptr0); @@ -3381,7 +3534,7 @@ pub mod wasi { } } } - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod preopens { #[used] #[doc(hidden)] @@ -3390,34 +3543,50 @@ pub mod wasi { pub type Descriptor = super::super::super::wasi::filesystem::types::Descriptor; #[allow(unused_unsafe, clippy::all)] /// Return the set of preopened directories, and their paths. + #[allow(async_fn_in_trait)] pub fn get_directories() -> _rt::Vec<(Descriptor, _rt::String)> { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 2 * ::core::mem::size_of::<*const u8>()], + ); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2 + * ::core::mem::size_of::<*const u8>()], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/preopens@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "get-directories"] fn wit_import1(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: *mut u8) { + unsafe extern "C" fn wit_import1(_: *mut u8) { unreachable!() } wit_import1(ptr0); let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0.add(4).cast::(); + let l3 = *ptr0 + .add(::core::mem::size_of::<*const u8>()) + .cast::(); let base8 = l2; let len8 = l3; let mut result8 = _rt::Vec::with_capacity(len8); for i in 0..len8 { - let base = base8.add(i * 12); + let base = base8 + .add(i * (3 * ::core::mem::size_of::<*const u8>())); let e8 = { let l4 = *base.add(0).cast::(); - let l5 = *base.add(4).cast::<*mut u8>(); - let l6 = *base.add(8).cast::(); + let l5 = *base + .add(::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l6 = *base + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len7 = l6; let bytes7 = _rt::Vec::from_raw_parts(l5.cast(), len7, len7); ( @@ -3429,7 +3598,11 @@ pub mod wasi { }; result8.push(e8); } - _rt::cabi_dealloc(base8, len8 * 12, 4); + _rt::cabi_dealloc( + base8, + len8 * (3 * ::core::mem::size_of::<*const u8>()), + ::core::mem::size_of::<*const u8>(), + ); let result9 = result8; result9 } @@ -3440,7 +3613,7 @@ pub mod wasi { /// This interface defines all of the types and methods for implementing /// HTTP Requests and Responses, both incoming and outgoing, as well as /// their headers, trailers, and bodies. - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod types { #[used] #[doc(hidden)] @@ -3850,7 +4023,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -3865,16 +4038,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for Fields { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]fields"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:http/types@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]fields"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -3892,7 +4067,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -3907,16 +4082,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for IncomingRequest { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]incoming-request"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:http/types@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]incoming-request"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -3930,7 +4107,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -3945,16 +4122,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for OutgoingRequest { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]outgoing-request"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:http/types@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]outgoing-request"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -3973,7 +4152,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -3988,16 +4167,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for RequestOptions { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]request-options"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:http/types@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]request-options"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -4015,7 +4196,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -4030,16 +4211,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for ResponseOutparam { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]response-outparam"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:http/types@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]response-outparam"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -4055,7 +4238,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -4070,16 +4253,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for IncomingResponse { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]incoming-response"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:http/types@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]incoming-response"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -4100,7 +4285,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -4115,16 +4300,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for IncomingBody { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]incoming-body"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:http/types@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]incoming-body"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -4142,7 +4329,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -4157,16 +4344,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for FutureTrailers { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]future-trailers"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:http/types@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]future-trailers"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -4180,7 +4369,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -4195,16 +4384,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for OutgoingResponse { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]outgoing-response"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:http/types@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]outgoing-response"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -4233,7 +4424,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -4248,16 +4439,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for OutgoingBody { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]outgoing-body"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:http/types@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]outgoing-body"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -4275,7 +4468,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -4290,16 +4483,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for FutureIncomingResponse { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]future-incoming-response"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:http/types@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]future-incoming-response"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -4315,20 +4510,28 @@ pub mod wasi { /// /// Note that this function is fallible because not all io-errors are /// http-related errors. + #[allow(async_fn_in_trait)] pub fn http_error_code(err: &IoError) -> Option { unsafe { #[repr(align(8))] - struct RetArea([::core::mem::MaybeUninit; 40]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 40]); + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 24 + 4 * ::core::mem::size_of::<*const u8>()], + ); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 24 + + 4 * ::core::mem::size_of::<*const u8>()], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "http-error-code"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((err).handle() as i32, ptr0); @@ -4343,14 +4546,22 @@ pub mod wasi { 1 => { let e65 = { let l4 = i32::from(*ptr0.add(16).cast::()); - let l8 = i32::from(*ptr0.add(28).cast::()); + let l8 = i32::from( + *ptr0 + .add(16 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); DnsErrorPayload { rcode: match l4 { 0 => None, 1 => { let e = { - let l5 = *ptr0.add(20).cast::<*mut u8>(); - let l6 = *ptr0.add(24).cast::(); + let l5 = *ptr0 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l6 = *ptr0 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len7 = l6; let bytes7 = _rt::Vec::from_raw_parts( l5.cast(), @@ -4367,7 +4578,11 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l9 = i32::from(*ptr0.add(30).cast::()); + let l9 = i32::from( + *ptr0 + .add(18 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); l9 as u16 }; Some(e) @@ -4393,7 +4608,11 @@ pub mod wasi { 14 => { let e65 = { let l10 = i32::from(*ptr0.add(16).cast::()); - let l12 = i32::from(*ptr0.add(20).cast::()); + let l12 = i32::from( + *ptr0 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); TlsAlertReceivedPayload { alert_id: match l10 { 0 => None, @@ -4410,8 +4629,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l13 = *ptr0.add(24).cast::<*mut u8>(); - let l14 = *ptr0.add(28).cast::(); + let l13 = *ptr0 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l14 = *ptr0 + .add(16 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len15 = l14; let bytes15 = _rt::Vec::from_raw_parts( l13.cast(), @@ -4474,15 +4697,27 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l21 = i32::from(*ptr0.add(20).cast::()); - let l25 = i32::from(*ptr0.add(32).cast::()); + let l21 = i32::from( + *ptr0 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); + let l25 = i32::from( + *ptr0 + .add(16 + 4 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); FieldSizePayload { field_name: match l21 { 0 => None, 1 => { let e = { - let l22 = *ptr0.add(24).cast::<*mut u8>(); - let l23 = *ptr0.add(28).cast::(); + let l22 = *ptr0 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l23 = *ptr0 + .add(16 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len24 = l23; let bytes24 = _rt::Vec::from_raw_parts( l22.cast(), @@ -4499,7 +4734,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l26 = *ptr0.add(36).cast::(); + let l26 = *ptr0 + .add(20 + 4 * ::core::mem::size_of::<*const u8>()) + .cast::(); l26 as u32 }; Some(e) @@ -4535,14 +4772,22 @@ pub mod wasi { 24 => { let e65 = { let l29 = i32::from(*ptr0.add(16).cast::()); - let l33 = i32::from(*ptr0.add(28).cast::()); + let l33 = i32::from( + *ptr0 + .add(16 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); FieldSizePayload { field_name: match l29 { 0 => None, 1 => { let e = { - let l30 = *ptr0.add(20).cast::<*mut u8>(); - let l31 = *ptr0.add(24).cast::(); + let l30 = *ptr0 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l31 = *ptr0 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len32 = l31; let bytes32 = _rt::Vec::from_raw_parts( l30.cast(), @@ -4559,7 +4804,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l34 = *ptr0.add(32).cast::(); + let l34 = *ptr0 + .add(20 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); l34 as u32 }; Some(e) @@ -4591,14 +4838,22 @@ pub mod wasi { 27 => { let e65 = { let l37 = i32::from(*ptr0.add(16).cast::()); - let l41 = i32::from(*ptr0.add(28).cast::()); + let l41 = i32::from( + *ptr0 + .add(16 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); FieldSizePayload { field_name: match l37 { 0 => None, 1 => { let e = { - let l38 = *ptr0.add(20).cast::<*mut u8>(); - let l39 = *ptr0.add(24).cast::(); + let l38 = *ptr0 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l39 = *ptr0 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len40 = l39; let bytes40 = _rt::Vec::from_raw_parts( l38.cast(), @@ -4615,7 +4870,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l42 = *ptr0.add(32).cast::(); + let l42 = *ptr0 + .add(20 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); l42 as u32 }; Some(e) @@ -4663,14 +4920,22 @@ pub mod wasi { 30 => { let e65 = { let l47 = i32::from(*ptr0.add(16).cast::()); - let l51 = i32::from(*ptr0.add(28).cast::()); + let l51 = i32::from( + *ptr0 + .add(16 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); FieldSizePayload { field_name: match l47 { 0 => None, 1 => { let e = { - let l48 = *ptr0.add(20).cast::<*mut u8>(); - let l49 = *ptr0.add(24).cast::(); + let l48 = *ptr0 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l49 = *ptr0 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len50 = l49; let bytes50 = _rt::Vec::from_raw_parts( l48.cast(), @@ -4687,7 +4952,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l52 = *ptr0.add(32).cast::(); + let l52 = *ptr0 + .add(20 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); l52 as u32 }; Some(e) @@ -4705,8 +4972,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l54 = *ptr0.add(20).cast::<*mut u8>(); - let l55 = *ptr0.add(24).cast::(); + let l54 = *ptr0 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l55 = *ptr0 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len56 = l55; let bytes56 = _rt::Vec::from_raw_parts( l54.cast(), @@ -4729,8 +5000,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l58 = *ptr0.add(20).cast::<*mut u8>(); - let l59 = *ptr0.add(24).cast::(); + let l58 = *ptr0 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l59 = *ptr0 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len60 = l59; let bytes60 = _rt::Vec::from_raw_parts( l58.cast(), @@ -4759,8 +5034,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l62 = *ptr0.add(20).cast::<*mut u8>(); - let l63 = *ptr0.add(24).cast::(); + let l62 = *ptr0 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l63 = *ptr0 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len64 = l63; let bytes64 = _rt::Vec::from_raw_parts( l62.cast(), @@ -4791,16 +5070,17 @@ pub mod wasi { /// Construct an empty HTTP Fields. /// /// The resulting `fields` is mutable. + #[allow(async_fn_in_trait)] pub fn new() -> Self { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[constructor]fields"] fn wit_import0() -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0() -> i32 { + unsafe extern "C" fn wit_import0() -> i32 { unreachable!() } let ret = wit_import0(); @@ -4823,6 +5103,7 @@ pub mod wasi { /// /// An error result will be returned if any `field-name` or `field-value` is /// syntactically invalid, or if a field is forbidden. + #[allow(async_fn_in_trait)] pub fn from_list( entries: &[(FieldName, FieldValue)], ) -> Result { @@ -4834,44 +5115,50 @@ pub mod wasi { ); let vec3 = entries; let len3 = vec3.len(); - let layout3 = _rt::alloc::Layout::from_size_align_unchecked( - vec3.len() * 16, - 4, - ); - let result3 = if layout3.size() != 0 { - let ptr = _rt::alloc::alloc(layout3).cast::(); - if ptr.is_null() { - _rt::alloc::handle_alloc_error(layout3); - } - ptr - } else { - ::core::ptr::null_mut() - }; + let layout3 = _rt::alloc::Layout::from_size_align( + vec3.len() * (4 * ::core::mem::size_of::<*const u8>()), + ::core::mem::size_of::<*const u8>(), + ) + .unwrap(); + let (result3, _cleanup3) = wit_bindgen::rt::Cleanup::new( + layout3, + ); for (i, e) in vec3.into_iter().enumerate() { - let base = result3.add(i * 16); + let base = result3 + .add(i * (4 * ::core::mem::size_of::<*const u8>())); { let (t0_0, t0_1) = e; let vec1 = t0_0; let ptr1 = vec1.as_ptr().cast::(); let len1 = vec1.len(); - *base.add(4).cast::() = len1; + *base + .add(::core::mem::size_of::<*const u8>()) + .cast::() = len1; *base.add(0).cast::<*mut u8>() = ptr1.cast_mut(); let vec2 = t0_1; let ptr2 = vec2.as_ptr().cast::(); let len2 = vec2.len(); - *base.add(12).cast::() = len2; - *base.add(8).cast::<*mut u8>() = ptr2.cast_mut(); + *base + .add(3 * ::core::mem::size_of::<*const u8>()) + .cast::() = len2; + *base + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>() = ptr2.cast_mut(); } } let ptr4 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[static]fields.from-list"] fn wit_import5(_: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import5(_: *mut u8, _: usize, _: *mut u8) { + unsafe extern "C" fn wit_import5( + _: *mut u8, + _: usize, + _: *mut u8, + ) { unreachable!() } wit_import5(result3, len3, ptr4); @@ -4901,9 +5188,6 @@ pub mod wasi { } _ => _rt::invalid_enum_discriminant(), }; - if layout3.size() != 0 { - _rt::alloc::dealloc(result3.cast(), layout3); - } result10 } } @@ -4914,12 +5198,19 @@ pub mod wasi { /// in this `fields` or is syntactically invalid, an empty list is returned. /// However, if the name is present but empty, this is represented by a list /// with one or more empty field-values present. + #[allow(async_fn_in_trait)] pub fn get(&self, name: &str) -> _rt::Vec { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 8]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 2 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 8], + [::core::mem::MaybeUninit::uninit(); 2 + * ::core::mem::size_of::<*const u8>()], ); let vec0 = name; let ptr0 = vec0.as_ptr().cast::(); @@ -4927,12 +5218,12 @@ pub mod wasi { let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]fields.get"] fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import2( + unsafe extern "C" fn wit_import2( _: i32, _: *mut u8, _: usize, @@ -4942,21 +5233,30 @@ pub mod wasi { } wit_import2((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); let l3 = *ptr1.add(0).cast::<*mut u8>(); - let l4 = *ptr1.add(4).cast::(); + let l4 = *ptr1 + .add(::core::mem::size_of::<*const u8>()) + .cast::(); let base8 = l3; let len8 = l4; let mut result8 = _rt::Vec::with_capacity(len8); for i in 0..len8 { - let base = base8.add(i * 8); + let base = base8 + .add(i * (2 * ::core::mem::size_of::<*const u8>())); let e8 = { let l5 = *base.add(0).cast::<*mut u8>(); - let l6 = *base.add(4).cast::(); + let l6 = *base + .add(::core::mem::size_of::<*const u8>()) + .cast::(); let len7 = l6; _rt::Vec::from_raw_parts(l5.cast(), len7, len7) }; result8.push(e8); } - _rt::cabi_dealloc(base8, len8 * 8, 4); + _rt::cabi_dealloc( + base8, + len8 * (2 * ::core::mem::size_of::<*const u8>()), + ::core::mem::size_of::<*const u8>(), + ); let result9 = result8; result9 } @@ -4966,6 +5266,7 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Returns `true` when the name is present in this `fields`. If the name is /// syntactically invalid, `false` is returned. + #[allow(async_fn_in_trait)] pub fn has(&self, name: &str) -> bool { unsafe { let vec0 = name; @@ -4973,12 +5274,16 @@ pub mod wasi { let len0 = vec0.len(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]fields.has"] fn wit_import1(_: i32, _: *mut u8, _: usize) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8, _: usize) -> i32 { + unsafe extern "C" fn wit_import1( + _: i32, + _: *mut u8, + _: usize, + ) -> i32 { unreachable!() } let ret = wit_import1( @@ -4999,6 +5304,7 @@ pub mod wasi { /// /// Fails with `header-error.invalid-syntax` if the `field-name` or any of /// the `field-value`s are syntactically invalid. + #[allow(async_fn_in_trait)] pub fn set( &self, name: &str, @@ -5015,33 +5321,31 @@ pub mod wasi { let len0 = vec0.len(); let vec2 = value; let len2 = vec2.len(); - let layout2 = _rt::alloc::Layout::from_size_align_unchecked( - vec2.len() * 8, - 4, - ); - let result2 = if layout2.size() != 0 { - let ptr = _rt::alloc::alloc(layout2).cast::(); - if ptr.is_null() { - _rt::alloc::handle_alloc_error(layout2); - } - ptr - } else { - ::core::ptr::null_mut() - }; + let layout2 = _rt::alloc::Layout::from_size_align( + vec2.len() * (2 * ::core::mem::size_of::<*const u8>()), + ::core::mem::size_of::<*const u8>(), + ) + .unwrap(); + let (result2, _cleanup2) = wit_bindgen::rt::Cleanup::new( + layout2, + ); for (i, e) in vec2.into_iter().enumerate() { - let base = result2.add(i * 8); + let base = result2 + .add(i * (2 * ::core::mem::size_of::<*const u8>())); { let vec1 = e; let ptr1 = vec1.as_ptr().cast::(); let len1 = vec1.len(); - *base.add(4).cast::() = len1; + *base + .add(::core::mem::size_of::<*const u8>()) + .cast::() = len1; *base.add(0).cast::<*mut u8>() = ptr1.cast_mut(); } } let ptr3 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]fields.set"] fn wit_import4( _: i32, @@ -5053,7 +5357,7 @@ pub mod wasi { ); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import4( + unsafe extern "C" fn wit_import4( _: i32, _: *mut u8, _: usize, @@ -5094,9 +5398,6 @@ pub mod wasi { } _ => _rt::invalid_enum_discriminant(), }; - if layout2.size() != 0 { - _rt::alloc::dealloc(result2.cast(), layout2); - } result8 } } @@ -5110,6 +5411,7 @@ pub mod wasi { /// /// Fails with `header-error.invalid-syntax` if the `field-name` is /// syntactically invalid. + #[allow(async_fn_in_trait)] pub fn delete(&self, name: &str) -> Result<(), HeaderError> { unsafe { #[repr(align(1))] @@ -5123,12 +5425,12 @@ pub mod wasi { let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]fields.delete"] fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import2( + unsafe extern "C" fn wit_import2( _: i32, _: *mut u8, _: usize, @@ -5173,6 +5475,7 @@ pub mod wasi { /// /// Fails with `header-error.invalid-syntax` if the `field-name` or /// `field-value` are syntactically invalid. + #[allow(async_fn_in_trait)] pub fn append( &self, name: &str, @@ -5193,7 +5496,7 @@ pub mod wasi { let ptr2 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]fields.append"] fn wit_import3( _: i32, @@ -5205,7 +5508,7 @@ pub mod wasi { ); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import3( + unsafe extern "C" fn wit_import3( _: i32, _: *mut u8, _: usize, @@ -5261,43 +5564,59 @@ pub mod wasi { /// /// The names and values are always returned in the original casing and in /// the order in which they will be serialized for transport. + #[allow(async_fn_in_trait)] pub fn entries(&self) -> _rt::Vec<(FieldName, FieldValue)> { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 8]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 2 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 8], + [::core::mem::MaybeUninit::uninit(); 2 + * ::core::mem::size_of::<*const u8>()], ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]fields.entries"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0.add(4).cast::(); + let l3 = *ptr0 + .add(::core::mem::size_of::<*const u8>()) + .cast::(); let base10 = l2; let len10 = l3; let mut result10 = _rt::Vec::with_capacity(len10); for i in 0..len10 { - let base = base10.add(i * 16); + let base = base10 + .add(i * (4 * ::core::mem::size_of::<*const u8>())); let e10 = { let l4 = *base.add(0).cast::<*mut u8>(); - let l5 = *base.add(4).cast::(); + let l5 = *base + .add(::core::mem::size_of::<*const u8>()) + .cast::(); let len6 = l5; let bytes6 = _rt::Vec::from_raw_parts( l4.cast(), len6, len6, ); - let l7 = *base.add(8).cast::<*mut u8>(); - let l8 = *base.add(12).cast::(); + let l7 = *base + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l8 = *base + .add(3 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len9 = l8; ( _rt::string_lift(bytes6), @@ -5306,7 +5625,11 @@ pub mod wasi { }; result10.push(e10); } - _rt::cabi_dealloc(base10, len10 * 16, 4); + _rt::cabi_dealloc( + base10, + len10 * (4 * ::core::mem::size_of::<*const u8>()), + ::core::mem::size_of::<*const u8>(), + ); let result11 = result10; result11 } @@ -5317,16 +5640,17 @@ pub mod wasi { /// Make a deep copy of the Fields. Equivalent in behavior to calling the /// `fields` constructor on the return value of `entries`. The resulting /// `fields` is mutable. + #[allow(async_fn_in_trait)] pub fn clone(&self) -> Fields { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]fields.clone"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -5337,22 +5661,29 @@ pub mod wasi { impl IncomingRequest { #[allow(unused_unsafe, clippy::all)] /// Returns the method of the incoming request. + #[allow(async_fn_in_trait)] pub fn method(&self) -> Method { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 12]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 3 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 12], + [::core::mem::MaybeUninit::uninit(); 3 + * ::core::mem::size_of::<*const u8>()], ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]incoming-request.method"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -5370,8 +5701,12 @@ pub mod wasi { n => { debug_assert_eq!(n, 9, "invalid enum discriminant"); let e6 = { - let l3 = *ptr0.add(4).cast::<*mut u8>(); - let l4 = *ptr0.add(8).cast::(); + let l3 = *ptr0 + .add(::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l4 = *ptr0 + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len5 = l4; let bytes5 = _rt::Vec::from_raw_parts( l3.cast(), @@ -5391,22 +5726,29 @@ pub mod wasi { impl IncomingRequest { #[allow(unused_unsafe, clippy::all)] /// Returns the path with query parameters from the request, as a string. + #[allow(async_fn_in_trait)] pub fn path_with_query(&self) -> Option<_rt::String> { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 12]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 3 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 12], + [::core::mem::MaybeUninit::uninit(); 3 + * ::core::mem::size_of::<*const u8>()], ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]incoming-request.path-with-query"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -5415,8 +5757,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l3 = *ptr0.add(4).cast::<*mut u8>(); - let l4 = *ptr0.add(8).cast::(); + let l3 = *ptr0 + .add(::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l4 = *ptr0 + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len5 = l4; let bytes5 = _rt::Vec::from_raw_parts( l3.cast(), @@ -5436,22 +5782,29 @@ pub mod wasi { impl IncomingRequest { #[allow(unused_unsafe, clippy::all)] /// Returns the protocol scheme from the request. + #[allow(async_fn_in_trait)] pub fn scheme(&self) -> Option { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 16]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 4 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 16], + [::core::mem::MaybeUninit::uninit(); 4 + * ::core::mem::size_of::<*const u8>()], ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]incoming-request.scheme"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -5460,15 +5813,21 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); + let l3 = i32::from( + *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), + ); let v7 = match l3 { 0 => Scheme::Http, 1 => Scheme::Https, n => { debug_assert_eq!(n, 2, "invalid enum discriminant"); let e7 = { - let l4 = *ptr0.add(8).cast::<*mut u8>(); - let l5 = *ptr0.add(12).cast::(); + let l4 = *ptr0 + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l5 = *ptr0 + .add(3 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len6 = l5; let bytes6 = _rt::Vec::from_raw_parts( l4.cast(), @@ -5493,22 +5852,29 @@ pub mod wasi { impl IncomingRequest { #[allow(unused_unsafe, clippy::all)] /// Returns the authority of the Request's target URI, if present. + #[allow(async_fn_in_trait)] pub fn authority(&self) -> Option<_rt::String> { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 12]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 3 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 12], + [::core::mem::MaybeUninit::uninit(); 3 + * ::core::mem::size_of::<*const u8>()], ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]incoming-request.authority"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -5517,8 +5883,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l3 = *ptr0.add(4).cast::<*mut u8>(); - let l4 = *ptr0.add(8).cast::(); + let l3 = *ptr0 + .add(::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l4 = *ptr0 + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len5 = l4; let bytes5 = _rt::Vec::from_raw_parts( l3.cast(), @@ -5545,16 +5915,17 @@ pub mod wasi { /// The `headers` returned are a child resource: it must be dropped before /// the parent `incoming-request` is dropped. Dropping this /// `incoming-request` before all children are dropped will trap. + #[allow(async_fn_in_trait)] pub fn headers(&self) -> Headers { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]incoming-request.headers"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -5566,6 +5937,7 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Gives the `incoming-body` associated with this request. Will only /// return success at most once, and subsequent calls will return error. + #[allow(async_fn_in_trait)] pub fn consume(&self) -> Result { unsafe { #[repr(align(4))] @@ -5576,12 +5948,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]incoming-request.consume"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -5616,16 +5988,17 @@ pub mod wasi { /// and `authority`, or `headers` which are not permitted to be sent. /// It is the obligation of the `outgoing-handler.handle` implementation /// to reject invalid constructions of `outgoing-request`. + #[allow(async_fn_in_trait)] pub fn new(headers: Headers) -> Self { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[constructor]outgoing-request"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((&headers).take_handle() as i32); @@ -5641,6 +6014,7 @@ pub mod wasi { /// Returns success on the first call: the `outgoing-body` resource for /// this `outgoing-request` can be retrieved at most once. Subsequent /// calls will return error. + #[allow(async_fn_in_trait)] pub fn body(&self) -> Result { unsafe { #[repr(align(4))] @@ -5651,12 +6025,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]outgoing-request.body"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -5682,22 +6056,29 @@ pub mod wasi { impl OutgoingRequest { #[allow(unused_unsafe, clippy::all)] /// Get the Method for the Request. + #[allow(async_fn_in_trait)] pub fn method(&self) -> Method { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 12]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 3 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 12], + [::core::mem::MaybeUninit::uninit(); 3 + * ::core::mem::size_of::<*const u8>()], ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]outgoing-request.method"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -5715,8 +6096,12 @@ pub mod wasi { n => { debug_assert_eq!(n, 9, "invalid enum discriminant"); let e6 = { - let l3 = *ptr0.add(4).cast::<*mut u8>(); - let l4 = *ptr0.add(8).cast::(); + let l3 = *ptr0 + .add(::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l4 = *ptr0 + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len5 = l4; let bytes5 = _rt::Vec::from_raw_parts( l3.cast(), @@ -5737,6 +6122,7 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Set the Method for the Request. Fails if the string present in a /// `method.other` argument is not a syntactically valid method. + #[allow(async_fn_in_trait)] pub fn set_method(&self, method: &Method) -> Result<(), ()> { unsafe { let (result1_0, result1_1, result1_2) = match method { @@ -5758,12 +6144,12 @@ pub mod wasi { }; #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]outgoing-request.set-method"] fn wit_import2(_: i32, _: i32, _: *mut u8, _: usize) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import2( + unsafe extern "C" fn wit_import2( _: i32, _: i32, _: *mut u8, @@ -5795,22 +6181,29 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Get the combination of the HTTP Path and Query for the Request. /// When `none`, this represents an empty Path and empty Query. + #[allow(async_fn_in_trait)] pub fn path_with_query(&self) -> Option<_rt::String> { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 12]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 3 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 12], + [::core::mem::MaybeUninit::uninit(); 3 + * ::core::mem::size_of::<*const u8>()], ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]outgoing-request.path-with-query"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -5819,8 +6212,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l3 = *ptr0.add(4).cast::<*mut u8>(); - let l4 = *ptr0.add(8).cast::(); + let l3 = *ptr0 + .add(::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l4 = *ptr0 + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len5 = l4; let bytes5 = _rt::Vec::from_raw_parts( l3.cast(), @@ -5842,6 +6239,7 @@ pub mod wasi { /// Set the combination of the HTTP Path and Query for the Request. /// When `none`, this represents an empty Path and empty Query. Fails is the /// string given is not a syntactically valid path and query uri component. + #[allow(async_fn_in_trait)] pub fn set_path_with_query( &self, path_with_query: Option<&str>, @@ -5858,12 +6256,12 @@ pub mod wasi { }; #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]outgoing-request.set-path-with-query"] fn wit_import2(_: i32, _: i32, _: *mut u8, _: usize) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import2( + unsafe extern "C" fn wit_import2( _: i32, _: i32, _: *mut u8, @@ -5895,22 +6293,29 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Get the HTTP Related Scheme for the Request. When `none`, the /// implementation may choose an appropriate default scheme. + #[allow(async_fn_in_trait)] pub fn scheme(&self) -> Option { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 16]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 4 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 16], + [::core::mem::MaybeUninit::uninit(); 4 + * ::core::mem::size_of::<*const u8>()], ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]outgoing-request.scheme"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -5919,15 +6324,21 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); + let l3 = i32::from( + *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), + ); let v7 = match l3 { 0 => Scheme::Http, 1 => Scheme::Https, n => { debug_assert_eq!(n, 2, "invalid enum discriminant"); let e7 = { - let l4 = *ptr0.add(8).cast::<*mut u8>(); - let l5 = *ptr0.add(12).cast::(); + let l4 = *ptr0 + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l5 = *ptr0 + .add(3 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len6 = l5; let bytes6 = _rt::Vec::from_raw_parts( l4.cast(), @@ -5954,6 +6365,7 @@ pub mod wasi { /// Set the HTTP Related Scheme for the Request. When `none`, the /// implementation may choose an appropriate default scheme. Fails if the /// string given is not a syntactically valid uri scheme. + #[allow(async_fn_in_trait)] pub fn set_scheme(&self, scheme: Option<&Scheme>) -> Result<(), ()> { unsafe { let (result2_0, result2_1, result2_2, result2_3) = match scheme { @@ -5974,7 +6386,7 @@ pub mod wasi { }; #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]outgoing-request.set-scheme"] fn wit_import3( _: i32, @@ -5985,7 +6397,7 @@ pub mod wasi { ) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import3( + unsafe extern "C" fn wit_import3( _: i32, _: i32, _: i32, @@ -6020,22 +6432,29 @@ pub mod wasi { /// Get the authority of the Request's target URI. A value of `none` may be used /// with Related Schemes which do not require an authority. The HTTP and /// HTTPS schemes always require an authority. + #[allow(async_fn_in_trait)] pub fn authority(&self) -> Option<_rt::String> { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 12]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 3 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 12], + [::core::mem::MaybeUninit::uninit(); 3 + * ::core::mem::size_of::<*const u8>()], ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]outgoing-request.authority"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -6044,8 +6463,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l3 = *ptr0.add(4).cast::<*mut u8>(); - let l4 = *ptr0.add(8).cast::(); + let l3 = *ptr0 + .add(::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l4 = *ptr0 + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len5 = l4; let bytes5 = _rt::Vec::from_raw_parts( l3.cast(), @@ -6068,6 +6491,7 @@ pub mod wasi { /// with Related Schemes which do not require an authority. The HTTP and /// HTTPS schemes always require an authority. Fails if the string given is /// not a syntactically valid URI authority. + #[allow(async_fn_in_trait)] pub fn set_authority(&self, authority: Option<&str>) -> Result<(), ()> { unsafe { let (result1_0, result1_1, result1_2) = match authority { @@ -6081,12 +6505,12 @@ pub mod wasi { }; #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]outgoing-request.set-authority"] fn wit_import2(_: i32, _: i32, _: *mut u8, _: usize) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import2( + unsafe extern "C" fn wit_import2( _: i32, _: i32, _: *mut u8, @@ -6124,16 +6548,17 @@ pub mod wasi { /// This headers resource is a child: it must be dropped before the parent /// `outgoing-request` is dropped, or its ownership is transferred to /// another component by e.g. `outgoing-handler.handle`. + #[allow(async_fn_in_trait)] pub fn headers(&self) -> Headers { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]outgoing-request.headers"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -6144,16 +6569,17 @@ pub mod wasi { impl RequestOptions { #[allow(unused_unsafe, clippy::all)] /// Construct a default `request-options` value. + #[allow(async_fn_in_trait)] pub fn new() -> Self { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[constructor]request-options"] fn wit_import0() -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0() -> i32 { + unsafe extern "C" fn wit_import0() -> i32 { unreachable!() } let ret = wit_import0(); @@ -6164,6 +6590,7 @@ pub mod wasi { impl RequestOptions { #[allow(unused_unsafe, clippy::all)] /// The timeout for the initial connect to the HTTP Server. + #[allow(async_fn_in_trait)] pub fn connect_timeout(&self) -> Option { unsafe { #[repr(align(8))] @@ -6174,12 +6601,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]request-options.connect-timeout"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -6203,6 +6630,7 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Set the timeout for the initial connect to the HTTP Server. An error /// return value indicates that this timeout is not supported. + #[allow(async_fn_in_trait)] pub fn set_connect_timeout( &self, duration: Option, @@ -6214,12 +6642,12 @@ pub mod wasi { }; #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]request-options.set-connect-timeout"] fn wit_import1(_: i32, _: i32, _: i64) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i32, _: i64) -> i32 { + unsafe extern "C" fn wit_import1(_: i32, _: i32, _: i64) -> i32 { unreachable!() } let ret = wit_import1( @@ -6244,6 +6672,7 @@ pub mod wasi { impl RequestOptions { #[allow(unused_unsafe, clippy::all)] /// The timeout for receiving the first byte of the Response body. + #[allow(async_fn_in_trait)] pub fn first_byte_timeout(&self) -> Option { unsafe { #[repr(align(8))] @@ -6254,12 +6683,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]request-options.first-byte-timeout"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -6283,6 +6712,7 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Set the timeout for receiving the first byte of the Response body. An /// error return value indicates that this timeout is not supported. + #[allow(async_fn_in_trait)] pub fn set_first_byte_timeout( &self, duration: Option, @@ -6294,12 +6724,12 @@ pub mod wasi { }; #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]request-options.set-first-byte-timeout"] fn wit_import1(_: i32, _: i32, _: i64) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i32, _: i64) -> i32 { + unsafe extern "C" fn wit_import1(_: i32, _: i32, _: i64) -> i32 { unreachable!() } let ret = wit_import1( @@ -6325,6 +6755,7 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// The timeout for receiving subsequent chunks of bytes in the Response /// body stream. + #[allow(async_fn_in_trait)] pub fn between_bytes_timeout(&self) -> Option { unsafe { #[repr(align(8))] @@ -6335,12 +6766,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]request-options.between-bytes-timeout"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -6365,6 +6796,7 @@ pub mod wasi { /// Set the timeout for receiving subsequent chunks of bytes in the Response /// body stream. An error return value indicates that this timeout is not /// supported. + #[allow(async_fn_in_trait)] pub fn set_between_bytes_timeout( &self, duration: Option, @@ -6376,12 +6808,12 @@ pub mod wasi { }; #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]request-options.set-between-bytes-timeout"] fn wit_import1(_: i32, _: i32, _: i64) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i32, _: i64) -> i32 { + unsafe extern "C" fn wit_import1(_: i32, _: i32, _: i64) -> i32 { unreachable!() } let ret = wit_import1( @@ -6414,6 +6846,7 @@ pub mod wasi { /// /// The user may provide an `error` to `response` to allow the /// implementation determine how to respond with an HTTP error response. + #[allow(async_fn_in_trait)] pub fn set( param: ResponseOutparam, response: Result, @@ -7098,7 +7531,7 @@ pub mod wasi { }; #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[static]response-outparam.set"] fn wit_import39( _: i32, @@ -7113,7 +7546,7 @@ pub mod wasi { ); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import39( + unsafe extern "C" fn wit_import39( _: i32, _: i32, _: i32, @@ -7143,16 +7576,17 @@ pub mod wasi { impl IncomingResponse { #[allow(unused_unsafe, clippy::all)] /// Returns the status code from the incoming response. + #[allow(async_fn_in_trait)] pub fn status(&self) -> StatusCode { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]incoming-response.status"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -7169,16 +7603,17 @@ pub mod wasi { /// /// This headers resource is a child: it must be dropped before the parent /// `incoming-response` is dropped. + #[allow(async_fn_in_trait)] pub fn headers(&self) -> Headers { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]incoming-response.headers"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -7190,6 +7625,7 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Returns the incoming body. May be called at most once. Returns error /// if called additional times. + #[allow(async_fn_in_trait)] pub fn consume(&self) -> Result { unsafe { #[repr(align(4))] @@ -7200,12 +7636,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]incoming-response.consume"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -7245,6 +7681,7 @@ pub mod wasi { /// backpressure is to be applied when the user is consuming the body, /// and for that backpressure to not inhibit delivery of the trailers if /// the user does not read the entire body. + #[allow(async_fn_in_trait)] pub fn stream(&self) -> Result { unsafe { #[repr(align(4))] @@ -7255,12 +7692,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]incoming-body.stream"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -7289,16 +7726,17 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Takes ownership of `incoming-body`, and returns a `future-trailers`. /// This function will trap if the `input-stream` child is still alive. + #[allow(async_fn_in_trait)] pub fn finish(this: IncomingBody) -> FutureTrailers { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[static]incoming-body.finish"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((&this).take_handle() as i32); @@ -7311,16 +7749,17 @@ pub mod wasi { /// Returns a pollable which becomes ready when either the trailers have /// been received, or an error has occurred. When this pollable is ready, /// the `get` method will return `some`. + #[allow(async_fn_in_trait)] pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]future-trailers.subscribe"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -7351,24 +7790,30 @@ pub mod wasi { /// resource is immutable, and a child. Use of the `set`, `append`, or /// `delete` methods will return an error, and the resource must be /// dropped before the parent `future-trailers` is dropped. + #[allow(async_fn_in_trait)] pub fn get( &self, ) -> Option, ErrorCode>, ()>> { unsafe { #[repr(align(8))] - struct RetArea([::core::mem::MaybeUninit; 56]); + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 40 + 4 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 56], + [::core::mem::MaybeUninit::uninit(); 40 + + 4 * ::core::mem::size_of::<*const u8>()], ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]future-trailers.get"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -7408,14 +7853,22 @@ pub mod wasi { 1 => { let e69 = { let l8 = i32::from(*ptr0.add(32).cast::()); - let l12 = i32::from(*ptr0.add(44).cast::()); + let l12 = i32::from( + *ptr0 + .add(32 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); DnsErrorPayload { rcode: match l8 { 0 => None, 1 => { let e = { - let l9 = *ptr0.add(36).cast::<*mut u8>(); - let l10 = *ptr0.add(40).cast::(); + let l9 = *ptr0 + .add(32 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l10 = *ptr0 + .add(32 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len11 = l10; let bytes11 = _rt::Vec::from_raw_parts( l9.cast(), @@ -7432,7 +7885,11 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l13 = i32::from(*ptr0.add(46).cast::()); + let l13 = i32::from( + *ptr0 + .add(34 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); l13 as u16 }; Some(e) @@ -7458,7 +7915,11 @@ pub mod wasi { 14 => { let e69 = { let l14 = i32::from(*ptr0.add(32).cast::()); - let l16 = i32::from(*ptr0.add(36).cast::()); + let l16 = i32::from( + *ptr0 + .add(32 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); TlsAlertReceivedPayload { alert_id: match l14 { 0 => None, @@ -7475,8 +7936,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l17 = *ptr0.add(40).cast::<*mut u8>(); - let l18 = *ptr0.add(44).cast::(); + let l17 = *ptr0 + .add(32 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l18 = *ptr0 + .add(32 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len19 = l18; let bytes19 = _rt::Vec::from_raw_parts( l17.cast(), @@ -7539,15 +8004,27 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l25 = i32::from(*ptr0.add(36).cast::()); - let l29 = i32::from(*ptr0.add(48).cast::()); + let l25 = i32::from( + *ptr0 + .add(32 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); + let l29 = i32::from( + *ptr0 + .add(32 + 4 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); FieldSizePayload { field_name: match l25 { 0 => None, 1 => { let e = { - let l26 = *ptr0.add(40).cast::<*mut u8>(); - let l27 = *ptr0.add(44).cast::(); + let l26 = *ptr0 + .add(32 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l27 = *ptr0 + .add(32 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len28 = l27; let bytes28 = _rt::Vec::from_raw_parts( l26.cast(), @@ -7564,7 +8041,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l30 = *ptr0.add(52).cast::(); + let l30 = *ptr0 + .add(36 + 4 * ::core::mem::size_of::<*const u8>()) + .cast::(); l30 as u32 }; Some(e) @@ -7600,14 +8079,22 @@ pub mod wasi { 24 => { let e69 = { let l33 = i32::from(*ptr0.add(32).cast::()); - let l37 = i32::from(*ptr0.add(44).cast::()); + let l37 = i32::from( + *ptr0 + .add(32 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); FieldSizePayload { field_name: match l33 { 0 => None, 1 => { let e = { - let l34 = *ptr0.add(36).cast::<*mut u8>(); - let l35 = *ptr0.add(40).cast::(); + let l34 = *ptr0 + .add(32 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l35 = *ptr0 + .add(32 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len36 = l35; let bytes36 = _rt::Vec::from_raw_parts( l34.cast(), @@ -7624,7 +8111,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l38 = *ptr0.add(48).cast::(); + let l38 = *ptr0 + .add(36 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); l38 as u32 }; Some(e) @@ -7656,14 +8145,22 @@ pub mod wasi { 27 => { let e69 = { let l41 = i32::from(*ptr0.add(32).cast::()); - let l45 = i32::from(*ptr0.add(44).cast::()); + let l45 = i32::from( + *ptr0 + .add(32 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); FieldSizePayload { field_name: match l41 { 0 => None, 1 => { let e = { - let l42 = *ptr0.add(36).cast::<*mut u8>(); - let l43 = *ptr0.add(40).cast::(); + let l42 = *ptr0 + .add(32 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l43 = *ptr0 + .add(32 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len44 = l43; let bytes44 = _rt::Vec::from_raw_parts( l42.cast(), @@ -7680,7 +8177,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l46 = *ptr0.add(48).cast::(); + let l46 = *ptr0 + .add(36 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); l46 as u32 }; Some(e) @@ -7728,14 +8227,22 @@ pub mod wasi { 30 => { let e69 = { let l51 = i32::from(*ptr0.add(32).cast::()); - let l55 = i32::from(*ptr0.add(44).cast::()); + let l55 = i32::from( + *ptr0 + .add(32 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); FieldSizePayload { field_name: match l51 { 0 => None, 1 => { let e = { - let l52 = *ptr0.add(36).cast::<*mut u8>(); - let l53 = *ptr0.add(40).cast::(); + let l52 = *ptr0 + .add(32 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l53 = *ptr0 + .add(32 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len54 = l53; let bytes54 = _rt::Vec::from_raw_parts( l52.cast(), @@ -7752,7 +8259,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l56 = *ptr0.add(48).cast::(); + let l56 = *ptr0 + .add(36 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); l56 as u32 }; Some(e) @@ -7770,8 +8279,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l58 = *ptr0.add(36).cast::<*mut u8>(); - let l59 = *ptr0.add(40).cast::(); + let l58 = *ptr0 + .add(32 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l59 = *ptr0 + .add(32 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len60 = l59; let bytes60 = _rt::Vec::from_raw_parts( l58.cast(), @@ -7794,8 +8307,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l62 = *ptr0.add(36).cast::<*mut u8>(); - let l63 = *ptr0.add(40).cast::(); + let l62 = *ptr0 + .add(32 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l63 = *ptr0 + .add(32 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len64 = l63; let bytes64 = _rt::Vec::from_raw_parts( l62.cast(), @@ -7824,8 +8341,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l66 = *ptr0.add(36).cast::<*mut u8>(); - let l67 = *ptr0.add(40).cast::(); + let l66 = *ptr0 + .add(32 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l67 = *ptr0 + .add(32 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len68 = l67; let bytes68 = _rt::Vec::from_raw_parts( l66.cast(), @@ -7873,16 +8394,17 @@ pub mod wasi { /// `set-status-code` method. /// /// * `headers` is the HTTP Headers for the Response. + #[allow(async_fn_in_trait)] pub fn new(headers: Headers) -> Self { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[constructor]outgoing-response"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((&headers).take_handle() as i32); @@ -7893,16 +8415,17 @@ pub mod wasi { impl OutgoingResponse { #[allow(unused_unsafe, clippy::all)] /// Get the HTTP Status Code for the Response. + #[allow(async_fn_in_trait)] pub fn status_code(&self) -> StatusCode { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]outgoing-response.status-code"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -7914,6 +8437,7 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Set the HTTP Status Code for the Response. Fails if the status-code /// given is not a valid http status code. + #[allow(async_fn_in_trait)] pub fn set_status_code( &self, status_code: StatusCode, @@ -7921,12 +8445,12 @@ pub mod wasi { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]outgoing-response.set-status-code"] fn wit_import0(_: i32, _: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32, _: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32, _: i32) -> i32 { unreachable!() } let ret = wit_import0( @@ -7957,16 +8481,17 @@ pub mod wasi { /// This headers resource is a child: it must be dropped before the parent /// `outgoing-request` is dropped, or its ownership is transferred to /// another component by e.g. `outgoing-handler.handle`. + #[allow(async_fn_in_trait)] pub fn headers(&self) -> Headers { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]outgoing-response.headers"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -7981,6 +8506,7 @@ pub mod wasi { /// Returns success on the first call: the `outgoing-body` resource for /// this `outgoing-response` can be retrieved at most once. Subsequent /// calls will return error. + #[allow(async_fn_in_trait)] pub fn body(&self) -> Result { unsafe { #[repr(align(4))] @@ -7991,12 +8517,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]outgoing-response.body"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -8030,6 +8556,7 @@ pub mod wasi { /// Returns success on the first call: the `output-stream` resource for /// this `outgoing-body` may be retrieved at most once. Subsequent calls /// will return error. + #[allow(async_fn_in_trait)] pub fn write(&self) -> Result { unsafe { #[repr(align(4))] @@ -8040,12 +8567,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]outgoing-body.write"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -8081,15 +8608,21 @@ pub mod wasi { /// constructed with a Content-Length header, and the contents written /// to the body (via `write`) does not match the value given in the /// Content-Length. + #[allow(async_fn_in_trait)] pub fn finish( this: OutgoingBody, trailers: Option, ) -> Result<(), ErrorCode> { unsafe { #[repr(align(8))] - struct RetArea([::core::mem::MaybeUninit; 40]); + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 24 + 4 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 40], + [::core::mem::MaybeUninit::uninit(); 24 + + 4 * ::core::mem::size_of::<*const u8>()], ); let (result0_0, result0_1) = match &trailers { Some(e) => (1i32, (e).take_handle() as i32), @@ -8098,12 +8631,17 @@ pub mod wasi { let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[static]outgoing-body.finish"] fn wit_import2(_: i32, _: i32, _: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import2(_: i32, _: i32, _: i32, _: *mut u8) { + unsafe extern "C" fn wit_import2( + _: i32, + _: i32, + _: i32, + _: *mut u8, + ) { unreachable!() } wit_import2( @@ -8126,14 +8664,22 @@ pub mod wasi { 1 => { let e66 = { let l5 = i32::from(*ptr1.add(16).cast::()); - let l9 = i32::from(*ptr1.add(28).cast::()); + let l9 = i32::from( + *ptr1 + .add(16 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); DnsErrorPayload { rcode: match l5 { 0 => None, 1 => { let e = { - let l6 = *ptr1.add(20).cast::<*mut u8>(); - let l7 = *ptr1.add(24).cast::(); + let l6 = *ptr1 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l7 = *ptr1 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len8 = l7; let bytes8 = _rt::Vec::from_raw_parts( l6.cast(), @@ -8150,7 +8696,11 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l10 = i32::from(*ptr1.add(30).cast::()); + let l10 = i32::from( + *ptr1 + .add(18 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); l10 as u16 }; Some(e) @@ -8176,7 +8726,11 @@ pub mod wasi { 14 => { let e66 = { let l11 = i32::from(*ptr1.add(16).cast::()); - let l13 = i32::from(*ptr1.add(20).cast::()); + let l13 = i32::from( + *ptr1 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); TlsAlertReceivedPayload { alert_id: match l11 { 0 => None, @@ -8193,8 +8747,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l14 = *ptr1.add(24).cast::<*mut u8>(); - let l15 = *ptr1.add(28).cast::(); + let l14 = *ptr1 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l15 = *ptr1 + .add(16 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len16 = l15; let bytes16 = _rt::Vec::from_raw_parts( l14.cast(), @@ -8257,15 +8815,27 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l22 = i32::from(*ptr1.add(20).cast::()); - let l26 = i32::from(*ptr1.add(32).cast::()); + let l22 = i32::from( + *ptr1 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); + let l26 = i32::from( + *ptr1 + .add(16 + 4 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); FieldSizePayload { field_name: match l22 { 0 => None, 1 => { let e = { - let l23 = *ptr1.add(24).cast::<*mut u8>(); - let l24 = *ptr1.add(28).cast::(); + let l23 = *ptr1 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l24 = *ptr1 + .add(16 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len25 = l24; let bytes25 = _rt::Vec::from_raw_parts( l23.cast(), @@ -8282,7 +8852,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l27 = *ptr1.add(36).cast::(); + let l27 = *ptr1 + .add(20 + 4 * ::core::mem::size_of::<*const u8>()) + .cast::(); l27 as u32 }; Some(e) @@ -8318,14 +8890,22 @@ pub mod wasi { 24 => { let e66 = { let l30 = i32::from(*ptr1.add(16).cast::()); - let l34 = i32::from(*ptr1.add(28).cast::()); + let l34 = i32::from( + *ptr1 + .add(16 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); FieldSizePayload { field_name: match l30 { 0 => None, 1 => { let e = { - let l31 = *ptr1.add(20).cast::<*mut u8>(); - let l32 = *ptr1.add(24).cast::(); + let l31 = *ptr1 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l32 = *ptr1 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len33 = l32; let bytes33 = _rt::Vec::from_raw_parts( l31.cast(), @@ -8342,7 +8922,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l35 = *ptr1.add(32).cast::(); + let l35 = *ptr1 + .add(20 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); l35 as u32 }; Some(e) @@ -8374,14 +8956,22 @@ pub mod wasi { 27 => { let e66 = { let l38 = i32::from(*ptr1.add(16).cast::()); - let l42 = i32::from(*ptr1.add(28).cast::()); + let l42 = i32::from( + *ptr1 + .add(16 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); FieldSizePayload { field_name: match l38 { 0 => None, 1 => { let e = { - let l39 = *ptr1.add(20).cast::<*mut u8>(); - let l40 = *ptr1.add(24).cast::(); + let l39 = *ptr1 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l40 = *ptr1 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len41 = l40; let bytes41 = _rt::Vec::from_raw_parts( l39.cast(), @@ -8398,7 +8988,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l43 = *ptr1.add(32).cast::(); + let l43 = *ptr1 + .add(20 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); l43 as u32 }; Some(e) @@ -8446,14 +9038,22 @@ pub mod wasi { 30 => { let e66 = { let l48 = i32::from(*ptr1.add(16).cast::()); - let l52 = i32::from(*ptr1.add(28).cast::()); + let l52 = i32::from( + *ptr1 + .add(16 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); FieldSizePayload { field_name: match l48 { 0 => None, 1 => { let e = { - let l49 = *ptr1.add(20).cast::<*mut u8>(); - let l50 = *ptr1.add(24).cast::(); + let l49 = *ptr1 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l50 = *ptr1 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len51 = l50; let bytes51 = _rt::Vec::from_raw_parts( l49.cast(), @@ -8470,7 +9070,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l53 = *ptr1.add(32).cast::(); + let l53 = *ptr1 + .add(20 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); l53 as u32 }; Some(e) @@ -8488,8 +9090,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l55 = *ptr1.add(20).cast::<*mut u8>(); - let l56 = *ptr1.add(24).cast::(); + let l55 = *ptr1 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l56 = *ptr1 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len57 = l56; let bytes57 = _rt::Vec::from_raw_parts( l55.cast(), @@ -8512,8 +9118,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l59 = *ptr1.add(20).cast::<*mut u8>(); - let l60 = *ptr1.add(24).cast::(); + let l59 = *ptr1 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l60 = *ptr1 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len61 = l60; let bytes61 = _rt::Vec::from_raw_parts( l59.cast(), @@ -8542,8 +9152,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l63 = *ptr1.add(20).cast::<*mut u8>(); - let l64 = *ptr1.add(24).cast::(); + let l63 = *ptr1 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l64 = *ptr1 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len65 = l64; let bytes65 = _rt::Vec::from_raw_parts( l63.cast(), @@ -8575,16 +9189,17 @@ pub mod wasi { /// Returns a pollable which becomes ready when either the Response has /// been received, or an error has occurred. When this pollable is ready, /// the `get` method will return `some`. + #[allow(async_fn_in_trait)] pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]future-incoming-response.subscribe"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -8610,24 +9225,30 @@ pub mod wasi { /// occurred. Errors may also occur while consuming the response body, /// but those will be reported by the `incoming-body` and its /// `output-stream` child. + #[allow(async_fn_in_trait)] pub fn get( &self, ) -> Option, ()>> { unsafe { #[repr(align(8))] - struct RetArea([::core::mem::MaybeUninit; 56]); + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 40 + 4 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 56], + [::core::mem::MaybeUninit::uninit(); 40 + + 4 * ::core::mem::size_of::<*const u8>()], ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]future-incoming-response.get"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -8657,14 +9278,22 @@ pub mod wasi { 1 => { let e68 = { let l7 = i32::from(*ptr0.add(32).cast::()); - let l11 = i32::from(*ptr0.add(44).cast::()); + let l11 = i32::from( + *ptr0 + .add(32 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); DnsErrorPayload { rcode: match l7 { 0 => None, 1 => { let e = { - let l8 = *ptr0.add(36).cast::<*mut u8>(); - let l9 = *ptr0.add(40).cast::(); + let l8 = *ptr0 + .add(32 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l9 = *ptr0 + .add(32 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len10 = l9; let bytes10 = _rt::Vec::from_raw_parts( l8.cast(), @@ -8681,7 +9310,11 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l12 = i32::from(*ptr0.add(46).cast::()); + let l12 = i32::from( + *ptr0 + .add(34 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); l12 as u16 }; Some(e) @@ -8707,7 +9340,11 @@ pub mod wasi { 14 => { let e68 = { let l13 = i32::from(*ptr0.add(32).cast::()); - let l15 = i32::from(*ptr0.add(36).cast::()); + let l15 = i32::from( + *ptr0 + .add(32 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); TlsAlertReceivedPayload { alert_id: match l13 { 0 => None, @@ -8724,8 +9361,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l16 = *ptr0.add(40).cast::<*mut u8>(); - let l17 = *ptr0.add(44).cast::(); + let l16 = *ptr0 + .add(32 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l17 = *ptr0 + .add(32 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len18 = l17; let bytes18 = _rt::Vec::from_raw_parts( l16.cast(), @@ -8788,15 +9429,27 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l24 = i32::from(*ptr0.add(36).cast::()); - let l28 = i32::from(*ptr0.add(48).cast::()); + let l24 = i32::from( + *ptr0 + .add(32 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); + let l28 = i32::from( + *ptr0 + .add(32 + 4 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); FieldSizePayload { field_name: match l24 { 0 => None, 1 => { let e = { - let l25 = *ptr0.add(40).cast::<*mut u8>(); - let l26 = *ptr0.add(44).cast::(); + let l25 = *ptr0 + .add(32 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l26 = *ptr0 + .add(32 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len27 = l26; let bytes27 = _rt::Vec::from_raw_parts( l25.cast(), @@ -8813,7 +9466,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l29 = *ptr0.add(52).cast::(); + let l29 = *ptr0 + .add(36 + 4 * ::core::mem::size_of::<*const u8>()) + .cast::(); l29 as u32 }; Some(e) @@ -8849,14 +9504,22 @@ pub mod wasi { 24 => { let e68 = { let l32 = i32::from(*ptr0.add(32).cast::()); - let l36 = i32::from(*ptr0.add(44).cast::()); + let l36 = i32::from( + *ptr0 + .add(32 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); FieldSizePayload { field_name: match l32 { 0 => None, 1 => { let e = { - let l33 = *ptr0.add(36).cast::<*mut u8>(); - let l34 = *ptr0.add(40).cast::(); + let l33 = *ptr0 + .add(32 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l34 = *ptr0 + .add(32 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len35 = l34; let bytes35 = _rt::Vec::from_raw_parts( l33.cast(), @@ -8873,7 +9536,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l37 = *ptr0.add(48).cast::(); + let l37 = *ptr0 + .add(36 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); l37 as u32 }; Some(e) @@ -8905,14 +9570,22 @@ pub mod wasi { 27 => { let e68 = { let l40 = i32::from(*ptr0.add(32).cast::()); - let l44 = i32::from(*ptr0.add(44).cast::()); + let l44 = i32::from( + *ptr0 + .add(32 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); FieldSizePayload { field_name: match l40 { 0 => None, 1 => { let e = { - let l41 = *ptr0.add(36).cast::<*mut u8>(); - let l42 = *ptr0.add(40).cast::(); + let l41 = *ptr0 + .add(32 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l42 = *ptr0 + .add(32 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len43 = l42; let bytes43 = _rt::Vec::from_raw_parts( l41.cast(), @@ -8929,7 +9602,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l45 = *ptr0.add(48).cast::(); + let l45 = *ptr0 + .add(36 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); l45 as u32 }; Some(e) @@ -8977,14 +9652,22 @@ pub mod wasi { 30 => { let e68 = { let l50 = i32::from(*ptr0.add(32).cast::()); - let l54 = i32::from(*ptr0.add(44).cast::()); + let l54 = i32::from( + *ptr0 + .add(32 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); FieldSizePayload { field_name: match l50 { 0 => None, 1 => { let e = { - let l51 = *ptr0.add(36).cast::<*mut u8>(); - let l52 = *ptr0.add(40).cast::(); + let l51 = *ptr0 + .add(32 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l52 = *ptr0 + .add(32 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len53 = l52; let bytes53 = _rt::Vec::from_raw_parts( l51.cast(), @@ -9001,7 +9684,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l55 = *ptr0.add(48).cast::(); + let l55 = *ptr0 + .add(36 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); l55 as u32 }; Some(e) @@ -9019,8 +9704,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l57 = *ptr0.add(36).cast::<*mut u8>(); - let l58 = *ptr0.add(40).cast::(); + let l57 = *ptr0 + .add(32 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l58 = *ptr0 + .add(32 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len59 = l58; let bytes59 = _rt::Vec::from_raw_parts( l57.cast(), @@ -9043,8 +9732,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l61 = *ptr0.add(36).cast::<*mut u8>(); - let l62 = *ptr0.add(40).cast::(); + let l61 = *ptr0 + .add(32 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l62 = *ptr0 + .add(32 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len63 = l62; let bytes63 = _rt::Vec::from_raw_parts( l61.cast(), @@ -9073,8 +9766,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l65 = *ptr0.add(36).cast::<*mut u8>(); - let l66 = *ptr0.add(40).cast::(); + let l65 = *ptr0 + .add(32 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l66 = *ptr0 + .add(32 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len67 = l66; let bytes67 = _rt::Vec::from_raw_parts( l65.cast(), @@ -9118,7 +9815,7 @@ pub mod wasi { } /// This interface defines a handler of outgoing HTTP Requests. It should be /// imported by components which wish to make HTTP Requests. - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod outgoing_handler { #[used] #[doc(hidden)] @@ -9139,14 +9836,22 @@ pub mod wasi { /// This function may return an error if the `outgoing-request` is invalid /// or not allowed to be made. Otherwise, protocol errors are reported /// through the `future-incoming-response`. + #[allow(async_fn_in_trait)] pub fn handle( request: OutgoingRequest, options: Option, ) -> Result { unsafe { #[repr(align(8))] - struct RetArea([::core::mem::MaybeUninit; 40]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 40]); + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 24 + 4 * ::core::mem::size_of::<*const u8>()], + ); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 24 + + 4 * ::core::mem::size_of::<*const u8>()], + ); let (result0_0, result0_1) = match &options { Some(e) => (1i32, (e).take_handle() as i32), None => (0i32, 0i32), @@ -9154,12 +9859,17 @@ pub mod wasi { let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/outgoing-handler@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "handle"] fn wit_import2(_: i32, _: i32, _: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import2(_: i32, _: i32, _: i32, _: *mut u8) { + unsafe extern "C" fn wit_import2( + _: i32, + _: i32, + _: i32, + _: *mut u8, + ) { unreachable!() } wit_import2( @@ -9188,14 +9898,22 @@ pub mod wasi { 1 => { let e67 = { let l6 = i32::from(*ptr1.add(16).cast::()); - let l10 = i32::from(*ptr1.add(28).cast::()); + let l10 = i32::from( + *ptr1 + .add(16 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); super::super::super::wasi::http::types::DnsErrorPayload { rcode: match l6 { 0 => None, 1 => { let e = { - let l7 = *ptr1.add(20).cast::<*mut u8>(); - let l8 = *ptr1.add(24).cast::(); + let l7 = *ptr1 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l8 = *ptr1 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len9 = l8; let bytes9 = _rt::Vec::from_raw_parts( l7.cast(), @@ -9212,7 +9930,11 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l11 = i32::from(*ptr1.add(30).cast::()); + let l11 = i32::from( + *ptr1 + .add(18 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); l11 as u16 }; Some(e) @@ -9238,7 +9960,11 @@ pub mod wasi { 14 => { let e67 = { let l12 = i32::from(*ptr1.add(16).cast::()); - let l14 = i32::from(*ptr1.add(20).cast::()); + let l14 = i32::from( + *ptr1 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); super::super::super::wasi::http::types::TlsAlertReceivedPayload { alert_id: match l12 { 0 => None, @@ -9255,8 +9981,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l15 = *ptr1.add(24).cast::<*mut u8>(); - let l16 = *ptr1.add(28).cast::(); + let l15 = *ptr1 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l16 = *ptr1 + .add(16 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len17 = l16; let bytes17 = _rt::Vec::from_raw_parts( l15.cast(), @@ -9319,15 +10049,27 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l23 = i32::from(*ptr1.add(20).cast::()); - let l27 = i32::from(*ptr1.add(32).cast::()); + let l23 = i32::from( + *ptr1 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); + let l27 = i32::from( + *ptr1 + .add(16 + 4 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); super::super::super::wasi::http::types::FieldSizePayload { field_name: match l23 { 0 => None, 1 => { let e = { - let l24 = *ptr1.add(24).cast::<*mut u8>(); - let l25 = *ptr1.add(28).cast::(); + let l24 = *ptr1 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l25 = *ptr1 + .add(16 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len26 = l25; let bytes26 = _rt::Vec::from_raw_parts( l24.cast(), @@ -9344,7 +10086,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l28 = *ptr1.add(36).cast::(); + let l28 = *ptr1 + .add(20 + 4 * ::core::mem::size_of::<*const u8>()) + .cast::(); l28 as u32 }; Some(e) @@ -9380,14 +10124,22 @@ pub mod wasi { 24 => { let e67 = { let l31 = i32::from(*ptr1.add(16).cast::()); - let l35 = i32::from(*ptr1.add(28).cast::()); + let l35 = i32::from( + *ptr1 + .add(16 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); super::super::super::wasi::http::types::FieldSizePayload { field_name: match l31 { 0 => None, 1 => { let e = { - let l32 = *ptr1.add(20).cast::<*mut u8>(); - let l33 = *ptr1.add(24).cast::(); + let l32 = *ptr1 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l33 = *ptr1 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len34 = l33; let bytes34 = _rt::Vec::from_raw_parts( l32.cast(), @@ -9404,7 +10156,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l36 = *ptr1.add(32).cast::(); + let l36 = *ptr1 + .add(20 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); l36 as u32 }; Some(e) @@ -9436,14 +10190,22 @@ pub mod wasi { 27 => { let e67 = { let l39 = i32::from(*ptr1.add(16).cast::()); - let l43 = i32::from(*ptr1.add(28).cast::()); + let l43 = i32::from( + *ptr1 + .add(16 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); super::super::super::wasi::http::types::FieldSizePayload { field_name: match l39 { 0 => None, 1 => { let e = { - let l40 = *ptr1.add(20).cast::<*mut u8>(); - let l41 = *ptr1.add(24).cast::(); + let l40 = *ptr1 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l41 = *ptr1 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len42 = l41; let bytes42 = _rt::Vec::from_raw_parts( l40.cast(), @@ -9460,7 +10222,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l44 = *ptr1.add(32).cast::(); + let l44 = *ptr1 + .add(20 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); l44 as u32 }; Some(e) @@ -9508,14 +10272,22 @@ pub mod wasi { 30 => { let e67 = { let l49 = i32::from(*ptr1.add(16).cast::()); - let l53 = i32::from(*ptr1.add(28).cast::()); + let l53 = i32::from( + *ptr1 + .add(16 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); super::super::super::wasi::http::types::FieldSizePayload { field_name: match l49 { 0 => None, 1 => { let e = { - let l50 = *ptr1.add(20).cast::<*mut u8>(); - let l51 = *ptr1.add(24).cast::(); + let l50 = *ptr1 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l51 = *ptr1 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len52 = l51; let bytes52 = _rt::Vec::from_raw_parts( l50.cast(), @@ -9532,7 +10304,9 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l54 = *ptr1.add(32).cast::(); + let l54 = *ptr1 + .add(20 + 3 * ::core::mem::size_of::<*const u8>()) + .cast::(); l54 as u32 }; Some(e) @@ -9550,8 +10324,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l56 = *ptr1.add(20).cast::<*mut u8>(); - let l57 = *ptr1.add(24).cast::(); + let l56 = *ptr1 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l57 = *ptr1 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len58 = l57; let bytes58 = _rt::Vec::from_raw_parts( l56.cast(), @@ -9574,8 +10352,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l60 = *ptr1.add(20).cast::<*mut u8>(); - let l61 = *ptr1.add(24).cast::(); + let l60 = *ptr1 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l61 = *ptr1 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len62 = l61; let bytes62 = _rt::Vec::from_raw_parts( l60.cast(), @@ -9604,8 +10386,12 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l64 = *ptr1.add(20).cast::<*mut u8>(); - let l65 = *ptr1.add(24).cast::(); + let l64 = *ptr1 + .add(16 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l65 = *ptr1 + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len66 = l65; let bytes66 = _rt::Vec::from_raw_parts( l64.cast(), @@ -9636,7 +10422,7 @@ pub mod wasi { pub mod io { /// A poll API intended to let users wait for I/O events on multiple handles /// at once. - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod poll { #[used] #[doc(hidden)] @@ -9652,7 +10438,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -9667,16 +10453,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for Pollable { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:io/poll@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]pollable"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:io/poll@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]pollable"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -9685,16 +10473,17 @@ pub mod wasi { /// Return the readiness of a pollable. This function never blocks. /// /// Returns `true` when the pollable is ready, and `false` otherwise. + #[allow(async_fn_in_trait)] pub fn ready(&self) -> bool { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/poll@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]pollable.ready"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -9709,16 +10498,17 @@ pub mod wasi { /// /// This function is equivalent to calling `poll.poll` on a list /// containing only this pollable. + #[allow(async_fn_in_trait)] pub fn block(&self) -> () { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/poll@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]pollable.block"] fn wit_import0(_: i32); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) { + unsafe extern "C" fn wit_import0(_: i32) { unreachable!() } wit_import0((self).handle() as i32); @@ -9745,26 +10535,25 @@ pub mod wasi { /// do any I/O so it doesn't fail. If any of the I/O sources identified by /// the pollables has an error, it is indicated by marking the source as /// being ready for I/O. + #[allow(async_fn_in_trait)] pub fn poll(in_: &[&Pollable]) -> _rt::Vec { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 2 * ::core::mem::size_of::<*const u8>()], + ); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2 + * ::core::mem::size_of::<*const u8>()], + ); let vec0 = in_; let len0 = vec0.len(); - let layout0 = _rt::alloc::Layout::from_size_align_unchecked( - vec0.len() * 4, - 4, - ); - let result0 = if layout0.size() != 0 { - let ptr = _rt::alloc::alloc(layout0).cast::(); - if ptr.is_null() { - _rt::alloc::handle_alloc_error(layout0); - } - ptr - } else { - ::core::ptr::null_mut() - }; + let layout0 = _rt::alloc::Layout::from_size_align(vec0.len() * 4, 4) + .unwrap(); + let (result0, _cleanup0) = wit_bindgen::rt::Cleanup::new(layout0); for (i, e) in vec0.into_iter().enumerate() { let base = result0.add(i * 4); { @@ -9774,27 +10563,26 @@ pub mod wasi { let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/poll@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "poll"] fn wit_import2(_: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import2(_: *mut u8, _: usize, _: *mut u8) { + unsafe extern "C" fn wit_import2(_: *mut u8, _: usize, _: *mut u8) { unreachable!() } wit_import2(result0, len0, ptr1); let l3 = *ptr1.add(0).cast::<*mut u8>(); - let l4 = *ptr1.add(4).cast::(); + let l4 = *ptr1 + .add(::core::mem::size_of::<*const u8>()) + .cast::(); let len5 = l4; let result6 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5); - if layout0.size() != 0 { - _rt::alloc::dealloc(result0.cast(), layout0); - } result6 } } } - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod error { #[used] #[doc(hidden)] @@ -9826,7 +10614,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -9841,16 +10629,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for Error { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:io/error@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]error"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:io/error@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]error"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -9863,27 +10653,36 @@ pub mod wasi { /// It may change across platforms, hosts, or other implementation /// details. Parsing this string is a major platform-compatibility /// hazard. + #[allow(async_fn_in_trait)] pub fn to_debug_string(&self) -> _rt::String { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 8]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 2 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 8], + [::core::mem::MaybeUninit::uninit(); 2 + * ::core::mem::size_of::<*const u8>()], ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/error@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]error.to-debug-string"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0.add(4).cast::(); + let l3 = *ptr0 + .add(::core::mem::size_of::<*const u8>()) + .cast::(); let len4 = l3; let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); let result5 = _rt::string_lift(bytes4); @@ -9897,7 +10696,7 @@ pub mod wasi { /// /// In the future, the component model is expected to add built-in stream types; /// when it does, they are expected to subsume this API. - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod streams { #[used] #[doc(hidden)] @@ -9963,7 +10762,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -9978,16 +10777,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for InputStream { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:io/streams@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]input-stream"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:io/streams@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]input-stream"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -10012,7 +10813,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -10027,16 +10828,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for OutputStream { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:io/streams@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]output-stream"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:io/streams@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]output-stream"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -10068,22 +10871,29 @@ pub mod wasi { /// is not possible to allocate in wasm32, or not desirable to allocate as /// as a return value by the callee. The callee may return a list of bytes /// less than `len` in size while more bytes are available for reading. + #[allow(async_fn_in_trait)] pub fn read(&self, len: u64) -> Result<_rt::Vec, StreamError> { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 12]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 3 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 12], + [::core::mem::MaybeUninit::uninit(); 3 + * ::core::mem::size_of::<*const u8>()], ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]input-stream.read"] fn wit_import1(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0); @@ -10091,8 +10901,12 @@ pub mod wasi { let result9 = match l2 { 0 => { let e = { - let l3 = *ptr0.add(4).cast::<*mut u8>(); - let l4 = *ptr0.add(8).cast::(); + let l3 = *ptr0 + .add(::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l4 = *ptr0 + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len5 = l4; _rt::Vec::from_raw_parts(l3.cast(), len5, len5) }; @@ -10100,11 +10914,15 @@ pub mod wasi { } 1 => { let e = { - let l6 = i32::from(*ptr0.add(4).cast::()); + let l6 = i32::from( + *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), + ); let v8 = match l6 { 0 => { let e8 = { - let l7 = *ptr0.add(8).cast::(); + let l7 = *ptr0 + .add(4 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::(); super::super::super::wasi::io::error::Error::from_handle( l7 as u32, ) @@ -10130,25 +10948,32 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Read bytes from a stream, after blocking until at least one byte can /// be read. Except for blocking, behavior is identical to `read`. + #[allow(async_fn_in_trait)] pub fn blocking_read( &self, len: u64, ) -> Result<_rt::Vec, StreamError> { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 12]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 3 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 12], + [::core::mem::MaybeUninit::uninit(); 3 + * ::core::mem::size_of::<*const u8>()], ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]input-stream.blocking-read"] fn wit_import1(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0); @@ -10156,8 +10981,12 @@ pub mod wasi { let result9 = match l2 { 0 => { let e = { - let l3 = *ptr0.add(4).cast::<*mut u8>(); - let l4 = *ptr0.add(8).cast::(); + let l3 = *ptr0 + .add(::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l4 = *ptr0 + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let len5 = l4; _rt::Vec::from_raw_parts(l3.cast(), len5, len5) }; @@ -10165,11 +10994,15 @@ pub mod wasi { } 1 => { let e = { - let l6 = i32::from(*ptr0.add(4).cast::()); + let l6 = i32::from( + *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), + ); let v8 = match l6 { 0 => { let e8 = { - let l7 = *ptr0.add(8).cast::(); + let l7 = *ptr0 + .add(4 + 1 * ::core::mem::size_of::<*const u8>()) + .cast::(); super::super::super::wasi::io::error::Error::from_handle( l7 as u32, ) @@ -10197,6 +11030,7 @@ pub mod wasi { /// /// Behaves identical to `read`, except instead of returning a list /// of bytes, returns the number of bytes consumed from the stream. + #[allow(async_fn_in_trait)] pub fn skip(&self, len: u64) -> Result { unsafe { #[repr(align(8))] @@ -10207,12 +11041,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]input-stream.skip"] fn wit_import1(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0); @@ -10257,6 +11091,7 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Skip bytes from a stream, after blocking until at least one byte /// can be skipped. Except for blocking behavior, identical to `skip`. + #[allow(async_fn_in_trait)] pub fn blocking_skip(&self, len: u64) -> Result { unsafe { #[repr(align(8))] @@ -10267,12 +11102,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]input-stream.blocking-skip"] fn wit_import1(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0); @@ -10321,16 +11156,17 @@ pub mod wasi { /// The created `pollable` is a child resource of the `input-stream`. /// Implementations may trap if the `input-stream` is dropped before /// all derived `pollable`s created with this function are dropped. + #[allow(async_fn_in_trait)] pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]input-stream.subscribe"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -10351,6 +11187,7 @@ pub mod wasi { /// When this function returns 0 bytes, the `subscribe` pollable will /// become ready when this function will report at least 1 byte, or an /// error. + #[allow(async_fn_in_trait)] pub fn check_write(&self) -> Result { unsafe { #[repr(align(8))] @@ -10361,12 +11198,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]output-stream.check-write"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -10422,6 +11259,7 @@ pub mod wasi { /// /// returns Err(closed) without writing if the stream has closed since /// the last call to check-write provided a permit. + #[allow(async_fn_in_trait)] pub fn write(&self, contents: &[u8]) -> Result<(), StreamError> { unsafe { #[repr(align(4))] @@ -10435,12 +11273,12 @@ pub mod wasi { let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]output-stream.write"] fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import2( + unsafe extern "C" fn wit_import2( _: i32, _: *mut u8, _: usize, @@ -10509,6 +11347,7 @@ pub mod wasi { /// // Check for any errors that arose during `flush` /// let _ = this.check-write(); // eliding error handling /// ``` + #[allow(async_fn_in_trait)] pub fn blocking_write_and_flush( &self, contents: &[u8], @@ -10525,12 +11364,12 @@ pub mod wasi { let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]output-stream.blocking-write-and-flush"] fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import2( + unsafe extern "C" fn wit_import2( _: i32, _: *mut u8, _: usize, @@ -10585,6 +11424,7 @@ pub mod wasi { /// writes (`check-write` will return `ok(0)`) until the flush has /// completed. The `subscribe` pollable will become ready when the /// flush has completed and the stream can accept more writes. + #[allow(async_fn_in_trait)] pub fn flush(&self) -> Result<(), StreamError> { unsafe { #[repr(align(4))] @@ -10595,12 +11435,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]output-stream.flush"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -10642,6 +11482,7 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Request to flush buffered output, and block until flush completes /// and stream is ready for writing again. + #[allow(async_fn_in_trait)] pub fn blocking_flush(&self) -> Result<(), StreamError> { unsafe { #[repr(align(4))] @@ -10652,12 +11493,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]output-stream.blocking-flush"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -10707,16 +11548,17 @@ pub mod wasi { /// The created `pollable` is a child resource of the `output-stream`. /// Implementations may trap if the `output-stream` is dropped before /// all derived `pollable`s created with this function are dropped. + #[allow(async_fn_in_trait)] pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]output-stream.subscribe"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -10734,6 +11576,7 @@ pub mod wasi { /// preconditions (must use check-write first), but instead of /// passing a list of bytes, you simply pass the number of zero-bytes /// that should be written. + #[allow(async_fn_in_trait)] pub fn write_zeroes(&self, len: u64) -> Result<(), StreamError> { unsafe { #[repr(align(4))] @@ -10744,12 +11587,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]output-stream.write-zeroes"] fn wit_import1(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0); @@ -10813,6 +11656,7 @@ pub mod wasi { /// // Check for any errors that arose during `flush` /// let _ = this.check-write(); // eliding error handling /// ``` + #[allow(async_fn_in_trait)] pub fn blocking_write_zeroes_and_flush( &self, len: u64, @@ -10826,12 +11670,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]output-stream.blocking-write-zeroes-and-flush"] fn wit_import1(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0); @@ -10884,6 +11728,7 @@ pub mod wasi { /// /// This function returns the number of bytes transferred; it may be less /// than `len`. + #[allow(async_fn_in_trait)] pub fn splice( &self, src: &InputStream, @@ -10898,12 +11743,17 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]output-stream.splice"] fn wit_import1(_: i32, _: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i32, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1( + _: i32, + _: i32, + _: i64, + _: *mut u8, + ) { unreachable!() } wit_import1( @@ -10956,6 +11806,7 @@ pub mod wasi { /// This is similar to `splice`, except that it blocks until the /// `output-stream` is ready for writing, and the `input-stream` /// is ready for reading, before performing the `splice`. + #[allow(async_fn_in_trait)] pub fn blocking_splice( &self, src: &InputStream, @@ -10970,12 +11821,17 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]output-stream.blocking-splice"] fn wit_import1(_: i32, _: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i32, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1( + _: i32, + _: i32, + _: i64, + _: *mut u8, + ) { unreachable!() } wit_import1( @@ -11028,7 +11884,7 @@ pub mod wasi { /// /// It is intended to be portable at least between Unix-family platforms and /// Windows. - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod random { #[used] #[doc(hidden)] @@ -11047,25 +11903,36 @@ pub mod wasi { /// This function must always return fresh data. Deterministic environments /// must omit this function, rather than implementing it with deterministic /// data. + #[allow(async_fn_in_trait)] pub fn get_random_bytes(len: u64) -> _rt::Vec { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 2 * ::core::mem::size_of::<*const u8>()], + ); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2 + * ::core::mem::size_of::<*const u8>()], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:random/random@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "get-random-bytes"] fn wit_import1(_: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i64, _: *mut u8) { unreachable!() } wit_import1(_rt::as_i64(&len), ptr0); let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0.add(4).cast::(); + let l3 = *ptr0 + .add(::core::mem::size_of::<*const u8>()) + .cast::(); let len4 = l3; let result5 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); result5 @@ -11076,16 +11943,17 @@ pub mod wasi { /// /// This function returns the same type of data as `get-random-bytes`, /// represented as a `u64`. + #[allow(async_fn_in_trait)] pub fn get_random_u64() -> u64 { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:random/random@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "get-random-u64"] fn wit_import0() -> i64; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0() -> i64 { + unsafe extern "C" fn wit_import0() -> i64 { unreachable!() } let ret = wit_import0(); @@ -11097,7 +11965,7 @@ pub mod wasi { /// /// It is intended to be portable at least between Unix-family platforms and /// Windows. - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod insecure { #[used] #[doc(hidden)] @@ -11112,25 +11980,36 @@ pub mod wasi { /// There are no requirements on the values of the returned bytes, however /// implementations are encouraged to return evenly distributed values with /// a long period. + #[allow(async_fn_in_trait)] pub fn get_insecure_random_bytes(len: u64) -> _rt::Vec { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 2 * ::core::mem::size_of::<*const u8>()], + ); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2 + * ::core::mem::size_of::<*const u8>()], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:random/insecure@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "get-insecure-random-bytes"] fn wit_import1(_: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i64, _: *mut u8) { unreachable!() } wit_import1(_rt::as_i64(&len), ptr0); let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0.add(4).cast::(); + let l3 = *ptr0 + .add(::core::mem::size_of::<*const u8>()) + .cast::(); let len4 = l3; let result5 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); result5 @@ -11141,16 +12020,17 @@ pub mod wasi { /// /// This function returns the same type of pseudo-random data as /// `get-insecure-random-bytes`, represented as a `u64`. + #[allow(async_fn_in_trait)] pub fn get_insecure_random_u64() -> u64 { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:random/insecure@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "get-insecure-random-u64"] fn wit_import0() -> i64; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0() -> i64 { + unsafe extern "C" fn wit_import0() -> i64 { unreachable!() } let ret = wit_import0(); @@ -11162,7 +12042,7 @@ pub mod wasi { /// /// It is intended to be portable at least between Unix-family platforms and /// Windows. - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod insecure_seed { #[used] #[doc(hidden)] @@ -11185,6 +12065,7 @@ pub mod wasi { /// This will likely be changed to a value import, to prevent it from being /// called multiple times and potentially used for purposes other than DoS /// protection. + #[allow(async_fn_in_trait)] pub fn insecure_seed() -> (u64, u64) { unsafe { #[repr(align(8))] @@ -11193,12 +12074,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:random/insecure-seed@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "insecure-seed"] fn wit_import1(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: *mut u8) { + unsafe extern "C" fn wit_import1(_: *mut u8) { unreachable!() } wit_import1(ptr0); @@ -11211,7 +12092,7 @@ pub mod wasi { } } pub mod sockets { - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod network { #[used] #[doc(hidden)] @@ -11229,7 +12110,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -11244,16 +12125,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for Network { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:sockets/network@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]network"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:sockets/network@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]network"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -11467,7 +12350,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn _lift(val: u8) -> ErrorCode { if !cfg!(debug_assertions) { - return ::core::mem::transmute(val); + return unsafe { ::core::mem::transmute(val) }; } match val { 0 => ErrorCode::Unknown, @@ -11522,7 +12405,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn _lift(val: u8) -> IpAddressFamily { if !cfg!(debug_assertions) { - return ::core::mem::transmute(val); + return unsafe { ::core::mem::transmute(val) }; } match val { 0 => IpAddressFamily::Ipv4, @@ -11619,7 +12502,7 @@ pub mod wasi { } } /// This interface provides a value-export of the default network handle.. - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod instance_network { #[used] #[doc(hidden)] @@ -11627,16 +12510,17 @@ pub mod wasi { pub type Network = super::super::super::wasi::sockets::network::Network; #[allow(unused_unsafe, clippy::all)] /// Get a handle to the default network. + #[allow(async_fn_in_trait)] pub fn instance_network() -> Network { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/instance-network@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "instance-network"] fn wit_import0() -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0() -> i32 { + unsafe extern "C" fn wit_import0() -> i32 { unreachable!() } let ret = wit_import0(); @@ -11646,7 +12530,7 @@ pub mod wasi { } } } - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod udp { #[used] #[doc(hidden)] @@ -11717,7 +12601,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -11732,16 +12616,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for UdpSocket { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]udp-socket"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]udp-socket"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -11754,7 +12640,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -11769,16 +12655,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for IncomingDatagramStream { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]incoming-datagram-stream"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]incoming-datagram-stream"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -11791,7 +12679,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -11806,16 +12694,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for OutgoingDatagramStream { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]outgoing-datagram-stream"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]outgoing-datagram-stream"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -11847,6 +12737,7 @@ pub mod wasi { /// - /// - /// - + #[allow(async_fn_in_trait)] pub fn start_bind( &self, network: &Network, @@ -11921,7 +12812,7 @@ pub mod wasi { let ptr6 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]udp-socket.start-bind"] fn wit_import7( _: i32, @@ -11942,7 +12833,7 @@ pub mod wasi { ); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import7( + unsafe extern "C" fn wit_import7( _: i32, _: i32, _: i32, @@ -12001,6 +12892,7 @@ pub mod wasi { } impl UdpSocket { #[allow(unused_unsafe, clippy::all)] + #[allow(async_fn_in_trait)] pub fn finish_bind(&self) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] @@ -12011,12 +12903,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]udp-socket.finish-bind"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -12083,6 +12975,7 @@ pub mod wasi { /// - /// - /// - + #[allow(async_fn_in_trait)] pub fn stream( &self, remote_address: Option, @@ -12209,7 +13102,7 @@ pub mod wasi { let ptr7 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]udp-socket.stream"] fn wit_import8( _: i32, @@ -12230,7 +13123,7 @@ pub mod wasi { ); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import8( + unsafe extern "C" fn wit_import8( _: i32, _: i32, _: i32, @@ -12312,6 +13205,7 @@ pub mod wasi { /// - /// - /// - + #[allow(async_fn_in_trait)] pub fn local_address(&self) -> Result { unsafe { #[repr(align(4))] @@ -12322,12 +13216,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]udp-socket.local-address"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -12416,6 +13310,7 @@ pub mod wasi { /// - /// - /// - + #[allow(async_fn_in_trait)] pub fn remote_address(&self) -> Result { unsafe { #[repr(align(4))] @@ -12426,12 +13321,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]udp-socket.remote-address"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -12513,16 +13408,17 @@ pub mod wasi { /// Whether this is a IPv4 or IPv6 socket. /// /// Equivalent to the SO_DOMAIN socket option. + #[allow(async_fn_in_trait)] pub fn address_family(&self) -> IpAddressFamily { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]udp-socket.address-family"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -12540,6 +13436,7 @@ pub mod wasi { /// /// # Typical errors /// - `invalid-argument`: (set) The TTL value must be 1 or higher. + #[allow(async_fn_in_trait)] pub fn unicast_hop_limit(&self) -> Result { unsafe { #[repr(align(1))] @@ -12550,12 +13447,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]udp-socket.unicast-hop-limit"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -12585,6 +13482,7 @@ pub mod wasi { } impl UdpSocket { #[allow(unused_unsafe, clippy::all)] + #[allow(async_fn_in_trait)] pub fn set_unicast_hop_limit(&self, value: u8) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] @@ -12595,12 +13493,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]udp-socket.set-unicast-hop-limit"] fn wit_import1(_: i32, _: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, _rt::as_i32(&value), ptr0); @@ -12637,6 +13535,7 @@ pub mod wasi { /// /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. + #[allow(async_fn_in_trait)] pub fn receive_buffer_size(&self) -> Result { unsafe { #[repr(align(8))] @@ -12647,12 +13546,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]udp-socket.receive-buffer-size"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -12682,6 +13581,7 @@ pub mod wasi { } impl UdpSocket { #[allow(unused_unsafe, clippy::all)] + #[allow(async_fn_in_trait)] pub fn set_receive_buffer_size( &self, value: u64, @@ -12695,12 +13595,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]udp-socket.set-receive-buffer-size"] fn wit_import1(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, _rt::as_i64(&value), ptr0); @@ -12727,6 +13627,7 @@ pub mod wasi { } impl UdpSocket { #[allow(unused_unsafe, clippy::all)] + #[allow(async_fn_in_trait)] pub fn send_buffer_size(&self) -> Result { unsafe { #[repr(align(8))] @@ -12737,12 +13638,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]udp-socket.send-buffer-size"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -12772,6 +13673,7 @@ pub mod wasi { } impl UdpSocket { #[allow(unused_unsafe, clippy::all)] + #[allow(async_fn_in_trait)] pub fn set_send_buffer_size(&self, value: u64) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] @@ -12782,12 +13684,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]udp-socket.set-send-buffer-size"] fn wit_import1(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, _rt::as_i64(&value), ptr0); @@ -12818,16 +13720,17 @@ pub mod wasi { /// /// Note: this function is here for WASI 0.2 only. /// It's planned to be removed when `future` is natively supported in Preview3. + #[allow(async_fn_in_trait)] pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]udp-socket.subscribe"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -12862,25 +13765,32 @@ pub mod wasi { /// - /// - /// - + #[allow(async_fn_in_trait)] pub fn receive( &self, max_results: u64, ) -> Result<_rt::Vec, ErrorCode> { unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 12]); + #[cfg_attr(target_pointer_width = "64", repr(align(8)))] + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] + struct RetArea( + [::core::mem::MaybeUninit< + u8, + >; 3 * ::core::mem::size_of::<*const u8>()], + ); let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 12], + [::core::mem::MaybeUninit::uninit(); 3 + * ::core::mem::size_of::<*const u8>()], ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]incoming-datagram-stream.receive"] fn wit_import1(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } wit_import1( @@ -12892,27 +13802,58 @@ pub mod wasi { let result28 = match l2 { 0 => { let e = { - let l3 = *ptr0.add(4).cast::<*mut u8>(); - let l4 = *ptr0.add(8).cast::(); + let l3 = *ptr0 + .add(::core::mem::size_of::<*const u8>()) + .cast::<*mut u8>(); + let l4 = *ptr0 + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::(); let base26 = l3; let len26 = l4; let mut result26 = _rt::Vec::with_capacity(len26); for i in 0..len26 { - let base = base26.add(i * 40); + let base = base26 + .add(i * (32 + 2 * ::core::mem::size_of::<*const u8>())); let e26 = { let l5 = *base.add(0).cast::<*mut u8>(); - let l6 = *base.add(4).cast::(); + let l6 = *base + .add(::core::mem::size_of::<*const u8>()) + .cast::(); let len7 = l6; - let l8 = i32::from(*base.add(8).cast::()); + let l8 = i32::from( + *base + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); use super::super::super::wasi::sockets::network::IpSocketAddress as V25; let v25 = match l8 { 0 => { let e25 = { - let l9 = i32::from(*base.add(12).cast::()); - let l10 = i32::from(*base.add(14).cast::()); - let l11 = i32::from(*base.add(15).cast::()); - let l12 = i32::from(*base.add(16).cast::()); - let l13 = i32::from(*base.add(17).cast::()); + let l9 = i32::from( + *base + .add(4 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); + let l10 = i32::from( + *base + .add(6 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); + let l11 = i32::from( + *base + .add(7 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); + let l12 = i32::from( + *base + .add(8 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); + let l13 = i32::from( + *base + .add(9 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); super::super::super::wasi::sockets::network::Ipv4SocketAddress { port: l9 as u16, address: (l10 as u8, l11 as u8, l12 as u8, l13 as u8), @@ -12923,17 +13864,57 @@ pub mod wasi { n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); let e25 = { - let l14 = i32::from(*base.add(12).cast::()); - let l15 = *base.add(16).cast::(); - let l16 = i32::from(*base.add(20).cast::()); - let l17 = i32::from(*base.add(22).cast::()); - let l18 = i32::from(*base.add(24).cast::()); - let l19 = i32::from(*base.add(26).cast::()); - let l20 = i32::from(*base.add(28).cast::()); - let l21 = i32::from(*base.add(30).cast::()); - let l22 = i32::from(*base.add(32).cast::()); - let l23 = i32::from(*base.add(34).cast::()); - let l24 = *base.add(36).cast::(); + let l14 = i32::from( + *base + .add(4 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); + let l15 = *base + .add(8 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); + let l16 = i32::from( + *base + .add(12 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); + let l17 = i32::from( + *base + .add(14 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); + let l18 = i32::from( + *base + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); + let l19 = i32::from( + *base + .add(18 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); + let l20 = i32::from( + *base + .add(20 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); + let l21 = i32::from( + *base + .add(22 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); + let l22 = i32::from( + *base + .add(24 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); + let l23 = i32::from( + *base + .add(26 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(), + ); + let l24 = *base + .add(28 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::(); super::super::super::wasi::sockets::network::Ipv6SocketAddress { port: l14 as u16, flow_info: l15 as u32, @@ -12960,14 +13941,20 @@ pub mod wasi { }; result26.push(e26); } - _rt::cabi_dealloc(base26, len26 * 40, 4); + _rt::cabi_dealloc( + base26, + len26 * (32 + 2 * ::core::mem::size_of::<*const u8>()), + ::core::mem::size_of::<*const u8>(), + ); result26 }; Ok(e) } 1 => { let e = { - let l27 = i32::from(*ptr0.add(4).cast::()); + let l27 = i32::from( + *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), + ); super::super::super::wasi::sockets::network::ErrorCode::_lift( l27 as u8, ) @@ -12986,16 +13973,17 @@ pub mod wasi { /// /// Note: this function is here for WASI 0.2 only. /// It's planned to be removed when `future` is natively supported in Preview3. + #[allow(async_fn_in_trait)] pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]incoming-datagram-stream.subscribe"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -13018,6 +14006,7 @@ pub mod wasi { /// error. /// /// Never returns `would-block`. + #[allow(async_fn_in_trait)] pub fn check_send(&self) -> Result { unsafe { #[repr(align(8))] @@ -13028,12 +14017,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]outgoing-datagram-stream.check-send"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -13097,6 +14086,7 @@ pub mod wasi { /// - /// - /// - + #[allow(async_fn_in_trait)] pub fn send( &self, datagrams: &[OutgoingDatagram], @@ -13109,21 +14099,17 @@ pub mod wasi { ); let vec7 = datagrams; let len7 = vec7.len(); - let layout7 = _rt::alloc::Layout::from_size_align_unchecked( - vec7.len() * 44, - 4, - ); - let result7 = if layout7.size() != 0 { - let ptr = _rt::alloc::alloc(layout7).cast::(); - if ptr.is_null() { - _rt::alloc::handle_alloc_error(layout7); - } - ptr - } else { - ::core::ptr::null_mut() - }; + let layout7 = _rt::alloc::Layout::from_size_align( + vec7.len() * (32 + 3 * ::core::mem::size_of::<*const u8>()), + ::core::mem::size_of::<*const u8>(), + ) + .unwrap(); + let (result7, _cleanup7) = wit_bindgen::rt::Cleanup::new( + layout7, + ); for (i, e) in vec7.into_iter().enumerate() { - let base = result7.add(i * 44); + let base = result7 + .add(i * (32 + 3 * ::core::mem::size_of::<*const u8>())); { let OutgoingDatagram { data: data0, @@ -13132,51 +14118,93 @@ pub mod wasi { let vec1 = data0; let ptr1 = vec1.as_ptr().cast::(); let len1 = vec1.len(); - *base.add(4).cast::() = len1; + *base + .add(::core::mem::size_of::<*const u8>()) + .cast::() = len1; *base.add(0).cast::<*mut u8>() = ptr1.cast_mut(); match remote_address0 { Some(e) => { - *base.add(8).cast::() = (1i32) as u8; + *base + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::() = (1i32) as u8; use super::super::super::wasi::sockets::network::IpSocketAddress as V6; match e { V6::Ipv4(e) => { - *base.add(12).cast::() = (0i32) as u8; + *base + .add(4 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::() = (0i32) as u8; let super::super::super::wasi::sockets::network::Ipv4SocketAddress { port: port2, address: address2, } = e; - *base.add(16).cast::() = (_rt::as_i32(port2)) as u16; + *base + .add(8 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::() = (_rt::as_i32(port2)) as u16; let (t3_0, t3_1, t3_2, t3_3) = address2; - *base.add(18).cast::() = (_rt::as_i32(t3_0)) as u8; - *base.add(19).cast::() = (_rt::as_i32(t3_1)) as u8; - *base.add(20).cast::() = (_rt::as_i32(t3_2)) as u8; - *base.add(21).cast::() = (_rt::as_i32(t3_3)) as u8; + *base + .add(10 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::() = (_rt::as_i32(t3_0)) as u8; + *base + .add(11 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::() = (_rt::as_i32(t3_1)) as u8; + *base + .add(12 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::() = (_rt::as_i32(t3_2)) as u8; + *base + .add(13 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::() = (_rt::as_i32(t3_3)) as u8; } V6::Ipv6(e) => { - *base.add(12).cast::() = (1i32) as u8; + *base + .add(4 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::() = (1i32) as u8; let super::super::super::wasi::sockets::network::Ipv6SocketAddress { port: port4, flow_info: flow_info4, address: address4, scope_id: scope_id4, } = e; - *base.add(16).cast::() = (_rt::as_i32(port4)) as u16; - *base.add(20).cast::() = _rt::as_i32(flow_info4); + *base + .add(8 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::() = (_rt::as_i32(port4)) as u16; + *base + .add(12 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::() = _rt::as_i32(flow_info4); let (t5_0, t5_1, t5_2, t5_3, t5_4, t5_5, t5_6, t5_7) = address4; - *base.add(24).cast::() = (_rt::as_i32(t5_0)) as u16; - *base.add(26).cast::() = (_rt::as_i32(t5_1)) as u16; - *base.add(28).cast::() = (_rt::as_i32(t5_2)) as u16; - *base.add(30).cast::() = (_rt::as_i32(t5_3)) as u16; - *base.add(32).cast::() = (_rt::as_i32(t5_4)) as u16; - *base.add(34).cast::() = (_rt::as_i32(t5_5)) as u16; - *base.add(36).cast::() = (_rt::as_i32(t5_6)) as u16; - *base.add(38).cast::() = (_rt::as_i32(t5_7)) as u16; - *base.add(40).cast::() = _rt::as_i32(scope_id4); + *base + .add(16 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::() = (_rt::as_i32(t5_0)) as u16; + *base + .add(18 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::() = (_rt::as_i32(t5_1)) as u16; + *base + .add(20 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::() = (_rt::as_i32(t5_2)) as u16; + *base + .add(22 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::() = (_rt::as_i32(t5_3)) as u16; + *base + .add(24 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::() = (_rt::as_i32(t5_4)) as u16; + *base + .add(26 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::() = (_rt::as_i32(t5_5)) as u16; + *base + .add(28 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::() = (_rt::as_i32(t5_6)) as u16; + *base + .add(30 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::() = (_rt::as_i32(t5_7)) as u16; + *base + .add(32 + 2 * ::core::mem::size_of::<*const u8>()) + .cast::() = _rt::as_i32(scope_id4); } } } None => { - *base.add(8).cast::() = (0i32) as u8; + *base + .add(2 * ::core::mem::size_of::<*const u8>()) + .cast::() = (0i32) as u8; } }; } @@ -13184,12 +14212,12 @@ pub mod wasi { let ptr8 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]outgoing-datagram-stream.send"] fn wit_import9(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import9( + unsafe extern "C" fn wit_import9( _: i32, _: *mut u8, _: usize, @@ -13218,9 +14246,6 @@ pub mod wasi { } _ => _rt::invalid_enum_discriminant(), }; - if layout7.size() != 0 { - _rt::alloc::dealloc(result7.cast(), layout7); - } result13 } } @@ -13231,16 +14256,17 @@ pub mod wasi { /// /// Note: this function is here for WASI 0.2 only. /// It's planned to be removed when `future` is natively supported in Preview3. + #[allow(async_fn_in_trait)] pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]outgoing-datagram-stream.subscribe"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -13251,7 +14277,7 @@ pub mod wasi { } } } - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod udp_create_socket { #[used] #[doc(hidden)] @@ -13281,6 +14307,7 @@ pub mod wasi { /// - /// - /// - + #[allow(async_fn_in_trait)] pub fn create_udp_socket( address_family: IpAddressFamily, ) -> Result { @@ -13291,12 +14318,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp-create-socket@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "create-udp-socket"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1(address_family.clone() as i32, ptr0); @@ -13326,7 +14353,7 @@ pub mod wasi { } } } - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod tcp { #[used] #[doc(hidden)] @@ -13372,7 +14399,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn _lift(val: u8) -> ShutdownType { if !cfg!(debug_assertions) { - return ::core::mem::transmute(val); + return unsafe { ::core::mem::transmute(val) }; } match val { 0 => ShutdownType::Receive, @@ -13412,7 +14439,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -13427,16 +14454,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for TcpSocket { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]tcp-socket"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]tcp-socket"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -13480,6 +14509,7 @@ pub mod wasi { /// - /// - /// - + #[allow(async_fn_in_trait)] pub fn start_bind( &self, network: &Network, @@ -13554,7 +14584,7 @@ pub mod wasi { let ptr6 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.start-bind"] fn wit_import7( _: i32, @@ -13575,7 +14605,7 @@ pub mod wasi { ); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import7( + unsafe extern "C" fn wit_import7( _: i32, _: i32, _: i32, @@ -13634,6 +14664,7 @@ pub mod wasi { } impl TcpSocket { #[allow(unused_unsafe, clippy::all)] + #[allow(async_fn_in_trait)] pub fn finish_bind(&self) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] @@ -13644,12 +14675,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.finish-bind"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -13718,6 +14749,7 @@ pub mod wasi { /// - /// - /// - + #[allow(async_fn_in_trait)] pub fn start_connect( &self, network: &Network, @@ -13792,7 +14824,7 @@ pub mod wasi { let ptr6 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.start-connect"] fn wit_import7( _: i32, @@ -13813,7 +14845,7 @@ pub mod wasi { ); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import7( + unsafe extern "C" fn wit_import7( _: i32, _: i32, _: i32, @@ -13872,6 +14904,7 @@ pub mod wasi { } impl TcpSocket { #[allow(unused_unsafe, clippy::all)] + #[allow(async_fn_in_trait)] pub fn finish_connect( &self, ) -> Result<(InputStream, OutputStream), ErrorCode> { @@ -13884,12 +14917,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.finish-connect"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -13952,6 +14985,7 @@ pub mod wasi { /// - /// - /// - + #[allow(async_fn_in_trait)] pub fn start_listen(&self) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] @@ -13962,12 +14996,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.start-listen"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -13994,6 +15028,7 @@ pub mod wasi { } impl TcpSocket { #[allow(unused_unsafe, clippy::all)] + #[allow(async_fn_in_trait)] pub fn finish_listen(&self) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] @@ -14004,12 +15039,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.finish-listen"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -14062,6 +15097,7 @@ pub mod wasi { /// - /// - /// - + #[allow(async_fn_in_trait)] pub fn accept( &self, ) -> Result<(TcpSocket, InputStream, OutputStream), ErrorCode> { @@ -14074,12 +15110,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.accept"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -14135,6 +15171,7 @@ pub mod wasi { /// - /// - /// - + #[allow(async_fn_in_trait)] pub fn local_address(&self) -> Result { unsafe { #[repr(align(4))] @@ -14145,12 +15182,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.local-address"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -14239,6 +15276,7 @@ pub mod wasi { /// - /// - /// - + #[allow(async_fn_in_trait)] pub fn remote_address(&self) -> Result { unsafe { #[repr(align(4))] @@ -14249,12 +15287,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.remote-address"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -14336,16 +15374,17 @@ pub mod wasi { /// Whether the socket is in the `listening` state. /// /// Equivalent to the SO_ACCEPTCONN socket option. + #[allow(async_fn_in_trait)] pub fn is_listening(&self) -> bool { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.is-listening"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -14358,16 +15397,17 @@ pub mod wasi { /// Whether this is a IPv4 or IPv6 socket. /// /// Equivalent to the SO_DOMAIN socket option. + #[allow(async_fn_in_trait)] pub fn address_family(&self) -> IpAddressFamily { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.address-family"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -14388,6 +15428,7 @@ pub mod wasi { /// - `not-supported`: (set) The platform does not support changing the backlog size after the initial listen. /// - `invalid-argument`: (set) The provided value was 0. /// - `invalid-state`: (set) The socket is in the `connect-in-progress` or `connected` state. + #[allow(async_fn_in_trait)] pub fn set_listen_backlog_size( &self, value: u64, @@ -14401,12 +15442,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.set-listen-backlog-size"] fn wit_import1(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, _rt::as_i64(&value), ptr0); @@ -14442,6 +15483,7 @@ pub mod wasi { /// These properties can be configured while `keep-alive-enabled` is false, but only come into effect when `keep-alive-enabled` is true. /// /// Equivalent to the SO_KEEPALIVE socket option. + #[allow(async_fn_in_trait)] pub fn keep_alive_enabled(&self) -> Result { unsafe { #[repr(align(1))] @@ -14452,12 +15494,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.keep-alive-enabled"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -14487,6 +15529,7 @@ pub mod wasi { } impl TcpSocket { #[allow(unused_unsafe, clippy::all)] + #[allow(async_fn_in_trait)] pub fn set_keep_alive_enabled( &self, value: bool, @@ -14500,12 +15543,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.set-keep-alive-enabled"] fn wit_import1(_: i32, _: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { unreachable!() } wit_import1( @@ -14549,6 +15592,7 @@ pub mod wasi { /// /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. + #[allow(async_fn_in_trait)] pub fn keep_alive_idle_time(&self) -> Result { unsafe { #[repr(align(8))] @@ -14559,12 +15603,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.keep-alive-idle-time"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -14594,6 +15638,7 @@ pub mod wasi { } impl TcpSocket { #[allow(unused_unsafe, clippy::all)] + #[allow(async_fn_in_trait)] pub fn set_keep_alive_idle_time( &self, value: Duration, @@ -14607,12 +15652,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.set-keep-alive-idle-time"] fn wit_import1(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, _rt::as_i64(value), ptr0); @@ -14649,6 +15694,7 @@ pub mod wasi { /// /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. + #[allow(async_fn_in_trait)] pub fn keep_alive_interval(&self) -> Result { unsafe { #[repr(align(8))] @@ -14659,12 +15705,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.keep-alive-interval"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -14694,6 +15740,7 @@ pub mod wasi { } impl TcpSocket { #[allow(unused_unsafe, clippy::all)] + #[allow(async_fn_in_trait)] pub fn set_keep_alive_interval( &self, value: Duration, @@ -14707,12 +15754,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.set-keep-alive-interval"] fn wit_import1(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, _rt::as_i64(value), ptr0); @@ -14749,6 +15796,7 @@ pub mod wasi { /// /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. + #[allow(async_fn_in_trait)] pub fn keep_alive_count(&self) -> Result { unsafe { #[repr(align(4))] @@ -14759,12 +15807,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.keep-alive-count"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -14794,6 +15842,7 @@ pub mod wasi { } impl TcpSocket { #[allow(unused_unsafe, clippy::all)] + #[allow(async_fn_in_trait)] pub fn set_keep_alive_count(&self, value: u32) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] @@ -14804,12 +15853,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.set-keep-alive-count"] fn wit_import1(_: i32, _: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, _rt::as_i32(&value), ptr0); @@ -14842,6 +15891,7 @@ pub mod wasi { /// /// # Typical errors /// - `invalid-argument`: (set) The TTL value must be 1 or higher. + #[allow(async_fn_in_trait)] pub fn hop_limit(&self) -> Result { unsafe { #[repr(align(1))] @@ -14852,12 +15902,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.hop-limit"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -14887,6 +15937,7 @@ pub mod wasi { } impl TcpSocket { #[allow(unused_unsafe, clippy::all)] + #[allow(async_fn_in_trait)] pub fn set_hop_limit(&self, value: u8) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] @@ -14897,12 +15948,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.set-hop-limit"] fn wit_import1(_: i32, _: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, _rt::as_i32(&value), ptr0); @@ -14939,6 +15990,7 @@ pub mod wasi { /// /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. + #[allow(async_fn_in_trait)] pub fn receive_buffer_size(&self) -> Result { unsafe { #[repr(align(8))] @@ -14949,12 +16001,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.receive-buffer-size"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -14984,6 +16036,7 @@ pub mod wasi { } impl TcpSocket { #[allow(unused_unsafe, clippy::all)] + #[allow(async_fn_in_trait)] pub fn set_receive_buffer_size( &self, value: u64, @@ -14997,12 +16050,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.set-receive-buffer-size"] fn wit_import1(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, _rt::as_i64(&value), ptr0); @@ -15029,6 +16082,7 @@ pub mod wasi { } impl TcpSocket { #[allow(unused_unsafe, clippy::all)] + #[allow(async_fn_in_trait)] pub fn send_buffer_size(&self) -> Result { unsafe { #[repr(align(8))] @@ -15039,12 +16093,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.send-buffer-size"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -15074,6 +16128,7 @@ pub mod wasi { } impl TcpSocket { #[allow(unused_unsafe, clippy::all)] + #[allow(async_fn_in_trait)] pub fn set_send_buffer_size(&self, value: u64) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] @@ -15084,12 +16139,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.set-send-buffer-size"] fn wit_import1(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, _rt::as_i64(&value), ptr0); @@ -15133,16 +16188,17 @@ pub mod wasi { /// /// Note: this function is here for WASI 0.2 only. /// It's planned to be removed when `future` is natively supported in Preview3. + #[allow(async_fn_in_trait)] pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.subscribe"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -15177,6 +16233,7 @@ pub mod wasi { /// - /// - /// - + #[allow(async_fn_in_trait)] pub fn shutdown( &self, shutdown_type: ShutdownType, @@ -15190,12 +16247,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]tcp-socket.shutdown"] fn wit_import1(_: i32, _: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { unreachable!() } wit_import1( @@ -15225,7 +16282,7 @@ pub mod wasi { } } } - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod tcp_create_socket { #[used] #[doc(hidden)] @@ -15255,6 +16312,7 @@ pub mod wasi { /// - /// - /// - + #[allow(async_fn_in_trait)] pub fn create_tcp_socket( address_family: IpAddressFamily, ) -> Result { @@ -15265,12 +16323,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp-create-socket@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "create-tcp-socket"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1(address_family.clone() as i32, ptr0); @@ -15300,7 +16358,7 @@ pub mod wasi { } } } - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod ip_name_lookup { #[used] #[doc(hidden)] @@ -15319,7 +16377,7 @@ pub mod wasi { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: _rt::Resource::from_handle(handle), + handle: unsafe { _rt::Resource::from_handle(handle) }, } } #[doc(hidden)] @@ -15334,16 +16392,18 @@ pub mod wasi { unsafe impl _rt::WasmResource for ResolveAddressStream { #[inline] unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.4")] - extern "C" { - #[link_name = "[resource-drop]resolve-address-stream"] - fn drop(_: u32); - } - drop(_handle); + #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.4")] + unsafe extern "C" { + #[link_name = "[resource-drop]resolve-address-stream"] + fn drop(_: i32); + } + #[cfg(not(target_arch = "wasm32"))] + unsafe extern "C" fn drop(_: i32) { + unreachable!() + } + unsafe { + drop(_handle as i32); } } } @@ -15368,6 +16428,7 @@ pub mod wasi { /// - /// - /// - + #[allow(async_fn_in_trait)] pub fn resolve_addresses( network: &Network, name: &str, @@ -15382,12 +16443,17 @@ pub mod wasi { let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "resolve-addresses"] fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8) { + unsafe extern "C" fn wit_import2( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ) { unreachable!() } wit_import2((network).handle() as i32, ptr0.cast_mut(), len0, ptr1); @@ -15429,6 +16495,7 @@ pub mod wasi { /// - `temporary-resolver-failure`: A temporary failure in name resolution occurred. (EAI_AGAIN) /// - `permanent-resolver-failure`: A permanent failure in name resolution occurred. (EAI_FAIL) /// - `would-block`: A result is not available yet. (EWOULDBLOCK, EAGAIN) + #[allow(async_fn_in_trait)] pub fn resolve_next_address( &self, ) -> Result, ErrorCode> { @@ -15441,12 +16508,12 @@ pub mod wasi { let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]resolve-address-stream.resolve-next-address"] fn wit_import1(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import1(_: i32, _: *mut u8) { + unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } wit_import1((self).handle() as i32, ptr0); @@ -15527,16 +16594,17 @@ pub mod wasi { /// /// Note: this function is here for WASI 0.2 only. /// It's planned to be removed when `future` is natively supported in Preview3. + #[allow(async_fn_in_trait)] pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.4")] - extern "C" { + unsafe extern "C" { #[link_name = "[method]resolve-address-stream.subscribe"] fn wit_import0(_: i32) -> i32; } #[cfg(not(target_arch = "wasm32"))] - extern "C" fn wit_import0(_: i32) -> i32 { + unsafe extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } let ret = wit_import0((self).handle() as i32); @@ -15584,7 +16652,7 @@ mod _rt { impl Resource { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { - debug_assert!(handle != u32::MAX); + debug_assert!(handle != 0 && handle != u32::MAX); Self { handle: AtomicU32::new(handle), _marker: marker::PhantomData, @@ -15667,22 +16735,24 @@ mod _rt { if cfg!(debug_assertions) { String::from_utf8(bytes).unwrap() } else { - String::from_utf8_unchecked(bytes) + unsafe { String::from_utf8_unchecked(bytes) } } } pub unsafe fn invalid_enum_discriminant() -> T { if cfg!(debug_assertions) { panic!("invalid enum discriminant") } else { - core::hint::unreachable_unchecked() + unsafe { core::hint::unreachable_unchecked() } } } pub unsafe fn cabi_dealloc(ptr: *mut u8, size: usize, align: usize) { if size == 0 { return; } - let layout = alloc::Layout::from_size_align_unchecked(size, align); - alloc::dealloc(ptr, layout); + unsafe { + let layout = alloc::Layout::from_size_align_unchecked(size, align); + alloc::dealloc(ptr, layout); + } } pub fn as_i32(t: T) -> i32 { t.as_i32() @@ -15745,10 +16815,12 @@ mod _rt { } extern crate alloc as alloc_crate; } +#[rustfmt::skip] #[cfg(target_arch = "wasm32")] -#[unsafe( - link_section = "component-type:wit-bindgen:0.39.0:rust:wasi:bindings:encoded worldrust-wasi-from-crates-io" -)] + +#[cfg_attr(feature = "rustc-dep-of-std", unsafe(link_section = "component-type:wit-bindgen:0.45.0:rust:wasi:bindings:encoded worldrust-wasi-from-crates-io-in-libstd"))] +#[cfg_attr(not(feature = "rustc-dep-of-std"), unsafe(link_section = "component-type:wit-bindgen:0.45.0:rust:wasi:bindings:encoded worldrust-wasi-from-crates-io"))] + #[doc(hidden)] #[allow(clippy::octal_escapes)] pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 15623] = *b"\ @@ -16062,9 +17134,9 @@ get-insecure-random-bytes\x01\x01\x01@\0\0w\x04\0\x17get-insecure-random-u64\x01 \x02\x03\0\x1awasi:random/insecure@0.2.4\x050\x01B\x03\x01o\x02ww\x01@\0\0\0\x04\ \0\x0dinsecure-seed\x01\x01\x03\0\x1fwasi:random/insecure-seed@0.2.4\x051\x04\0\x12\ rust:wasi/bindings\x04\0\x0b\x0e\x01\0\x08bindings\x03\0\0\0G\x09producers\x01\x0c\ -processed-by\x02\x0dwit-component\x070.225.0\x10wit-bindgen-rust\x060.39.0"; +processed-by\x02\x0dwit-component\x070.238.0\x10wit-bindgen-rust\x060.45.0"; #[inline(never)] #[doc(hidden)] pub fn __link_custom_section_describing_imports() { - wit_bindgen_rt::maybe_link_cabi_realloc(); + wit_bindgen::rt::maybe_link_cabi_realloc(); } diff --git a/src/command.rs b/src/command.rs index ba8ca57..1242cf8 100644 --- a/src/command.rs +++ b/src/command.rs @@ -1,7 +1,6 @@ -// Generated by `wit-bindgen` 0.39.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.45.0. DO NOT EDIT! // Options used: // * std_feature -// * runtime_path: "wit_bindgen_rt" // * with "wasi:cli/environment@0.2.4" = "crate::cli::environment" // * with "wasi:cli/exit@0.2.4" = "crate::cli::exit" // * with "wasi:cli/stdin@0.2.4" = "crate::cli::stdin" @@ -65,25 +64,28 @@ use crate::random::insecure_seed as __with_name26; pub mod exports { pub mod wasi { pub mod cli { - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod run { #[used] #[doc(hidden)] static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; use super::super::super::super::_rt; #[doc(hidden)] - #[allow(non_snake_case)] + #[allow(non_snake_case, unused_unsafe)] pub unsafe fn _export_run_cabi() -> i32 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let result0 = T::run(); - let result1 = match result0 { - Ok(_) => 0i32, - Err(_) => 1i32, - }; - result1 + unsafe { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + let result0 = { T::run() }; + let result1 = match result0 { + Ok(_) => 0i32, + Err(_) => 1i32, + }; + result1 + } } pub trait Guest { /// Run the program. + #[allow(async_fn_in_trait)] fn run() -> Result<(), ()>; } #[doc(hidden)] @@ -92,7 +94,8 @@ pub mod exports { ($ty:ident with_types_in $($path_to_types:tt)*) => { const _ : () = { #[unsafe (export_name = "wasi:cli/run@0.2.4#run")] unsafe extern "C" fn export_run() -> - i32 { $($path_to_types)*:: _export_run_cabi::<$ty > () } }; + i32 { unsafe { $($path_to_types)*:: _export_run_cabi::<$ty > () } + } }; }; } #[doc(hidden)] @@ -106,7 +109,7 @@ mod _rt { #![allow(dead_code, clippy::all)] #[cfg(target_arch = "wasm32")] pub fn run_ctors_once() { - wit_bindgen_rt::run_ctors_once(); + wit_bindgen::rt::run_ctors_once(); } } /// Generates `#[unsafe(no_mangle)]` functions to export the specified type as @@ -136,8 +139,8 @@ macro_rules! __export_command_impl { $($path_to_types_root)*:: exports::wasi::cli::run::__export_wasi_cli_run_0_2_4_cabi!($ty with_types_in $($path_to_types_root)*:: exports::wasi::cli::run); const _ : () = { - #[cfg(target_arch = "wasm32")] #[unsafe (link_section = - "component-type:wit-bindgen:0.39.0:wasi:cli@0.2.4:command:imports and exportsrust-wasi-from-crates-io-command-world")] + #[rustfmt::skip] #[cfg(target_arch = "wasm32")] #[unsafe (link_section = + "component-type:wit-bindgen:0.45.0:wasi:cli@0.2.4:command:imports and exportsrust-wasi-from-crates-io-command-world")] #[doc(hidden)] #[allow(clippy::octal_escapes)] pub static __WIT_BINDGEN_COMPONENT_TYPE : [u8; 10773] = * b"\ @@ -357,17 +360,19 @@ nsecure-random-u64\x01\x02\x03\0\x1awasi:random/insecure@0.2.4\x05*\x01B\x03\x01 o\x02ww\x01@\0\0\0\x04\0\x0dinsecure-seed\x01\x01\x03\0\x1fwasi:random/insecure-\ seed@0.2.4\x05+\x01B\x03\x01j\0\0\x01@\0\0\0\x04\0\x03run\x01\x01\x04\0\x12wasi:\ cli/run@0.2.4\x05,\x04\0\x16wasi:cli/command@0.2.4\x04\0\x0b\x0d\x01\0\x07comman\ -d\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.225.0\x10\ -wit-bindgen-rust\x060.39.0"; +d\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.238.0\x10\ +wit-bindgen-rust\x060.45.0"; }; }; } #[doc(inline)] pub use __export_command_impl as _export_command; +#[rustfmt::skip] #[cfg(target_arch = "wasm32")] -#[unsafe( - link_section = "component-type:wit-bindgen:0.39.0:wasi:cli@0.2.4:command-with-all-of-its-exports-removed:encoded worldrust-wasi-from-crates-io-command-world" -)] + +#[cfg_attr(feature = "rustc-dep-of-std", unsafe(link_section = "component-type:wit-bindgen:0.45.0:wasi:cli@0.2.4:command-with-all-of-its-exports-removed:encoded worldrust-wasi-from-crates-io-command-world-in-libstd"))] +#[cfg_attr(not(feature = "rustc-dep-of-std"), unsafe(link_section = "component-type:wit-bindgen:0.45.0:wasi:cli@0.2.4:command-with-all-of-its-exports-removed:encoded worldrust-wasi-from-crates-io-command-world"))] + #[doc(hidden)] #[allow(clippy::octal_escapes)] pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 10794] = *b"\ @@ -587,9 +592,9 @@ nsecure-random-u64\x01\x02\x03\0\x1awasi:random/insecure@0.2.4\x05*\x01B\x03\x01 o\x02ww\x01@\0\0\0\x04\0\x0dinsecure-seed\x01\x01\x03\0\x1fwasi:random/insecure-\ seed@0.2.4\x05+\x04\06wasi:cli/command-with-all-of-its-exports-removed@0.2.4\x04\ \0\x0b-\x01\0'command-with-all-of-its-exports-removed\x03\0\0\0G\x09producers\x01\ -\x0cprocessed-by\x02\x0dwit-component\x070.225.0\x10wit-bindgen-rust\x060.39.0"; +\x0cprocessed-by\x02\x0dwit-component\x070.238.0\x10wit-bindgen-rust\x060.45.0"; #[inline(never)] #[doc(hidden)] pub fn __link_custom_section_describing_imports() { - wit_bindgen_rt::maybe_link_cabi_realloc(); + wit_bindgen::rt::maybe_link_cabi_realloc(); } diff --git a/src/proxy.rs b/src/proxy.rs index ed41635..527bc52 100644 --- a/src/proxy.rs +++ b/src/proxy.rs @@ -1,7 +1,6 @@ -// Generated by `wit-bindgen` 0.39.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.45.0. DO NOT EDIT! // Options used: // * std_feature -// * runtime_path: "wit_bindgen_rt" // * with "wasi:cli/stdin@0.2.4" = "crate::cli::stdin" // * with "wasi:cli/stdout@0.2.4" = "crate::cli::stdout" // * with "wasi:cli/stderr@0.2.4" = "crate::cli::stderr" @@ -35,7 +34,7 @@ pub mod exports { pub mod http { /// This interface defines a handler of incoming HTTP Requests. It should /// be exported by components which can respond to HTTP Requests. - #[allow(dead_code, unused_imports, clippy::all)] + #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] pub mod incoming_handler { #[used] #[doc(hidden)] @@ -44,17 +43,21 @@ pub mod exports { pub type IncomingRequest = super::super::super::super::__with_name9::IncomingRequest; pub type ResponseOutparam = super::super::super::super::__with_name9::ResponseOutparam; #[doc(hidden)] - #[allow(non_snake_case)] + #[allow(non_snake_case, unused_unsafe)] pub unsafe fn _export_handle_cabi(arg0: i32, arg1: i32) { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - T::handle( - super::super::super::super::__with_name9::IncomingRequest::from_handle( - arg0 as u32, - ), - super::super::super::super::__with_name9::ResponseOutparam::from_handle( - arg1 as u32, - ), - ); + unsafe { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); + { + T::handle( + super::super::super::super::__with_name9::IncomingRequest::from_handle( + arg0 as u32, + ), + super::super::super::super::__with_name9::ResponseOutparam::from_handle( + arg1 as u32, + ), + ) + }; + } } pub trait Guest { /// This function is invoked with an incoming HTTP Request, and a resource @@ -67,6 +70,7 @@ pub mod exports { /// The implementor of this function must write a response to the /// `response-outparam` before returning, or else the caller will respond /// with an error on its behalf. + #[allow(async_fn_in_trait)] fn handle( request: IncomingRequest, response_out: ResponseOutparam, @@ -78,8 +82,9 @@ pub mod exports { ($ty:ident with_types_in $($path_to_types:tt)*) => { const _ : () = { #[unsafe (export_name = "wasi:http/incoming-handler@0.2.4#handle")] unsafe extern "C" fn - export_handle(arg0 : i32, arg1 : i32,) { $($path_to_types)*:: - _export_handle_cabi::<$ty > (arg0, arg1) } }; + export_handle(arg0 : i32, arg1 : i32,) { unsafe { + $($path_to_types)*:: _export_handle_cabi::<$ty > (arg0, arg1) } } + }; }; } #[doc(hidden)] @@ -93,7 +98,7 @@ mod _rt { #![allow(dead_code, clippy::all)] #[cfg(target_arch = "wasm32")] pub fn run_ctors_once() { - wit_bindgen_rt::run_ctors_once(); + wit_bindgen::rt::run_ctors_once(); } } /// Generates `#[unsafe(no_mangle)]` functions to export the specified type as @@ -123,8 +128,9 @@ macro_rules! __export_proxy_impl { $($path_to_types_root)*:: exports::wasi::http::incoming_handler::__export_wasi_http_incoming_handler_0_2_4_cabi!($ty with_types_in $($path_to_types_root)*:: exports::wasi::http::incoming_handler); - const _ : () = { #[cfg(target_arch = "wasm32")] #[unsafe (link_section = - "component-type:wit-bindgen:0.39.0:wasi:http@0.2.4:proxy:imports and exportsrust-wasi-from-crates-io-proxy-world")] + const _ : () = { #[rustfmt::skip] #[cfg(target_arch = "wasm32")] #[unsafe + (link_section = + "component-type:wit-bindgen:0.45.0:wasi:http@0.2.4:proxy:imports and exportsrust-wasi-from-crates-io-proxy-world")] #[doc(hidden)] #[allow(clippy::octal_escapes)] pub static __WIT_BINDGEN_COMPONENT_TYPE : [u8; 7040] = * b"\ @@ -268,16 +274,18 @@ incoming-request\x02\x03\0\x09\x11response-outparam\x01B\x08\x02\x03\x02\x01\x14 m\x03\0\x02\x01i\x01\x01i\x03\x01@\x02\x07request\x04\x0cresponse-out\x05\x01\0\x04\ \0\x06handle\x01\x06\x04\0\x20wasi:http/incoming-handler@0.2.4\x05\x16\x04\0\x15\ wasi:http/proxy@0.2.4\x04\0\x0b\x0b\x01\0\x05proxy\x03\0\0\0G\x09producers\x01\x0c\ -processed-by\x02\x0dwit-component\x070.225.0\x10wit-bindgen-rust\x060.39.0"; +processed-by\x02\x0dwit-component\x070.238.0\x10wit-bindgen-rust\x060.45.0"; }; }; } #[doc(inline)] pub use __export_proxy_impl as _export_proxy; +#[rustfmt::skip] #[cfg(target_arch = "wasm32")] -#[unsafe( - link_section = "component-type:wit-bindgen:0.39.0:wasi:http@0.2.4:proxy-with-all-of-its-exports-removed:encoded worldrust-wasi-from-crates-io-proxy-world" -)] + +#[cfg_attr(feature = "rustc-dep-of-std", unsafe(link_section = "component-type:wit-bindgen:0.45.0:wasi:http@0.2.4:proxy-with-all-of-its-exports-removed:encoded worldrust-wasi-from-crates-io-proxy-world-in-libstd"))] +#[cfg_attr(not(feature = "rustc-dep-of-std"), unsafe(link_section = "component-type:wit-bindgen:0.45.0:wasi:http@0.2.4:proxy-with-all-of-its-exports-removed:encoded worldrust-wasi-from-crates-io-proxy-world"))] + #[doc(hidden)] #[allow(clippy::octal_escapes)] pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 6921] = *b"\ @@ -418,9 +426,9 @@ i\x05\x01j\x01\x0b\x01\x07\x01@\x02\x07request\x08\x07options\x0a\0\x0c\x04\0\x0 handle\x01\x0d\x03\0\x20wasi:http/outgoing-handler@0.2.4\x05\x13\x04\05wasi:http\ /proxy-with-all-of-its-exports-removed@0.2.4\x04\0\x0b+\x01\0%proxy-with-all-of-\ its-exports-removed\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-compo\ -nent\x070.225.0\x10wit-bindgen-rust\x060.39.0"; +nent\x070.238.0\x10wit-bindgen-rust\x060.45.0"; #[inline(never)] #[doc(hidden)] pub fn __link_custom_section_describing_imports() { - wit_bindgen_rt::maybe_link_cabi_realloc(); + wit_bindgen::rt::maybe_link_cabi_realloc(); }