diff --git a/Cargo.lock b/Cargo.lock index 5adfd6c34940..942db6fe3111 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4446,7 +4446,6 @@ name = "wasmtime" version = "41.0.0" dependencies = [ "addr2line 0.25.1", - "anyhow", "async-trait", "bitflags 2.9.4", "bumpalo", diff --git a/crates/component-macro/src/component.rs b/crates/component-macro/src/component.rs index 64504fa82ef9..dcb422cdc87d 100644 --- a/crates/component-macro/src/component.rs +++ b/crates/component-macro/src/component.rs @@ -413,7 +413,7 @@ fn expand_record_for_component_type( fn typecheck( ty: &#internal::InterfaceType, types: &#internal::InstanceType<'_>, - ) -> #internal::anyhow::Result<()> { + ) -> #wt::error::Result<()> { #internal::#typecheck(ty, types, &[#typecheck_argument]) } } @@ -489,7 +489,7 @@ impl Expander for LiftExpander { cx: &mut #internal::LiftContext<'_>, ty: #internal::InterfaceType, src: &Self::Lower, - ) -> #internal::anyhow::Result { + ) -> #wt::error::Result { #extract_ty Ok(Self { #lifts @@ -501,7 +501,7 @@ impl Expander for LiftExpander { cx: &mut #internal::LiftContext<'_>, ty: #internal::InterfaceType, bytes: &[u8], - ) -> #internal::anyhow::Result { + ) -> #wt::error::Result { #extract_ty debug_assert!( (bytes.as_ptr() as usize) @@ -580,11 +580,11 @@ impl Expander for LiftExpander { cx: &mut #internal::LiftContext<'_>, ty: #internal::InterfaceType, src: &Self::Lower, - ) -> #internal::anyhow::Result { + ) -> #wt::error::Result { #extract_ty Ok(match src.tag.get_u32() { #lifts - discrim => #internal::anyhow::bail!("unexpected discriminant: {}", discrim), + discrim => #wt::error::bail!("unexpected discriminant: {}", discrim), }) } @@ -593,7 +593,7 @@ impl Expander for LiftExpander { cx: &mut #internal::LiftContext<'_>, ty: #internal::InterfaceType, bytes: &[u8], - ) -> #internal::anyhow::Result { + ) -> #wt::error::Result { let align = ::ALIGN32; debug_assert!((bytes.as_ptr() as usize) % (align as usize) == 0); let discrim = #from_bytes; @@ -602,7 +602,7 @@ impl Expander for LiftExpander { #extract_ty Ok(match discrim { #loads - discrim => #internal::anyhow::bail!("unexpected discriminant: {}", discrim), + discrim => #wt::error::bail!("unexpected discriminant: {}", discrim), }) } } @@ -647,11 +647,11 @@ impl Expander for LiftExpander { cx: &mut #internal::LiftContext<'_>, ty: #internal::InterfaceType, src: &Self::Lower, - ) -> #internal::anyhow::Result { + ) -> #wt::error::Result { #extract_ty let discrim = src.tag.get_u32(); if discrim >= #discrim_limit { - #internal::anyhow::bail!("unexpected discriminant: {discrim}"); + #wt::error::bail!("unexpected discriminant: {discrim}"); } Ok(unsafe { #internal::transmute::<#discrim_ty, #name>(discrim as #discrim_ty) @@ -663,12 +663,12 @@ impl Expander for LiftExpander { cx: &mut #internal::LiftContext<'_>, ty: #internal::InterfaceType, bytes: &[u8], - ) -> #internal::anyhow::Result { + ) -> #wt::error::Result { let align = ::ALIGN32; debug_assert!((bytes.as_ptr() as usize) % (align as usize) == 0); let discrim = #from_bytes; if u32::from(discrim) >= #discrim_limit { - #internal::anyhow::bail!("unexpected discriminant: {discrim}"); + #wt::error::bail!("unexpected discriminant: {discrim}"); } Ok(unsafe { #internal::transmute::<#discrim_ty, #name>(discrim) @@ -728,7 +728,7 @@ impl Expander for LowerExpander { cx: &mut #internal::LowerContext<'_, T>, ty: #internal::InterfaceType, dst: &mut core::mem::MaybeUninit, - ) -> #internal::anyhow::Result<()> { + ) -> #wt::error::Result<()> { #extract_ty #lowers Ok(()) @@ -740,7 +740,7 @@ impl Expander for LowerExpander { cx: &mut #internal::LowerContext<'_, T>, ty: #internal::InterfaceType, mut offset: usize - ) -> #internal::anyhow::Result<()> { + ) -> #wt::error::Result<()> { debug_assert!(offset % (::ALIGN32 as usize) == 0); #extract_ty #stores @@ -826,7 +826,7 @@ impl Expander for LowerExpander { cx: &mut #internal::LowerContext<'_, T>, ty: #internal::InterfaceType, dst: &mut core::mem::MaybeUninit, - ) -> #internal::anyhow::Result<()> { + ) -> #wt::error::Result<()> { #extract_ty match self { #lowers @@ -839,7 +839,7 @@ impl Expander for LowerExpander { cx: &mut #internal::LowerContext<'_, T>, ty: #internal::InterfaceType, mut offset: usize - ) -> #internal::anyhow::Result<()> { + ) -> #wt::error::Result<()> { #extract_ty debug_assert!(offset % (::ALIGN32 as usize) == 0); match self { @@ -883,7 +883,7 @@ impl Expander for LowerExpander { cx: &mut #internal::LowerContext<'_, T>, ty: #internal::InterfaceType, dst: &mut core::mem::MaybeUninit, - ) -> #internal::anyhow::Result<()> { + ) -> #wt::error::Result<()> { #extract_ty #internal::map_maybe_uninit!(dst.tag) .write(#wt::ValRaw::u32(*self as u32)); @@ -896,7 +896,7 @@ impl Expander for LowerExpander { cx: &mut #internal::LowerContext<'_, T>, ty: #internal::InterfaceType, mut offset: usize - ) -> #internal::anyhow::Result<()> { + ) -> #wt::error::Result<()> { #extract_ty debug_assert!(offset % (::ALIGN32 as usize) == 0); let discrim = *self as #ty; @@ -1026,7 +1026,7 @@ impl Expander for ComponentTypeExpander { fn typecheck( ty: &#internal::InterfaceType, types: &#internal::InstanceType<'_>, - ) -> #internal::anyhow::Result<()> { + ) -> #wt::error::Result<()> { #internal::typecheck_variant(ty, types, &[#case_names_and_checks]) } @@ -1087,7 +1087,7 @@ impl Expander for ComponentTypeExpander { fn typecheck( ty: &#internal::InterfaceType, types: &#internal::InstanceType<'_>, - ) -> #internal::anyhow::Result<()> { + ) -> #wt::error::Result<()> { #internal::typecheck_enum(ty, types, &[#case_names]) } @@ -1472,7 +1472,7 @@ pub fn expand_flags(flags: &Flags) -> Result { cx: &mut #internal::LowerContext<'_, T>, _ty: #internal::InterfaceType, dst: &mut core::mem::MaybeUninit, - ) -> #internal::anyhow::Result<()> { + ) -> #wt::error::Result<()> { #( self.#field_names.linear_lower_to_flat( cx, @@ -1488,7 +1488,7 @@ pub fn expand_flags(flags: &Flags) -> Result { cx: &mut #internal::LowerContext<'_, T>, _ty: #internal::InterfaceType, mut offset: usize - ) -> #internal::anyhow::Result<()> { + ) -> #wt::error::Result<()> { debug_assert!(offset % (::ALIGN32 as usize) == 0); #( self.#field_names.linear_lower_to_memory( @@ -1507,7 +1507,7 @@ pub fn expand_flags(flags: &Flags) -> Result { cx: &mut #internal::LiftContext<'_>, _ty: #internal::InterfaceType, src: &Self::Lower, - ) -> #internal::anyhow::Result { + ) -> #wt::error::Result { Ok(Self { #( #field_names: #wt::component::Lift::linear_lift_from_flat( @@ -1523,7 +1523,7 @@ pub fn expand_flags(flags: &Flags) -> Result { cx: &mut #internal::LiftContext<'_>, _ty: #internal::InterfaceType, bytes: &[u8], - ) -> #internal::anyhow::Result { + ) -> #wt::error::Result { debug_assert!( (bytes.as_ptr() as usize) % (::ALIGN32 as usize) diff --git a/crates/component-macro/tests/codegen.rs b/crates/component-macro/tests/codegen.rs index 87427d8d6175..5f4c06fb77d2 100644 --- a/crates/component-macro/tests/codegen.rs +++ b/crates/component-macro/tests/codegen.rs @@ -43,8 +43,8 @@ macro_rules! gentest { component_macro_test_helpers::foreach!(gentest); mod with_key_and_resources { - use anyhow::Result; use wasmtime::component::Resource; + use wasmtime::error::Result; wasmtime::component::bindgen!({ inline: " diff --git a/crates/component-macro/tests/expanded.rs b/crates/component-macro/tests/expanded.rs index bb4711522cbb..3ea357464d08 100644 --- a/crates/component-macro/tests/expanded.rs +++ b/crates/component-macro/tests/expanded.rs @@ -1,6 +1,6 @@ use std::path::Path; -use anyhow::{Context, Result, bail}; +use wasmtime::error::{Context, Result, bail}; macro_rules! genexpand { ($id:ident $name:tt $path:tt) => { diff --git a/crates/component-macro/tests/expanded/char.rs b/crates/component-macro/tests/expanded/char.rs index c17404c9df74..597702ca9255 100644 --- a/crates/component-macro/tests/expanded/char.rs +++ b/crates/component-macro/tests/expanded/char.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::chars::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -190,7 +188,7 @@ pub mod foo { #[allow(clippy::all)] pub mod chars { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T where @@ -252,7 +250,7 @@ pub mod exports { #[allow(clippy::all)] pub mod chars { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { take_char: wasmtime::component::Func, @@ -277,7 +275,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/chars") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/chars`" ) })?; @@ -286,7 +284,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/chars` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/char_async.rs b/crates/component-macro/tests/expanded/char_async.rs index 203b118db4c2..be6ea895540c 100644 --- a/crates/component-macro/tests/expanded/char_async.rs +++ b/crates/component-macro/tests/expanded/char_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::chars::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -190,7 +188,7 @@ pub mod foo { #[allow(clippy::all)] pub mod chars { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T where @@ -266,7 +264,7 @@ pub mod exports { #[allow(clippy::all)] pub mod chars { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { take_char: wasmtime::component::Func, @@ -291,7 +289,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/chars") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/chars`" ) })?; @@ -300,7 +298,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/chars` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/char_concurrent.rs b/crates/component-macro/tests/expanded/char_concurrent.rs index a22cd8e2181c..05cebef854e2 100644 --- a/crates/component-macro/tests/expanded/char_concurrent.rs +++ b/crates/component-macro/tests/expanded/char_concurrent.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::chars::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -190,7 +188,7 @@ pub mod foo { #[allow(clippy::all)] pub mod chars { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send { /// A function that accepts a character fn take_char( @@ -245,7 +243,7 @@ pub mod exports { #[allow(clippy::all)] pub mod chars { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { take_char: wasmtime::component::Func, @@ -270,7 +268,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/chars") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/chars`" ) })?; @@ -279,7 +277,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/chars` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/char_tracing_async.rs b/crates/component-macro/tests/expanded/char_tracing_async.rs index 0314bf0e201d..4286fba4b79a 100644 --- a/crates/component-macro/tests/expanded/char_tracing_async.rs +++ b/crates/component-macro/tests/expanded/char_tracing_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::chars::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -190,7 +188,7 @@ pub mod foo { #[allow(clippy::all)] pub mod chars { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T where @@ -295,7 +293,7 @@ pub mod exports { #[allow(clippy::all)] pub mod chars { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { take_char: wasmtime::component::Func, @@ -320,7 +318,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/chars") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/chars`" ) })?; @@ -329,7 +327,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/chars` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/conventions.rs b/crates/component-macro/tests/expanded/conventions.rs index 6e52b654da9a..2f61951a5521 100644 --- a/crates/component-macro/tests/expanded/conventions.rs +++ b/crates/component-macro/tests/expanded/conventions.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::conventions::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod conventions { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -414,7 +412,7 @@ pub mod exports { #[allow(clippy::all)] pub mod conventions { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -497,7 +495,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/conventions") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/conventions`" ) })?; @@ -506,7 +504,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/conventions` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/conventions_async.rs b/crates/component-macro/tests/expanded/conventions_async.rs index 918136e41a5d..8607d3b23b54 100644 --- a/crates/component-macro/tests/expanded/conventions_async.rs +++ b/crates/component-macro/tests/expanded/conventions_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::conventions::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod conventions { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -472,7 +470,7 @@ pub mod exports { #[allow(clippy::all)] pub mod conventions { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -555,7 +553,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/conventions") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/conventions`" ) })?; @@ -564,7 +562,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/conventions` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/conventions_concurrent.rs b/crates/component-macro/tests/expanded/conventions_concurrent.rs index a61d3326f46a..d0627e210ea5 100644 --- a/crates/component-macro/tests/expanded/conventions_concurrent.rs +++ b/crates/component-macro/tests/expanded/conventions_concurrent.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::conventions::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod conventions { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -420,7 +418,7 @@ pub mod exports { #[allow(clippy::all)] pub mod conventions { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -503,7 +501,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/conventions") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/conventions`" ) })?; @@ -512,7 +510,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/conventions` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/conventions_tracing_async.rs b/crates/component-macro/tests/expanded/conventions_tracing_async.rs index 3a8238c1fa25..8f3b84c5f383 100644 --- a/crates/component-macro/tests/expanded/conventions_tracing_async.rs +++ b/crates/component-macro/tests/expanded/conventions_tracing_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::conventions::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod conventions { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -632,7 +630,7 @@ pub mod exports { #[allow(clippy::all)] pub mod conventions { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -715,7 +713,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/conventions") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/conventions`" ) })?; @@ -724,7 +722,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/conventions` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/dead-code.rs b/crates/component-macro/tests/expanded/dead-code.rs index 147d40b2ec43..a0b2da6c502b 100644 --- a/crates/component-macro/tests/expanded/dead-code.rs +++ b/crates/component-macro/tests/expanded/dead-code.rs @@ -99,8 +99,6 @@ pub struct ImportsIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Imports {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl ImportsIndices { /// Creates a new copy of `ImportsIndices` bindings which can then /// be used to instantiate into a particular store. @@ -186,7 +184,7 @@ pub mod a { #[allow(clippy::all)] pub mod interface_with_live_type { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -244,7 +242,7 @@ pub mod a { #[allow(clippy::all)] pub mod interface_with_dead_type { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type LiveType = super::super::super::a::b::interface_with_live_type::LiveType; const _: () = { assert!(4 == < LiveType as wasmtime::component::ComponentType >::SIZE32); diff --git a/crates/component-macro/tests/expanded/dead-code_async.rs b/crates/component-macro/tests/expanded/dead-code_async.rs index cb7c08890447..9a56d636810b 100644 --- a/crates/component-macro/tests/expanded/dead-code_async.rs +++ b/crates/component-macro/tests/expanded/dead-code_async.rs @@ -99,8 +99,6 @@ pub struct ImportsIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Imports {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl ImportsIndices { /// Creates a new copy of `ImportsIndices` bindings which can then /// be used to instantiate into a particular store. @@ -186,7 +184,7 @@ pub mod a { #[allow(clippy::all)] pub mod interface_with_live_type { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -248,7 +246,7 @@ pub mod a { #[allow(clippy::all)] pub mod interface_with_dead_type { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type LiveType = super::super::super::a::b::interface_with_live_type::LiveType; const _: () = { assert!(4 == < LiveType as wasmtime::component::ComponentType >::SIZE32); diff --git a/crates/component-macro/tests/expanded/dead-code_concurrent.rs b/crates/component-macro/tests/expanded/dead-code_concurrent.rs index d0f83b9558f9..a277b8c7dec2 100644 --- a/crates/component-macro/tests/expanded/dead-code_concurrent.rs +++ b/crates/component-macro/tests/expanded/dead-code_concurrent.rs @@ -99,8 +99,6 @@ pub struct ImportsIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Imports {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl ImportsIndices { /// Creates a new copy of `ImportsIndices` bindings which can then /// be used to instantiate into a particular store. @@ -186,7 +184,7 @@ pub mod a { #[allow(clippy::all)] pub mod interface_with_live_type { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -240,7 +238,7 @@ pub mod a { #[allow(clippy::all)] pub mod interface_with_dead_type { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type LiveType = super::super::super::a::b::interface_with_live_type::LiveType; const _: () = { assert!(4 == < LiveType as wasmtime::component::ComponentType >::SIZE32); diff --git a/crates/component-macro/tests/expanded/dead-code_tracing_async.rs b/crates/component-macro/tests/expanded/dead-code_tracing_async.rs index 23e631fb8ff0..bbe2b7fb491c 100644 --- a/crates/component-macro/tests/expanded/dead-code_tracing_async.rs +++ b/crates/component-macro/tests/expanded/dead-code_tracing_async.rs @@ -99,8 +99,6 @@ pub struct ImportsIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Imports {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl ImportsIndices { /// Creates a new copy of `ImportsIndices` bindings which can then /// be used to instantiate into a particular store. @@ -186,7 +184,7 @@ pub mod a { #[allow(clippy::all)] pub mod interface_with_live_type { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -261,7 +259,7 @@ pub mod a { #[allow(clippy::all)] pub mod interface_with_dead_type { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type LiveType = super::super::super::a::b::interface_with_live_type::LiveType; const _: () = { assert!(4 == < LiveType as wasmtime::component::ComponentType >::SIZE32); diff --git a/crates/component-macro/tests/expanded/direct-import.rs b/crates/component-macro/tests/expanded/direct-import.rs index 387956071b54..e4f7ccb2a44e 100644 --- a/crates/component-macro/tests/expanded/direct-import.rs +++ b/crates/component-macro/tests/expanded/direct-import.rs @@ -112,8 +112,6 @@ impl<_T: FooImports + ?Sized> FooImports for &mut _T { } } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl FooIndices { /// Creates a new copy of `FooIndices` bindings which can then /// be used to instantiate into a particular store. diff --git a/crates/component-macro/tests/expanded/direct-import_async.rs b/crates/component-macro/tests/expanded/direct-import_async.rs index 5c5b53cdb491..741b9eb5e770 100644 --- a/crates/component-macro/tests/expanded/direct-import_async.rs +++ b/crates/component-macro/tests/expanded/direct-import_async.rs @@ -112,8 +112,6 @@ impl<_T: FooImports + ?Sized + Send> FooImports for &mut _T { } } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl FooIndices { /// Creates a new copy of `FooIndices` bindings which can then /// be used to instantiate into a particular store. diff --git a/crates/component-macro/tests/expanded/direct-import_concurrent.rs b/crates/component-macro/tests/expanded/direct-import_concurrent.rs index ea6979438503..81606a4d8e92 100644 --- a/crates/component-macro/tests/expanded/direct-import_concurrent.rs +++ b/crates/component-macro/tests/expanded/direct-import_concurrent.rs @@ -106,8 +106,6 @@ pub trait FooImportsWithStore: wasmtime::component::HasData + Send { pub trait FooImports: Send {} impl<_T: FooImports + ?Sized + Send> FooImports for &mut _T {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl FooIndices { /// Creates a new copy of `FooIndices` bindings which can then /// be used to instantiate into a particular store. diff --git a/crates/component-macro/tests/expanded/direct-import_tracing_async.rs b/crates/component-macro/tests/expanded/direct-import_tracing_async.rs index 20bfe56554d1..ed529cb4340f 100644 --- a/crates/component-macro/tests/expanded/direct-import_tracing_async.rs +++ b/crates/component-macro/tests/expanded/direct-import_tracing_async.rs @@ -112,8 +112,6 @@ impl<_T: FooImports + ?Sized + Send> FooImports for &mut _T { } } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl FooIndices { /// Creates a new copy of `FooIndices` bindings which can then /// be used to instantiate into a particular store. diff --git a/crates/component-macro/tests/expanded/empty.rs b/crates/component-macro/tests/expanded/empty.rs index e0bbef06aa41..ecb6b606aad7 100644 --- a/crates/component-macro/tests/expanded/empty.rs +++ b/crates/component-macro/tests/expanded/empty.rs @@ -99,8 +99,6 @@ pub struct EmptyIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Empty {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl EmptyIndices { /// Creates a new copy of `EmptyIndices` bindings which can then /// be used to instantiate into a particular store. diff --git a/crates/component-macro/tests/expanded/empty_async.rs b/crates/component-macro/tests/expanded/empty_async.rs index e0bbef06aa41..ecb6b606aad7 100644 --- a/crates/component-macro/tests/expanded/empty_async.rs +++ b/crates/component-macro/tests/expanded/empty_async.rs @@ -99,8 +99,6 @@ pub struct EmptyIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Empty {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl EmptyIndices { /// Creates a new copy of `EmptyIndices` bindings which can then /// be used to instantiate into a particular store. diff --git a/crates/component-macro/tests/expanded/empty_concurrent.rs b/crates/component-macro/tests/expanded/empty_concurrent.rs index e0bbef06aa41..ecb6b606aad7 100644 --- a/crates/component-macro/tests/expanded/empty_concurrent.rs +++ b/crates/component-macro/tests/expanded/empty_concurrent.rs @@ -99,8 +99,6 @@ pub struct EmptyIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Empty {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl EmptyIndices { /// Creates a new copy of `EmptyIndices` bindings which can then /// be used to instantiate into a particular store. diff --git a/crates/component-macro/tests/expanded/empty_tracing_async.rs b/crates/component-macro/tests/expanded/empty_tracing_async.rs index e0bbef06aa41..ecb6b606aad7 100644 --- a/crates/component-macro/tests/expanded/empty_tracing_async.rs +++ b/crates/component-macro/tests/expanded/empty_tracing_async.rs @@ -99,8 +99,6 @@ pub struct EmptyIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Empty {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl EmptyIndices { /// Creates a new copy of `EmptyIndices` bindings which can then /// be used to instantiate into a particular store. diff --git a/crates/component-macro/tests/expanded/flags.rs b/crates/component-macro/tests/expanded/flags.rs index 0a348636b6d2..95da139d12cb 100644 --- a/crates/component-macro/tests/expanded/flags.rs +++ b/crates/component-macro/tests/expanded/flags.rs @@ -103,8 +103,6 @@ pub struct TheFlags { interface0: exports::foo::foo::flegs::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheFlagsIndices { /// Creates a new copy of `TheFlagsIndices` bindings which can then /// be used to instantiate into a particular store. @@ -190,7 +188,7 @@ pub mod foo { #[allow(clippy::all)] pub mod flegs { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; wasmtime::component::flags!(Flag1 { #[component(name = "b0")] const B0; }); const _: () = { assert!(1 == < Flag1 as wasmtime::component::ComponentType >::SIZE32); @@ -440,7 +438,7 @@ pub mod exports { #[allow(clippy::all)] pub mod flegs { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; wasmtime::component::flags!( Flag1 { #[component(name = "b0")] const B0; } ); @@ -624,7 +622,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/flegs") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/flegs`" ) })?; @@ -633,7 +631,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/flegs` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/flags_async.rs b/crates/component-macro/tests/expanded/flags_async.rs index f5aef11f2eb6..42dedaf03673 100644 --- a/crates/component-macro/tests/expanded/flags_async.rs +++ b/crates/component-macro/tests/expanded/flags_async.rs @@ -103,8 +103,6 @@ pub struct TheFlags { interface0: exports::foo::foo::flegs::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheFlagsIndices { /// Creates a new copy of `TheFlagsIndices` bindings which can then /// be used to instantiate into a particular store. @@ -190,7 +188,7 @@ pub mod foo { #[allow(clippy::all)] pub mod flegs { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; wasmtime::component::flags!(Flag1 { #[component(name = "b0")] const B0; }); const _: () = { assert!(1 == < Flag1 as wasmtime::component::ComponentType >::SIZE32); @@ -496,7 +494,7 @@ pub mod exports { #[allow(clippy::all)] pub mod flegs { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; wasmtime::component::flags!( Flag1 { #[component(name = "b0")] const B0; } ); @@ -680,7 +678,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/flegs") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/flegs`" ) })?; @@ -689,7 +687,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/flegs` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/flags_concurrent.rs b/crates/component-macro/tests/expanded/flags_concurrent.rs index 2368bf5c4005..5fd884a4861a 100644 --- a/crates/component-macro/tests/expanded/flags_concurrent.rs +++ b/crates/component-macro/tests/expanded/flags_concurrent.rs @@ -103,8 +103,6 @@ pub struct TheFlags { interface0: exports::foo::foo::flegs::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheFlagsIndices { /// Creates a new copy of `TheFlagsIndices` bindings which can then /// be used to instantiate into a particular store. @@ -190,7 +188,7 @@ pub mod foo { #[allow(clippy::all)] pub mod flegs { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; wasmtime::component::flags!(Flag1 { #[component(name = "b0")] const B0; }); const _: () = { assert!(1 == < Flag1 as wasmtime::component::ComponentType >::SIZE32); @@ -435,7 +433,7 @@ pub mod exports { #[allow(clippy::all)] pub mod flegs { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; wasmtime::component::flags!( Flag1 { #[component(name = "b0")] const B0; } ); @@ -619,7 +617,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/flegs") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/flegs`" ) })?; @@ -628,7 +626,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/flegs` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/flags_tracing_async.rs b/crates/component-macro/tests/expanded/flags_tracing_async.rs index 6f140e753c96..f42bf5f9dd6d 100644 --- a/crates/component-macro/tests/expanded/flags_tracing_async.rs +++ b/crates/component-macro/tests/expanded/flags_tracing_async.rs @@ -103,8 +103,6 @@ pub struct TheFlags { interface0: exports::foo::foo::flegs::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheFlagsIndices { /// Creates a new copy of `TheFlagsIndices` bindings which can then /// be used to instantiate into a particular store. @@ -190,7 +188,7 @@ pub mod foo { #[allow(clippy::all)] pub mod flegs { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; wasmtime::component::flags!(Flag1 { #[component(name = "b0")] const B0; }); const _: () = { assert!(1 == < Flag1 as wasmtime::component::ComponentType >::SIZE32); @@ -608,7 +606,7 @@ pub mod exports { #[allow(clippy::all)] pub mod flegs { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; wasmtime::component::flags!( Flag1 { #[component(name = "b0")] const B0; } ); @@ -792,7 +790,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/flegs") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/flegs`" ) })?; @@ -801,7 +799,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/flegs` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/floats.rs b/crates/component-macro/tests/expanded/floats.rs index 94e34f2f2379..6c1454a42cd2 100644 --- a/crates/component-macro/tests/expanded/floats.rs +++ b/crates/component-macro/tests/expanded/floats.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::floats::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod floats { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T where @@ -271,7 +269,7 @@ pub mod exports { #[allow(clippy::all)] pub mod floats { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { f32_param: wasmtime::component::Func, @@ -300,7 +298,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/floats") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/floats`" ) })?; @@ -309,7 +307,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/floats` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/floats_async.rs b/crates/component-macro/tests/expanded/floats_async.rs index be4474245305..94f60a8ede55 100644 --- a/crates/component-macro/tests/expanded/floats_async.rs +++ b/crates/component-macro/tests/expanded/floats_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::floats::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod floats { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T where @@ -299,7 +297,7 @@ pub mod exports { #[allow(clippy::all)] pub mod floats { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { f32_param: wasmtime::component::Func, @@ -328,7 +326,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/floats") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/floats`" ) })?; @@ -337,7 +335,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/floats` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/floats_concurrent.rs b/crates/component-macro/tests/expanded/floats_concurrent.rs index f28ef6174352..332b6b89564b 100644 --- a/crates/component-macro/tests/expanded/floats_concurrent.rs +++ b/crates/component-macro/tests/expanded/floats_concurrent.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::floats::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod floats { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send { fn f32_param( accessor: &wasmtime::component::Accessor, @@ -272,7 +270,7 @@ pub mod exports { #[allow(clippy::all)] pub mod floats { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { f32_param: wasmtime::component::Func, @@ -301,7 +299,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/floats") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/floats`" ) })?; @@ -310,7 +308,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/floats` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/floats_tracing_async.rs b/crates/component-macro/tests/expanded/floats_tracing_async.rs index 654d38cb24d0..e1f18c85439f 100644 --- a/crates/component-macro/tests/expanded/floats_tracing_async.rs +++ b/crates/component-macro/tests/expanded/floats_tracing_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::floats::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod floats { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T where @@ -357,7 +355,7 @@ pub mod exports { #[allow(clippy::all)] pub mod floats { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { f32_param: wasmtime::component::Func, @@ -386,7 +384,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/floats") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/floats`" ) })?; @@ -395,7 +393,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/floats` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/function-new.rs b/crates/component-macro/tests/expanded/function-new.rs index e316c531fa23..c35e9da8aa86 100644 --- a/crates/component-macro/tests/expanded/function-new.rs +++ b/crates/component-macro/tests/expanded/function-new.rs @@ -103,8 +103,6 @@ pub struct Foo { new: wasmtime::component::Func, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl FooIndices { /// Creates a new copy of `FooIndices` bindings which can then /// be used to instantiate into a particular store. @@ -119,16 +117,24 @@ const _: () = { let new = { let (item, index) = _component .get_export(None, "new") - .ok_or_else(|| anyhow::anyhow!("no export `new` found"))?; + .ok_or_else(|| { + wasmtime::error::format_err!("no export `new` found") + })?; match item { wasmtime::component::types::ComponentItem::ComponentFunc(func) => { - anyhow::Context::context( + wasmtime::error::Context::context( func.typecheck::<(), ()>(&_instance_type), "type-checking export func `new`", )?; index } - _ => Err(anyhow::anyhow!("export `new` is not a function"))?, + _ => { + Err( + wasmtime::error::format_err!( + "export `new` is not a function" + ), + )? + } } }; Ok(FooIndices { new }) diff --git a/crates/component-macro/tests/expanded/function-new_async.rs b/crates/component-macro/tests/expanded/function-new_async.rs index 354c3148d86a..6f89cdd0e9b4 100644 --- a/crates/component-macro/tests/expanded/function-new_async.rs +++ b/crates/component-macro/tests/expanded/function-new_async.rs @@ -103,8 +103,6 @@ pub struct Foo { new: wasmtime::component::Func, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl FooIndices { /// Creates a new copy of `FooIndices` bindings which can then /// be used to instantiate into a particular store. @@ -119,16 +117,24 @@ const _: () = { let new = { let (item, index) = _component .get_export(None, "new") - .ok_or_else(|| anyhow::anyhow!("no export `new` found"))?; + .ok_or_else(|| { + wasmtime::error::format_err!("no export `new` found") + })?; match item { wasmtime::component::types::ComponentItem::ComponentFunc(func) => { - anyhow::Context::context( + wasmtime::error::Context::context( func.typecheck::<(), ()>(&_instance_type), "type-checking export func `new`", )?; index } - _ => Err(anyhow::anyhow!("export `new` is not a function"))?, + _ => { + Err( + wasmtime::error::format_err!( + "export `new` is not a function" + ), + )? + } } }; Ok(FooIndices { new }) diff --git a/crates/component-macro/tests/expanded/function-new_concurrent.rs b/crates/component-macro/tests/expanded/function-new_concurrent.rs index ba3192bc7b14..ce9883e180bc 100644 --- a/crates/component-macro/tests/expanded/function-new_concurrent.rs +++ b/crates/component-macro/tests/expanded/function-new_concurrent.rs @@ -103,8 +103,6 @@ pub struct Foo { new: wasmtime::component::Func, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl FooIndices { /// Creates a new copy of `FooIndices` bindings which can then /// be used to instantiate into a particular store. @@ -119,16 +117,24 @@ const _: () = { let new = { let (item, index) = _component .get_export(None, "new") - .ok_or_else(|| anyhow::anyhow!("no export `new` found"))?; + .ok_or_else(|| { + wasmtime::error::format_err!("no export `new` found") + })?; match item { wasmtime::component::types::ComponentItem::ComponentFunc(func) => { - anyhow::Context::context( + wasmtime::error::Context::context( func.typecheck::<(), ()>(&_instance_type), "type-checking export func `new`", )?; index } - _ => Err(anyhow::anyhow!("export `new` is not a function"))?, + _ => { + Err( + wasmtime::error::format_err!( + "export `new` is not a function" + ), + )? + } } }; Ok(FooIndices { new }) diff --git a/crates/component-macro/tests/expanded/function-new_tracing_async.rs b/crates/component-macro/tests/expanded/function-new_tracing_async.rs index 31a5da2973a4..f13f20a501a5 100644 --- a/crates/component-macro/tests/expanded/function-new_tracing_async.rs +++ b/crates/component-macro/tests/expanded/function-new_tracing_async.rs @@ -103,8 +103,6 @@ pub struct Foo { new: wasmtime::component::Func, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl FooIndices { /// Creates a new copy of `FooIndices` bindings which can then /// be used to instantiate into a particular store. @@ -119,16 +117,24 @@ const _: () = { let new = { let (item, index) = _component .get_export(None, "new") - .ok_or_else(|| anyhow::anyhow!("no export `new` found"))?; + .ok_or_else(|| { + wasmtime::error::format_err!("no export `new` found") + })?; match item { wasmtime::component::types::ComponentItem::ComponentFunc(func) => { - anyhow::Context::context( + wasmtime::error::Context::context( func.typecheck::<(), ()>(&_instance_type), "type-checking export func `new`", )?; index } - _ => Err(anyhow::anyhow!("export `new` is not a function"))?, + _ => { + Err( + wasmtime::error::format_err!( + "export `new` is not a function" + ), + )? + } } }; Ok(FooIndices { new }) diff --git a/crates/component-macro/tests/expanded/host-world.rs b/crates/component-macro/tests/expanded/host-world.rs index 1b5a4077eeac..0b58744ef748 100644 --- a/crates/component-macro/tests/expanded/host-world.rs +++ b/crates/component-macro/tests/expanded/host-world.rs @@ -112,8 +112,6 @@ impl<_T: Host_Imports + ?Sized> Host_Imports for &mut _T { } } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl Host_Indices { /// Creates a new copy of `Host_Indices` bindings which can then /// be used to instantiate into a particular store. diff --git a/crates/component-macro/tests/expanded/host-world_async.rs b/crates/component-macro/tests/expanded/host-world_async.rs index 8bad79ba6b82..4e23ad174162 100644 --- a/crates/component-macro/tests/expanded/host-world_async.rs +++ b/crates/component-macro/tests/expanded/host-world_async.rs @@ -112,8 +112,6 @@ impl<_T: Host_Imports + ?Sized + Send> Host_Imports for &mut _T { } } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl Host_Indices { /// Creates a new copy of `Host_Indices` bindings which can then /// be used to instantiate into a particular store. diff --git a/crates/component-macro/tests/expanded/host-world_concurrent.rs b/crates/component-macro/tests/expanded/host-world_concurrent.rs index 9788455fc2bd..a5e3b741ac25 100644 --- a/crates/component-macro/tests/expanded/host-world_concurrent.rs +++ b/crates/component-macro/tests/expanded/host-world_concurrent.rs @@ -106,8 +106,6 @@ pub trait Host_ImportsWithStore: wasmtime::component::HasData + Send { pub trait Host_Imports: Send {} impl<_T: Host_Imports + ?Sized + Send> Host_Imports for &mut _T {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl Host_Indices { /// Creates a new copy of `Host_Indices` bindings which can then /// be used to instantiate into a particular store. diff --git a/crates/component-macro/tests/expanded/host-world_tracing_async.rs b/crates/component-macro/tests/expanded/host-world_tracing_async.rs index 768b4565a1a8..56c56073f6b7 100644 --- a/crates/component-macro/tests/expanded/host-world_tracing_async.rs +++ b/crates/component-macro/tests/expanded/host-world_tracing_async.rs @@ -112,8 +112,6 @@ impl<_T: Host_Imports + ?Sized + Send> Host_Imports for &mut _T { } } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl Host_Indices { /// Creates a new copy of `Host_Indices` bindings which can then /// be used to instantiate into a particular store. diff --git a/crates/component-macro/tests/expanded/integers.rs b/crates/component-macro/tests/expanded/integers.rs index d8b002493e6f..39048c4d0001 100644 --- a/crates/component-macro/tests/expanded/integers.rs +++ b/crates/component-macro/tests/expanded/integers.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::integers::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod integers { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T where @@ -481,7 +479,7 @@ pub mod exports { #[allow(clippy::all)] pub mod integers { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { a1: wasmtime::component::Func, @@ -538,7 +536,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/integers") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/integers`" ) })?; @@ -547,7 +545,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/integers` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/integers_async.rs b/crates/component-macro/tests/expanded/integers_async.rs index 68f14773601f..6a94a0c3b773 100644 --- a/crates/component-macro/tests/expanded/integers_async.rs +++ b/crates/component-macro/tests/expanded/integers_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::integers::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod integers { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T where @@ -570,7 +568,7 @@ pub mod exports { #[allow(clippy::all)] pub mod integers { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { a1: wasmtime::component::Func, @@ -627,7 +625,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/integers") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/integers`" ) })?; @@ -636,7 +634,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/integers` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/integers_concurrent.rs b/crates/component-macro/tests/expanded/integers_concurrent.rs index 98e0a04f3d97..9bd447985aa2 100644 --- a/crates/component-macro/tests/expanded/integers_concurrent.rs +++ b/crates/component-macro/tests/expanded/integers_concurrent.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::integers::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod integers { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send { fn a1( accessor: &wasmtime::component::Accessor, @@ -491,7 +489,7 @@ pub mod exports { #[allow(clippy::all)] pub mod integers { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { a1: wasmtime::component::Func, @@ -548,7 +546,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/integers") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/integers`" ) })?; @@ -557,7 +555,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/integers` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/integers_tracing_async.rs b/crates/component-macro/tests/expanded/integers_tracing_async.rs index a2976eb15e9d..ac276b326702 100644 --- a/crates/component-macro/tests/expanded/integers_tracing_async.rs +++ b/crates/component-macro/tests/expanded/integers_tracing_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::integers::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod integers { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T where @@ -835,7 +833,7 @@ pub mod exports { #[allow(clippy::all)] pub mod integers { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { a1: wasmtime::component::Func, @@ -892,7 +890,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/integers") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/integers`" ) })?; @@ -901,7 +899,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/integers` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/lists.rs b/crates/component-macro/tests/expanded/lists.rs index 294b2a7e7411..0ee01da1e3da 100644 --- a/crates/component-macro/tests/expanded/lists.rs +++ b/crates/component-macro/tests/expanded/lists.rs @@ -103,8 +103,6 @@ pub struct TheLists { interface0: exports::foo::foo::lists::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheListsIndices { /// Creates a new copy of `TheListsIndices` bindings which can then /// be used to instantiate into a particular store. @@ -190,7 +188,7 @@ pub mod foo { #[allow(clippy::all)] pub mod lists { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -957,7 +955,7 @@ pub mod exports { #[allow(clippy::all)] pub mod lists { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -1236,7 +1234,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/lists") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/lists`" ) })?; @@ -1245,7 +1243,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/lists` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/lists_async.rs b/crates/component-macro/tests/expanded/lists_async.rs index 4c3292e783f9..ca042dd6b181 100644 --- a/crates/component-macro/tests/expanded/lists_async.rs +++ b/crates/component-macro/tests/expanded/lists_async.rs @@ -103,8 +103,6 @@ pub struct TheLists { interface0: exports::foo::foo::lists::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheListsIndices { /// Creates a new copy of `TheListsIndices` bindings which can then /// be used to instantiate into a particular store. @@ -190,7 +188,7 @@ pub mod foo { #[allow(clippy::all)] pub mod lists { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -1123,7 +1121,7 @@ pub mod exports { #[allow(clippy::all)] pub mod lists { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -1402,7 +1400,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/lists") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/lists`" ) })?; @@ -1411,7 +1409,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/lists` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/lists_concurrent.rs b/crates/component-macro/tests/expanded/lists_concurrent.rs index 9291504faeaa..68cd0282c172 100644 --- a/crates/component-macro/tests/expanded/lists_concurrent.rs +++ b/crates/component-macro/tests/expanded/lists_concurrent.rs @@ -103,8 +103,6 @@ pub struct TheLists { interface0: exports::foo::foo::lists::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheListsIndices { /// Creates a new copy of `TheListsIndices` bindings which can then /// be used to instantiate into a particular store. @@ -190,7 +188,7 @@ pub mod foo { #[allow(clippy::all)] pub mod lists { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -926,7 +924,7 @@ pub mod exports { #[allow(clippy::all)] pub mod lists { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -1205,7 +1203,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/lists") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/lists`" ) })?; @@ -1214,7 +1212,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/lists` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/lists_tracing_async.rs b/crates/component-macro/tests/expanded/lists_tracing_async.rs index cf47e764cf94..e7584bdc6315 100644 --- a/crates/component-macro/tests/expanded/lists_tracing_async.rs +++ b/crates/component-macro/tests/expanded/lists_tracing_async.rs @@ -103,8 +103,6 @@ pub struct TheLists { interface0: exports::foo::foo::lists::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheListsIndices { /// Creates a new copy of `TheListsIndices` bindings which can then /// be used to instantiate into a particular store. @@ -190,7 +188,7 @@ pub mod foo { #[allow(clippy::all)] pub mod lists { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -1554,7 +1552,7 @@ pub mod exports { #[allow(clippy::all)] pub mod lists { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -1833,7 +1831,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/lists") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/lists`" ) })?; @@ -1842,7 +1840,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/lists` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/many-arguments.rs b/crates/component-macro/tests/expanded/many-arguments.rs index c934894ec51e..4c3544454e31 100644 --- a/crates/component-macro/tests/expanded/many-arguments.rs +++ b/crates/component-macro/tests/expanded/many-arguments.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::manyarg::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod manyarg { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -440,7 +438,7 @@ pub mod exports { #[allow(clippy::all)] pub mod manyarg { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -550,7 +548,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/manyarg") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/manyarg`" ) })?; @@ -559,7 +557,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/manyarg` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/many-arguments_async.rs b/crates/component-macro/tests/expanded/many-arguments_async.rs index bdb7301eb080..7d73e4ff86a6 100644 --- a/crates/component-macro/tests/expanded/many-arguments_async.rs +++ b/crates/component-macro/tests/expanded/many-arguments_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::manyarg::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod manyarg { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -454,7 +452,7 @@ pub mod exports { #[allow(clippy::all)] pub mod manyarg { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -564,7 +562,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/manyarg") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/manyarg`" ) })?; @@ -573,7 +571,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/manyarg` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/many-arguments_concurrent.rs b/crates/component-macro/tests/expanded/many-arguments_concurrent.rs index 3a35627bf54e..dba05b12ce34 100644 --- a/crates/component-macro/tests/expanded/many-arguments_concurrent.rs +++ b/crates/component-macro/tests/expanded/many-arguments_concurrent.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::manyarg::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod manyarg { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -401,7 +399,7 @@ pub mod exports { #[allow(clippy::all)] pub mod manyarg { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -511,7 +509,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/manyarg") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/manyarg`" ) })?; @@ -520,7 +518,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/manyarg` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/many-arguments_tracing_async.rs b/crates/component-macro/tests/expanded/many-arguments_tracing_async.rs index 1fe25868ca8c..c3b77d951380 100644 --- a/crates/component-macro/tests/expanded/many-arguments_tracing_async.rs +++ b/crates/component-macro/tests/expanded/many-arguments_tracing_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::manyarg::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod manyarg { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -497,7 +495,7 @@ pub mod exports { #[allow(clippy::all)] pub mod manyarg { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -607,7 +605,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/manyarg") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/manyarg`" ) })?; @@ -616,7 +614,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/manyarg` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/multi-return.rs b/crates/component-macro/tests/expanded/multi-return.rs index 9414ffa0b4f0..7482040fb046 100644 --- a/crates/component-macro/tests/expanded/multi-return.rs +++ b/crates/component-macro/tests/expanded/multi-return.rs @@ -318,7 +318,7 @@ pub mod exports { let (_, instance) = component .export_index(None, "foo:foo/multi-return") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::anyhow!( "no exported instance named `foo:foo/multi-return`" ) })?; @@ -335,7 +335,7 @@ pub mod exports { let instance_export = instance .get_export(&mut store, None, "foo:foo/multi-return") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::anyhow!( "no exported instance named `foo:foo/multi-return`" ) })?; @@ -351,7 +351,7 @@ pub mod exports { let mut lookup = move |name| { lookup(name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::anyhow!( "instance export `foo:foo/multi-return` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/multiversion.rs b/crates/component-macro/tests/expanded/multiversion.rs index 3d5192e1c0a6..6a6ff54dced1 100644 --- a/crates/component-macro/tests/expanded/multiversion.rs +++ b/crates/component-macro/tests/expanded/multiversion.rs @@ -105,8 +105,6 @@ pub struct Foo { interface1: exports::my::dep0_2_0::a::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl FooIndices { /// Creates a new copy of `FooIndices` bindings which can then /// be used to instantiate into a particular store. @@ -201,7 +199,7 @@ pub mod my { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T where @@ -241,7 +239,7 @@ pub mod my { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T where @@ -284,7 +282,7 @@ pub mod exports { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { x: wasmtime::component::Func, @@ -307,7 +305,7 @@ pub mod exports { .component() .get_export_index(None, "my:dep/a@0.1.0") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `my:dep/a@0.1.0`" ) })?; @@ -316,7 +314,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `my:dep/a@0.1.0` does \ not have export `{name}`" ) @@ -364,7 +362,7 @@ pub mod exports { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { x: wasmtime::component::Func, @@ -387,7 +385,7 @@ pub mod exports { .component() .get_export_index(None, "my:dep/a@0.2.0") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `my:dep/a@0.2.0`" ) })?; @@ -396,7 +394,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `my:dep/a@0.2.0` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/multiversion_async.rs b/crates/component-macro/tests/expanded/multiversion_async.rs index 03fe15c242cc..fcedb444a190 100644 --- a/crates/component-macro/tests/expanded/multiversion_async.rs +++ b/crates/component-macro/tests/expanded/multiversion_async.rs @@ -105,8 +105,6 @@ pub struct Foo { interface1: exports::my::dep0_2_0::a::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl FooIndices { /// Creates a new copy of `FooIndices` bindings which can then /// be used to instantiate into a particular store. @@ -201,7 +199,7 @@ pub mod my { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T where @@ -243,7 +241,7 @@ pub mod my { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T where @@ -288,7 +286,7 @@ pub mod exports { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { x: wasmtime::component::Func, @@ -311,7 +309,7 @@ pub mod exports { .component() .get_export_index(None, "my:dep/a@0.1.0") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `my:dep/a@0.1.0`" ) })?; @@ -320,7 +318,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `my:dep/a@0.1.0` does \ not have export `{name}`" ) @@ -371,7 +369,7 @@ pub mod exports { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { x: wasmtime::component::Func, @@ -394,7 +392,7 @@ pub mod exports { .component() .get_export_index(None, "my:dep/a@0.2.0") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `my:dep/a@0.2.0`" ) })?; @@ -403,7 +401,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `my:dep/a@0.2.0` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/multiversion_concurrent.rs b/crates/component-macro/tests/expanded/multiversion_concurrent.rs index 0b3529e92cb3..ec5527afe180 100644 --- a/crates/component-macro/tests/expanded/multiversion_concurrent.rs +++ b/crates/component-macro/tests/expanded/multiversion_concurrent.rs @@ -105,8 +105,6 @@ pub struct Foo { interface1: exports::my::dep0_2_0::a::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl FooIndices { /// Creates a new copy of `FooIndices` bindings which can then /// be used to instantiate into a particular store. @@ -201,7 +199,7 @@ pub mod my { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send { fn x( accessor: &wasmtime::component::Accessor, @@ -237,7 +235,7 @@ pub mod my { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send { fn x( accessor: &wasmtime::component::Accessor, @@ -276,7 +274,7 @@ pub mod exports { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { x: wasmtime::component::Func, @@ -299,7 +297,7 @@ pub mod exports { .component() .get_export_index(None, "my:dep/a@0.1.0") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `my:dep/a@0.1.0`" ) })?; @@ -308,7 +306,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `my:dep/a@0.1.0` does \ not have export `{name}`" ) @@ -359,7 +357,7 @@ pub mod exports { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { x: wasmtime::component::Func, @@ -382,7 +380,7 @@ pub mod exports { .component() .get_export_index(None, "my:dep/a@0.2.0") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `my:dep/a@0.2.0`" ) })?; @@ -391,7 +389,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `my:dep/a@0.2.0` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/multiversion_tracing_async.rs b/crates/component-macro/tests/expanded/multiversion_tracing_async.rs index bab3788cdef9..18e264495d07 100644 --- a/crates/component-macro/tests/expanded/multiversion_tracing_async.rs +++ b/crates/component-macro/tests/expanded/multiversion_tracing_async.rs @@ -105,8 +105,6 @@ pub struct Foo { interface1: exports::my::dep0_2_0::a::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl FooIndices { /// Creates a new copy of `FooIndices` bindings which can then /// be used to instantiate into a particular store. @@ -201,7 +199,7 @@ pub mod my { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T where @@ -256,7 +254,7 @@ pub mod my { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T where @@ -314,7 +312,7 @@ pub mod exports { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { x: wasmtime::component::Func, @@ -337,7 +335,7 @@ pub mod exports { .component() .get_export_index(None, "my:dep/a@0.1.0") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `my:dep/a@0.1.0`" ) })?; @@ -346,7 +344,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `my:dep/a@0.1.0` does \ not have export `{name}`" ) @@ -408,7 +406,7 @@ pub mod exports { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { x: wasmtime::component::Func, @@ -431,7 +429,7 @@ pub mod exports { .component() .get_export_index(None, "my:dep/a@0.2.0") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `my:dep/a@0.2.0`" ) })?; @@ -440,7 +438,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `my:dep/a@0.2.0` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/path1.rs b/crates/component-macro/tests/expanded/path1.rs index 23b059eb7fd0..f0ac5431574b 100644 --- a/crates/component-macro/tests/expanded/path1.rs +++ b/crates/component-macro/tests/expanded/path1.rs @@ -99,8 +99,6 @@ pub struct Path1Indices {} /// [`Linker`]: wasmtime::component::Linker pub struct Path1 {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl Path1Indices { /// Creates a new copy of `Path1Indices` bindings which can then /// be used to instantiate into a particular store. @@ -181,7 +179,7 @@ pub mod paths { #[allow(clippy::all)] pub mod test { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T where diff --git a/crates/component-macro/tests/expanded/path1_async.rs b/crates/component-macro/tests/expanded/path1_async.rs index f985453a3049..a6de5e5469df 100644 --- a/crates/component-macro/tests/expanded/path1_async.rs +++ b/crates/component-macro/tests/expanded/path1_async.rs @@ -99,8 +99,6 @@ pub struct Path1Indices {} /// [`Linker`]: wasmtime::component::Linker pub struct Path1 {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl Path1Indices { /// Creates a new copy of `Path1Indices` bindings which can then /// be used to instantiate into a particular store. @@ -181,7 +179,7 @@ pub mod paths { #[allow(clippy::all)] pub mod test { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T where diff --git a/crates/component-macro/tests/expanded/path1_concurrent.rs b/crates/component-macro/tests/expanded/path1_concurrent.rs index f985453a3049..a6de5e5469df 100644 --- a/crates/component-macro/tests/expanded/path1_concurrent.rs +++ b/crates/component-macro/tests/expanded/path1_concurrent.rs @@ -99,8 +99,6 @@ pub struct Path1Indices {} /// [`Linker`]: wasmtime::component::Linker pub struct Path1 {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl Path1Indices { /// Creates a new copy of `Path1Indices` bindings which can then /// be used to instantiate into a particular store. @@ -181,7 +179,7 @@ pub mod paths { #[allow(clippy::all)] pub mod test { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T where diff --git a/crates/component-macro/tests/expanded/path1_tracing_async.rs b/crates/component-macro/tests/expanded/path1_tracing_async.rs index f985453a3049..a6de5e5469df 100644 --- a/crates/component-macro/tests/expanded/path1_tracing_async.rs +++ b/crates/component-macro/tests/expanded/path1_tracing_async.rs @@ -99,8 +99,6 @@ pub struct Path1Indices {} /// [`Linker`]: wasmtime::component::Linker pub struct Path1 {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl Path1Indices { /// Creates a new copy of `Path1Indices` bindings which can then /// be used to instantiate into a particular store. @@ -181,7 +179,7 @@ pub mod paths { #[allow(clippy::all)] pub mod test { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T where diff --git a/crates/component-macro/tests/expanded/path2.rs b/crates/component-macro/tests/expanded/path2.rs index 597c2d702e60..d399ee46de49 100644 --- a/crates/component-macro/tests/expanded/path2.rs +++ b/crates/component-macro/tests/expanded/path2.rs @@ -99,8 +99,6 @@ pub struct Path2Indices {} /// [`Linker`]: wasmtime::component::Linker pub struct Path2 {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl Path2Indices { /// Creates a new copy of `Path2Indices` bindings which can then /// be used to instantiate into a particular store. @@ -181,7 +179,7 @@ pub mod paths { #[allow(clippy::all)] pub mod test { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T where diff --git a/crates/component-macro/tests/expanded/path2_async.rs b/crates/component-macro/tests/expanded/path2_async.rs index 5e456f30b1fa..a6d98f0564ff 100644 --- a/crates/component-macro/tests/expanded/path2_async.rs +++ b/crates/component-macro/tests/expanded/path2_async.rs @@ -99,8 +99,6 @@ pub struct Path2Indices {} /// [`Linker`]: wasmtime::component::Linker pub struct Path2 {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl Path2Indices { /// Creates a new copy of `Path2Indices` bindings which can then /// be used to instantiate into a particular store. @@ -181,7 +179,7 @@ pub mod paths { #[allow(clippy::all)] pub mod test { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T where diff --git a/crates/component-macro/tests/expanded/path2_concurrent.rs b/crates/component-macro/tests/expanded/path2_concurrent.rs index 5e456f30b1fa..a6d98f0564ff 100644 --- a/crates/component-macro/tests/expanded/path2_concurrent.rs +++ b/crates/component-macro/tests/expanded/path2_concurrent.rs @@ -99,8 +99,6 @@ pub struct Path2Indices {} /// [`Linker`]: wasmtime::component::Linker pub struct Path2 {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl Path2Indices { /// Creates a new copy of `Path2Indices` bindings which can then /// be used to instantiate into a particular store. @@ -181,7 +179,7 @@ pub mod paths { #[allow(clippy::all)] pub mod test { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T where diff --git a/crates/component-macro/tests/expanded/path2_tracing_async.rs b/crates/component-macro/tests/expanded/path2_tracing_async.rs index 5e456f30b1fa..a6d98f0564ff 100644 --- a/crates/component-macro/tests/expanded/path2_tracing_async.rs +++ b/crates/component-macro/tests/expanded/path2_tracing_async.rs @@ -99,8 +99,6 @@ pub struct Path2Indices {} /// [`Linker`]: wasmtime::component::Linker pub struct Path2 {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl Path2Indices { /// Creates a new copy of `Path2Indices` bindings which can then /// be used to instantiate into a particular store. @@ -181,7 +179,7 @@ pub mod paths { #[allow(clippy::all)] pub mod test { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T where diff --git a/crates/component-macro/tests/expanded/records.rs b/crates/component-macro/tests/expanded/records.rs index 4462a774308d..62d80c8705f1 100644 --- a/crates/component-macro/tests/expanded/records.rs +++ b/crates/component-macro/tests/expanded/records.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::records::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod records { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -528,7 +526,7 @@ pub mod exports { #[allow(clippy::all)] pub mod records { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -755,7 +753,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/records") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/records`" ) })?; @@ -764,7 +762,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/records` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/records_async.rs b/crates/component-macro/tests/expanded/records_async.rs index bd51cda2fbe2..f972d91b61a7 100644 --- a/crates/component-macro/tests/expanded/records_async.rs +++ b/crates/component-macro/tests/expanded/records_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::records::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod records { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -606,7 +604,7 @@ pub mod exports { #[allow(clippy::all)] pub mod records { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -833,7 +831,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/records") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/records`" ) })?; @@ -842,7 +840,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/records` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/records_concurrent.rs b/crates/component-macro/tests/expanded/records_concurrent.rs index 8839ca3f5332..61ae153caad7 100644 --- a/crates/component-macro/tests/expanded/records_concurrent.rs +++ b/crates/component-macro/tests/expanded/records_concurrent.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::records::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod records { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -539,7 +537,7 @@ pub mod exports { #[allow(clippy::all)] pub mod records { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -766,7 +764,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/records") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/records`" ) })?; @@ -775,7 +773,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/records` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/records_tracing_async.rs b/crates/component-macro/tests/expanded/records_tracing_async.rs index b5c3d75c9ada..d53a9d885754 100644 --- a/crates/component-macro/tests/expanded/records_tracing_async.rs +++ b/crates/component-macro/tests/expanded/records_tracing_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::records::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod records { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -767,7 +765,7 @@ pub mod exports { #[allow(clippy::all)] pub mod records { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -994,7 +992,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/records") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/records`" ) })?; @@ -1003,7 +1001,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/records` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/rename.rs b/crates/component-macro/tests/expanded/rename.rs index 7345a2013f13..c0182645fd97 100644 --- a/crates/component-macro/tests/expanded/rename.rs +++ b/crates/component-macro/tests/expanded/rename.rs @@ -99,8 +99,6 @@ pub struct NeptuneIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Neptune {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl NeptuneIndices { /// Creates a new copy of `NeptuneIndices` bindings which can then /// be used to instantiate into a particular store. @@ -182,7 +180,7 @@ pub mod foo { #[allow(clippy::all)] pub mod green { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Thing = i32; const _: () = { assert!(4 == < Thing as wasmtime::component::ComponentType >::SIZE32); @@ -211,7 +209,7 @@ pub mod foo { #[allow(clippy::all)] pub mod red { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Thing = super::super::super::foo::foo::green::Thing; const _: () = { assert!(4 == < Thing as wasmtime::component::ComponentType >::SIZE32); diff --git a/crates/component-macro/tests/expanded/rename_async.rs b/crates/component-macro/tests/expanded/rename_async.rs index c17861447a23..87047d066111 100644 --- a/crates/component-macro/tests/expanded/rename_async.rs +++ b/crates/component-macro/tests/expanded/rename_async.rs @@ -99,8 +99,6 @@ pub struct NeptuneIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Neptune {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl NeptuneIndices { /// Creates a new copy of `NeptuneIndices` bindings which can then /// be used to instantiate into a particular store. @@ -182,7 +180,7 @@ pub mod foo { #[allow(clippy::all)] pub mod green { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Thing = i32; const _: () = { assert!(4 == < Thing as wasmtime::component::ComponentType >::SIZE32); @@ -211,7 +209,7 @@ pub mod foo { #[allow(clippy::all)] pub mod red { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Thing = super::super::super::foo::foo::green::Thing; const _: () = { assert!(4 == < Thing as wasmtime::component::ComponentType >::SIZE32); diff --git a/crates/component-macro/tests/expanded/rename_concurrent.rs b/crates/component-macro/tests/expanded/rename_concurrent.rs index 52b004712e25..5f036f6cddc9 100644 --- a/crates/component-macro/tests/expanded/rename_concurrent.rs +++ b/crates/component-macro/tests/expanded/rename_concurrent.rs @@ -99,8 +99,6 @@ pub struct NeptuneIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Neptune {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl NeptuneIndices { /// Creates a new copy of `NeptuneIndices` bindings which can then /// be used to instantiate into a particular store. @@ -182,7 +180,7 @@ pub mod foo { #[allow(clippy::all)] pub mod green { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Thing = i32; const _: () = { assert!(4 == < Thing as wasmtime::component::ComponentType >::SIZE32); @@ -211,7 +209,7 @@ pub mod foo { #[allow(clippy::all)] pub mod red { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Thing = super::super::super::foo::foo::green::Thing; const _: () = { assert!(4 == < Thing as wasmtime::component::ComponentType >::SIZE32); diff --git a/crates/component-macro/tests/expanded/rename_tracing_async.rs b/crates/component-macro/tests/expanded/rename_tracing_async.rs index 258c98c8c129..384b4cbaef23 100644 --- a/crates/component-macro/tests/expanded/rename_tracing_async.rs +++ b/crates/component-macro/tests/expanded/rename_tracing_async.rs @@ -99,8 +99,6 @@ pub struct NeptuneIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Neptune {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl NeptuneIndices { /// Creates a new copy of `NeptuneIndices` bindings which can then /// be used to instantiate into a particular store. @@ -182,7 +180,7 @@ pub mod foo { #[allow(clippy::all)] pub mod green { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Thing = i32; const _: () = { assert!(4 == < Thing as wasmtime::component::ComponentType >::SIZE32); @@ -211,7 +209,7 @@ pub mod foo { #[allow(clippy::all)] pub mod red { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Thing = super::super::super::foo::foo::green::Thing; const _: () = { assert!(4 == < Thing as wasmtime::component::ComponentType >::SIZE32); diff --git a/crates/component-macro/tests/expanded/resources-export.rs b/crates/component-macro/tests/expanded/resources-export.rs index cc34bbf437dd..793deaf7ccd3 100644 --- a/crates/component-macro/tests/expanded/resources-export.rs +++ b/crates/component-macro/tests/expanded/resources-export.rs @@ -109,8 +109,6 @@ pub struct W { interface3: exports::foo::foo::export_using_export2::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl WIndices { /// Creates a new copy of `WIndices` bindings which can then /// be used to instantiate into a particular store. @@ -235,7 +233,7 @@ pub mod foo { #[allow(clippy::all)] pub mod transitive_import { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub enum Y {} pub trait HostYWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostYWithStore for _T @@ -292,7 +290,7 @@ pub mod exports { #[allow(clippy::all)] pub mod simple_export { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = wasmtime::component::ResourceAny; pub struct GuestA<'a> { funcs: &'a Guest, @@ -323,7 +321,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/simple-export") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/simple-export`" ) })?; @@ -332,7 +330,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/simple-export` does \ not have export `{name}`" ) @@ -437,7 +435,7 @@ pub mod exports { #[allow(clippy::all)] pub mod export_using_import { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Y = super::super::super::super::foo::foo::transitive_import::Y; pub type A = wasmtime::component::ResourceAny; pub struct GuestA<'a> { @@ -469,7 +467,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/export-using-import") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/export-using-import`" ) })?; @@ -478,7 +476,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/export-using-import` does \ not have export `{name}`" ) @@ -591,7 +589,7 @@ pub mod exports { #[allow(clippy::all)] pub mod export_using_export1 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = wasmtime::component::ResourceAny; pub struct GuestA<'a> { funcs: &'a Guest, @@ -618,7 +616,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/export-using-export1") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/export-using-export1`" ) })?; @@ -627,7 +625,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/export-using-export1` does \ not have export `{name}`" ) @@ -683,7 +681,7 @@ pub mod exports { #[allow(clippy::all)] pub mod export_using_export2 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = super::super::super::super::exports::foo::foo::export_using_export1::A; pub type B = wasmtime::component::ResourceAny; pub struct GuestB<'a> { @@ -711,7 +709,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/export-using-export2") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/export-using-export2`" ) })?; @@ -720,7 +718,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/export-using-export2` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/resources-export_async.rs b/crates/component-macro/tests/expanded/resources-export_async.rs index a7f9a84648ee..707f7113edd7 100644 --- a/crates/component-macro/tests/expanded/resources-export_async.rs +++ b/crates/component-macro/tests/expanded/resources-export_async.rs @@ -109,8 +109,6 @@ pub struct W { interface3: exports::foo::foo::export_using_export2::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl WIndices { /// Creates a new copy of `WIndices` bindings which can then /// be used to instantiate into a particular store. @@ -235,7 +233,7 @@ pub mod foo { #[allow(clippy::all)] pub mod transitive_import { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub enum Y {} pub trait HostYWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostYWithStore for _T @@ -297,7 +295,7 @@ pub mod exports { #[allow(clippy::all)] pub mod simple_export { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = wasmtime::component::ResourceAny; pub struct GuestA<'a> { funcs: &'a Guest, @@ -328,7 +326,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/simple-export") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/simple-export`" ) })?; @@ -337,7 +335,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/simple-export` does \ not have export `{name}`" ) @@ -457,7 +455,7 @@ pub mod exports { #[allow(clippy::all)] pub mod export_using_import { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Y = super::super::super::super::foo::foo::transitive_import::Y; pub type A = wasmtime::component::ResourceAny; pub struct GuestA<'a> { @@ -489,7 +487,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/export-using-import") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/export-using-import`" ) })?; @@ -498,7 +496,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/export-using-import` does \ not have export `{name}`" ) @@ -626,7 +624,7 @@ pub mod exports { #[allow(clippy::all)] pub mod export_using_export1 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = wasmtime::component::ResourceAny; pub struct GuestA<'a> { funcs: &'a Guest, @@ -653,7 +651,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/export-using-export1") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/export-using-export1`" ) })?; @@ -662,7 +660,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/export-using-export1` does \ not have export `{name}`" ) @@ -723,7 +721,7 @@ pub mod exports { #[allow(clippy::all)] pub mod export_using_export2 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = super::super::super::super::exports::foo::foo::export_using_export1::A; pub type B = wasmtime::component::ResourceAny; pub struct GuestB<'a> { @@ -751,7 +749,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/export-using-export2") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/export-using-export2`" ) })?; @@ -760,7 +758,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/export-using-export2` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/resources-export_concurrent.rs b/crates/component-macro/tests/expanded/resources-export_concurrent.rs index a08a7293314e..23bf86f90f4b 100644 --- a/crates/component-macro/tests/expanded/resources-export_concurrent.rs +++ b/crates/component-macro/tests/expanded/resources-export_concurrent.rs @@ -109,8 +109,6 @@ pub struct W { interface3: exports::foo::foo::export_using_export2::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl WIndices { /// Creates a new copy of `WIndices` bindings which can then /// be used to instantiate into a particular store. @@ -235,7 +233,7 @@ pub mod foo { #[allow(clippy::all)] pub mod transitive_import { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub enum Y {} pub trait HostYWithStore: wasmtime::component::HasData { fn drop( @@ -289,7 +287,7 @@ pub mod exports { #[allow(clippy::all)] pub mod simple_export { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = wasmtime::component::ResourceAny; pub struct GuestA<'a> { funcs: &'a Guest, @@ -320,7 +318,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/simple-export") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/simple-export`" ) })?; @@ -329,7 +327,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/simple-export` does \ not have export `{name}`" ) @@ -445,7 +443,7 @@ pub mod exports { #[allow(clippy::all)] pub mod export_using_import { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Y = super::super::super::super::foo::foo::transitive_import::Y; pub type A = wasmtime::component::ResourceAny; pub struct GuestA<'a> { @@ -477,7 +475,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/export-using-import") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/export-using-import`" ) })?; @@ -486,7 +484,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/export-using-import` does \ not have export `{name}`" ) @@ -612,7 +610,7 @@ pub mod exports { #[allow(clippy::all)] pub mod export_using_export1 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = wasmtime::component::ResourceAny; pub struct GuestA<'a> { funcs: &'a Guest, @@ -639,7 +637,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/export-using-export1") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/export-using-export1`" ) })?; @@ -648,7 +646,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/export-using-export1` does \ not have export `{name}`" ) @@ -707,7 +705,7 @@ pub mod exports { #[allow(clippy::all)] pub mod export_using_export2 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = super::super::super::super::exports::foo::foo::export_using_export1::A; pub type B = wasmtime::component::ResourceAny; pub struct GuestB<'a> { @@ -735,7 +733,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/export-using-export2") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/export-using-export2`" ) })?; @@ -744,7 +742,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/export-using-export2` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/resources-export_tracing_async.rs b/crates/component-macro/tests/expanded/resources-export_tracing_async.rs index 49ad4526ce3c..a33a4aefeafa 100644 --- a/crates/component-macro/tests/expanded/resources-export_tracing_async.rs +++ b/crates/component-macro/tests/expanded/resources-export_tracing_async.rs @@ -109,8 +109,6 @@ pub struct W { interface3: exports::foo::foo::export_using_export2::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl WIndices { /// Creates a new copy of `WIndices` bindings which can then /// be used to instantiate into a particular store. @@ -235,7 +233,7 @@ pub mod foo { #[allow(clippy::all)] pub mod transitive_import { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub enum Y {} pub trait HostYWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostYWithStore for _T @@ -297,7 +295,7 @@ pub mod exports { #[allow(clippy::all)] pub mod simple_export { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = wasmtime::component::ResourceAny; pub struct GuestA<'a> { funcs: &'a Guest, @@ -328,7 +326,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/simple-export") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/simple-export`" ) })?; @@ -337,7 +335,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/simple-export` does \ not have export `{name}`" ) @@ -484,7 +482,7 @@ pub mod exports { #[allow(clippy::all)] pub mod export_using_import { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Y = super::super::super::super::foo::foo::transitive_import::Y; pub type A = wasmtime::component::ResourceAny; pub struct GuestA<'a> { @@ -516,7 +514,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/export-using-import") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/export-using-import`" ) })?; @@ -525,7 +523,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/export-using-import` does \ not have export `{name}`" ) @@ -682,7 +680,7 @@ pub mod exports { #[allow(clippy::all)] pub mod export_using_export1 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = wasmtime::component::ResourceAny; pub struct GuestA<'a> { funcs: &'a Guest, @@ -709,7 +707,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/export-using-export1") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/export-using-export1`" ) })?; @@ -718,7 +716,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/export-using-export1` does \ not have export `{name}`" ) @@ -788,7 +786,7 @@ pub mod exports { #[allow(clippy::all)] pub mod export_using_export2 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = super::super::super::super::exports::foo::foo::export_using_export1::A; pub type B = wasmtime::component::ResourceAny; pub struct GuestB<'a> { @@ -816,7 +814,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/export-using-export2") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/export-using-export2`" ) })?; @@ -825,7 +823,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/export-using-export2` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/resources-import.rs b/crates/component-macro/tests/expanded/resources-import.rs index ff7fce1d5f1d..d9bb1661af74 100644 --- a/crates/component-macro/tests/expanded/resources-import.rs +++ b/crates/component-macro/tests/expanded/resources-import.rs @@ -150,8 +150,6 @@ impl<_T: TheWorldImports + ?Sized> TheWorldImports for &mut _T { } } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -170,11 +168,13 @@ const _: () = { let (item, index) = _component .get_export(None, "some-world-func2") .ok_or_else(|| { - anyhow::anyhow!("no export `some-world-func2` found") + wasmtime::error::format_err!( + "no export `some-world-func2` found" + ) })?; match item { wasmtime::component::types::ComponentItem::ComponentFunc(func) => { - anyhow::Context::context( + wasmtime::error::Context::context( func .typecheck::< (), @@ -186,7 +186,7 @@ const _: () = { } _ => { Err( - anyhow::anyhow!( + wasmtime::error::format_err!( "export `some-world-func2` is not a function" ), )? @@ -377,7 +377,7 @@ pub mod foo { #[allow(clippy::all)] pub mod resources { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub enum Bar {} pub trait HostBarWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostBarWithStore for _T @@ -936,7 +936,7 @@ pub mod foo { #[allow(clippy::all)] pub mod long_use_chain1 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub enum A {} pub trait HostAWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostAWithStore for _T @@ -988,7 +988,7 @@ pub mod foo { #[allow(clippy::all)] pub mod long_use_chain2 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = super::super::super::foo::foo::long_use_chain1::A; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T @@ -1013,7 +1013,7 @@ pub mod foo { #[allow(clippy::all)] pub mod long_use_chain3 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = super::super::super::foo::foo::long_use_chain2::A; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T @@ -1038,7 +1038,7 @@ pub mod foo { #[allow(clippy::all)] pub mod long_use_chain4 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = super::super::super::foo::foo::long_use_chain3::A; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T @@ -1077,7 +1077,7 @@ pub mod foo { #[allow(clippy::all)] pub mod transitive_interface_with_resource { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub enum Foo {} pub trait HostFooWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostFooWithStore for _T @@ -1135,7 +1135,7 @@ pub mod exports { #[allow(clippy::all)] pub mod uses_resource_transitively { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Foo = super::super::super::super::foo::foo::transitive_interface_with_resource::Foo; #[derive(Clone)] pub struct Guest { @@ -1159,7 +1159,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/uses-resource-transitively") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/uses-resource-transitively`" ) })?; @@ -1168,7 +1168,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/uses-resource-transitively` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/resources-import_async.rs b/crates/component-macro/tests/expanded/resources-import_async.rs index 3ea8ce555ce8..d97c65cdc5cd 100644 --- a/crates/component-macro/tests/expanded/resources-import_async.rs +++ b/crates/component-macro/tests/expanded/resources-import_async.rs @@ -172,8 +172,6 @@ impl<_T: TheWorldImports + ?Sized + Send> TheWorldImports for &mut _T { } } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,11 +190,13 @@ const _: () = { let (item, index) = _component .get_export(None, "some-world-func2") .ok_or_else(|| { - anyhow::anyhow!("no export `some-world-func2` found") + wasmtime::error::format_err!( + "no export `some-world-func2` found" + ) })?; match item { wasmtime::component::types::ComponentItem::ComponentFunc(func) => { - anyhow::Context::context( + wasmtime::error::Context::context( func .typecheck::< (), @@ -208,7 +208,7 @@ const _: () = { } _ => { Err( - anyhow::anyhow!( + wasmtime::error::format_err!( "export `some-world-func2` is not a function" ), )? @@ -413,7 +413,7 @@ pub mod foo { #[allow(clippy::all)] pub mod resources { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub enum Bar {} pub trait HostBarWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostBarWithStore for _T @@ -1103,7 +1103,7 @@ pub mod foo { #[allow(clippy::all)] pub mod long_use_chain1 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub enum A {} pub trait HostAWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostAWithStore for _T @@ -1160,7 +1160,7 @@ pub mod foo { #[allow(clippy::all)] pub mod long_use_chain2 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = super::super::super::foo::foo::long_use_chain1::A; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T @@ -1185,7 +1185,7 @@ pub mod foo { #[allow(clippy::all)] pub mod long_use_chain3 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = super::super::super::foo::foo::long_use_chain2::A; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T @@ -1210,7 +1210,7 @@ pub mod foo { #[allow(clippy::all)] pub mod long_use_chain4 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = super::super::super::foo::foo::long_use_chain3::A; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T @@ -1259,7 +1259,7 @@ pub mod foo { #[allow(clippy::all)] pub mod transitive_interface_with_resource { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub enum Foo {} pub trait HostFooWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostFooWithStore for _T @@ -1322,7 +1322,7 @@ pub mod exports { #[allow(clippy::all)] pub mod uses_resource_transitively { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Foo = super::super::super::super::foo::foo::transitive_interface_with_resource::Foo; #[derive(Clone)] pub struct Guest { @@ -1346,7 +1346,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/uses-resource-transitively") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/uses-resource-transitively`" ) })?; @@ -1355,7 +1355,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/uses-resource-transitively` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/resources-import_concurrent.rs b/crates/component-macro/tests/expanded/resources-import_concurrent.rs index 4c40a6aa5163..2fde140a2c47 100644 --- a/crates/component-macro/tests/expanded/resources-import_concurrent.rs +++ b/crates/component-macro/tests/expanded/resources-import_concurrent.rs @@ -137,8 +137,6 @@ pub trait TheWorldImportsWithStore: wasmtime::component::HasData + HostWorldReso pub trait TheWorldImports: HostWorldResource + Send {} impl<_T: TheWorldImports + ?Sized + Send> TheWorldImports for &mut _T {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -157,11 +155,13 @@ const _: () = { let (item, index) = _component .get_export(None, "some-world-func2") .ok_or_else(|| { - anyhow::anyhow!("no export `some-world-func2` found") + wasmtime::error::format_err!( + "no export `some-world-func2` found" + ) })?; match item { wasmtime::component::types::ComponentItem::ComponentFunc(func) => { - anyhow::Context::context( + wasmtime::error::Context::context( func .typecheck::< (), @@ -173,7 +173,7 @@ const _: () = { } _ => { Err( - anyhow::anyhow!( + wasmtime::error::format_err!( "export `some-world-func2` is not a function" ), )? @@ -384,7 +384,7 @@ pub mod foo { #[allow(clippy::all)] pub mod resources { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub enum Bar {} pub trait HostBarWithStore: wasmtime::component::HasData + Send { fn drop( @@ -914,7 +914,7 @@ pub mod foo { #[allow(clippy::all)] pub mod long_use_chain1 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub enum A {} pub trait HostAWithStore: wasmtime::component::HasData { fn drop( @@ -963,7 +963,7 @@ pub mod foo { #[allow(clippy::all)] pub mod long_use_chain2 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = super::super::super::foo::foo::long_use_chain1::A; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T @@ -988,7 +988,7 @@ pub mod foo { #[allow(clippy::all)] pub mod long_use_chain3 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = super::super::super::foo::foo::long_use_chain2::A; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T @@ -1013,7 +1013,7 @@ pub mod foo { #[allow(clippy::all)] pub mod long_use_chain4 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = super::super::super::foo::foo::long_use_chain3::A; pub trait HostWithStore: wasmtime::component::HasData + Send { fn foo( @@ -1050,7 +1050,7 @@ pub mod foo { #[allow(clippy::all)] pub mod transitive_interface_with_resource { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub enum Foo {} pub trait HostFooWithStore: wasmtime::component::HasData { fn drop( @@ -1105,7 +1105,7 @@ pub mod exports { #[allow(clippy::all)] pub mod uses_resource_transitively { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Foo = super::super::super::super::foo::foo::transitive_interface_with_resource::Foo; #[derive(Clone)] pub struct Guest { @@ -1129,7 +1129,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/uses-resource-transitively") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/uses-resource-transitively`" ) })?; @@ -1138,7 +1138,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/uses-resource-transitively` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/resources-import_tracing_async.rs b/crates/component-macro/tests/expanded/resources-import_tracing_async.rs index 1556124d3cd5..2ea27cc27438 100644 --- a/crates/component-macro/tests/expanded/resources-import_tracing_async.rs +++ b/crates/component-macro/tests/expanded/resources-import_tracing_async.rs @@ -172,8 +172,6 @@ impl<_T: TheWorldImports + ?Sized + Send> TheWorldImports for &mut _T { } } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,11 +190,13 @@ const _: () = { let (item, index) = _component .get_export(None, "some-world-func2") .ok_or_else(|| { - anyhow::anyhow!("no export `some-world-func2` found") + wasmtime::error::format_err!( + "no export `some-world-func2` found" + ) })?; match item { wasmtime::component::types::ComponentItem::ComponentFunc(func) => { - anyhow::Context::context( + wasmtime::error::Context::context( func .typecheck::< (), @@ -208,7 +208,7 @@ const _: () = { } _ => { Err( - anyhow::anyhow!( + wasmtime::error::format_err!( "export `some-world-func2` is not a function" ), )? @@ -476,7 +476,7 @@ pub mod foo { #[allow(clippy::all)] pub mod resources { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub enum Bar {} pub trait HostBarWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostBarWithStore for _T @@ -1507,7 +1507,7 @@ pub mod foo { #[allow(clippy::all)] pub mod long_use_chain1 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub enum A {} pub trait HostAWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostAWithStore for _T @@ -1564,7 +1564,7 @@ pub mod foo { #[allow(clippy::all)] pub mod long_use_chain2 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = super::super::super::foo::foo::long_use_chain1::A; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T @@ -1589,7 +1589,7 @@ pub mod foo { #[allow(clippy::all)] pub mod long_use_chain3 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = super::super::super::foo::foo::long_use_chain2::A; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T @@ -1614,7 +1614,7 @@ pub mod foo { #[allow(clippy::all)] pub mod long_use_chain4 { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type A = super::super::super::foo::foo::long_use_chain3::A; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T @@ -1676,7 +1676,7 @@ pub mod foo { #[allow(clippy::all)] pub mod transitive_interface_with_resource { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub enum Foo {} pub trait HostFooWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostFooWithStore for _T @@ -1739,7 +1739,7 @@ pub mod exports { #[allow(clippy::all)] pub mod uses_resource_transitively { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Foo = super::super::super::super::foo::foo::transitive_interface_with_resource::Foo; #[derive(Clone)] pub struct Guest { @@ -1763,7 +1763,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/uses-resource-transitively") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/uses-resource-transitively`" ) })?; @@ -1772,7 +1772,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/uses-resource-transitively` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/share-types.rs b/crates/component-macro/tests/expanded/share-types.rs index a71fac51f186..1346bf0c56e1 100644 --- a/crates/component-macro/tests/expanded/share-types.rs +++ b/crates/component-macro/tests/expanded/share-types.rs @@ -103,8 +103,6 @@ pub struct HttpInterface { interface0: exports::http_handler::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl HttpInterfaceIndices { /// Creates a new copy of `HttpInterfaceIndices` bindings which can then /// be used to instantiate into a particular store. @@ -191,7 +189,7 @@ pub mod foo { #[allow(clippy::all)] pub mod http_types { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -255,7 +253,7 @@ pub mod foo { #[allow(clippy::all)] pub mod http_fetch { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Request = super::foo::foo::http_types::Request; const _: () = { assert!(8 == < Request as wasmtime::component::ComponentType >::SIZE32); @@ -304,7 +302,7 @@ pub mod exports { #[allow(clippy::all)] pub mod http_handler { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Request = super::super::foo::foo::http_types::Request; const _: () = { assert!(8 == < Request as wasmtime::component::ComponentType >::SIZE32); @@ -337,14 +335,16 @@ pub mod exports { .component() .get_export_index(None, "http-handler") .ok_or_else(|| { - anyhow::anyhow!("no exported instance named `http-handler`") + wasmtime::error::format_err!( + "no exported instance named `http-handler`" + ) })?; let mut lookup = move |name| { _instance_pre .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `http-handler` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/share-types_async.rs b/crates/component-macro/tests/expanded/share-types_async.rs index f972dd9f87ad..52e7b53a254c 100644 --- a/crates/component-macro/tests/expanded/share-types_async.rs +++ b/crates/component-macro/tests/expanded/share-types_async.rs @@ -103,8 +103,6 @@ pub struct HttpInterface { interface0: exports::http_handler::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl HttpInterfaceIndices { /// Creates a new copy of `HttpInterfaceIndices` bindings which can then /// be used to instantiate into a particular store. @@ -191,7 +189,7 @@ pub mod foo { #[allow(clippy::all)] pub mod http_types { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -255,7 +253,7 @@ pub mod foo { #[allow(clippy::all)] pub mod http_fetch { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Request = super::foo::foo::http_types::Request; const _: () = { assert!(8 == < Request as wasmtime::component::ComponentType >::SIZE32); @@ -312,7 +310,7 @@ pub mod exports { #[allow(clippy::all)] pub mod http_handler { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Request = super::super::foo::foo::http_types::Request; const _: () = { assert!(8 == < Request as wasmtime::component::ComponentType >::SIZE32); @@ -345,14 +343,16 @@ pub mod exports { .component() .get_export_index(None, "http-handler") .ok_or_else(|| { - anyhow::anyhow!("no exported instance named `http-handler`") + wasmtime::error::format_err!( + "no exported instance named `http-handler`" + ) })?; let mut lookup = move |name| { _instance_pre .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `http-handler` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/share-types_concurrent.rs b/crates/component-macro/tests/expanded/share-types_concurrent.rs index 663eb83db1dd..be1fbb7f12d9 100644 --- a/crates/component-macro/tests/expanded/share-types_concurrent.rs +++ b/crates/component-macro/tests/expanded/share-types_concurrent.rs @@ -103,8 +103,6 @@ pub struct HttpInterface { interface0: exports::http_handler::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl HttpInterfaceIndices { /// Creates a new copy of `HttpInterfaceIndices` bindings which can then /// be used to instantiate into a particular store. @@ -191,7 +189,7 @@ pub mod foo { #[allow(clippy::all)] pub mod http_types { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -255,7 +253,7 @@ pub mod foo { #[allow(clippy::all)] pub mod http_fetch { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Request = super::foo::foo::http_types::Request; const _: () = { assert!(8 == < Request as wasmtime::component::ComponentType >::SIZE32); @@ -301,7 +299,7 @@ pub mod exports { #[allow(clippy::all)] pub mod http_handler { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Request = super::super::foo::foo::http_types::Request; const _: () = { assert!(8 == < Request as wasmtime::component::ComponentType >::SIZE32); @@ -334,14 +332,16 @@ pub mod exports { .component() .get_export_index(None, "http-handler") .ok_or_else(|| { - anyhow::anyhow!("no exported instance named `http-handler`") + wasmtime::error::format_err!( + "no exported instance named `http-handler`" + ) })?; let mut lookup = move |name| { _instance_pre .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `http-handler` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/share-types_tracing_async.rs b/crates/component-macro/tests/expanded/share-types_tracing_async.rs index 0f6f82cecbad..2567f45bd716 100644 --- a/crates/component-macro/tests/expanded/share-types_tracing_async.rs +++ b/crates/component-macro/tests/expanded/share-types_tracing_async.rs @@ -103,8 +103,6 @@ pub struct HttpInterface { interface0: exports::http_handler::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl HttpInterfaceIndices { /// Creates a new copy of `HttpInterfaceIndices` bindings which can then /// be used to instantiate into a particular store. @@ -191,7 +189,7 @@ pub mod foo { #[allow(clippy::all)] pub mod http_types { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -255,7 +253,7 @@ pub mod foo { #[allow(clippy::all)] pub mod http_fetch { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Request = super::foo::foo::http_types::Request; const _: () = { assert!(8 == < Request as wasmtime::component::ComponentType >::SIZE32); @@ -328,7 +326,7 @@ pub mod exports { #[allow(clippy::all)] pub mod http_handler { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Request = super::super::foo::foo::http_types::Request; const _: () = { assert!(8 == < Request as wasmtime::component::ComponentType >::SIZE32); @@ -361,14 +359,16 @@ pub mod exports { .component() .get_export_index(None, "http-handler") .ok_or_else(|| { - anyhow::anyhow!("no exported instance named `http-handler`") + wasmtime::error::format_err!( + "no exported instance named `http-handler`" + ) })?; let mut lookup = move |name| { _instance_pre .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `http-handler` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/simple-functions.rs b/crates/component-macro/tests/expanded/simple-functions.rs index 141b83ca3726..14fcd4e374c4 100644 --- a/crates/component-macro/tests/expanded/simple-functions.rs +++ b/crates/component-macro/tests/expanded/simple-functions.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::simple::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod simple { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T where @@ -301,7 +299,7 @@ pub mod exports { #[allow(clippy::all)] pub mod simple { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { f1: wasmtime::component::Func, @@ -334,7 +332,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/simple") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/simple`" ) })?; @@ -343,7 +341,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/simple` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/simple-functions_async.rs b/crates/component-macro/tests/expanded/simple-functions_async.rs index 974577688f1f..d83009f52ae0 100644 --- a/crates/component-macro/tests/expanded/simple-functions_async.rs +++ b/crates/component-macro/tests/expanded/simple-functions_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::simple::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod simple { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T where @@ -341,7 +339,7 @@ pub mod exports { #[allow(clippy::all)] pub mod simple { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { f1: wasmtime::component::Func, @@ -374,7 +372,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/simple") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/simple`" ) })?; @@ -383,7 +381,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/simple` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/simple-functions_concurrent.rs b/crates/component-macro/tests/expanded/simple-functions_concurrent.rs index a7d02c9ea477..903f76338224 100644 --- a/crates/component-macro/tests/expanded/simple-functions_concurrent.rs +++ b/crates/component-macro/tests/expanded/simple-functions_concurrent.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::simple::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod simple { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send { fn f1( accessor: &wasmtime::component::Accessor, @@ -309,7 +307,7 @@ pub mod exports { #[allow(clippy::all)] pub mod simple { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { f1: wasmtime::component::Func, @@ -342,7 +340,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/simple") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/simple`" ) })?; @@ -351,7 +349,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/simple` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/simple-functions_tracing_async.rs b/crates/component-macro/tests/expanded/simple-functions_tracing_async.rs index b2c7c618bc6a..05ad53e189e3 100644 --- a/crates/component-macro/tests/expanded/simple-functions_tracing_async.rs +++ b/crates/component-macro/tests/expanded/simple-functions_tracing_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::simple::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod simple { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T where @@ -429,7 +427,7 @@ pub mod exports { #[allow(clippy::all)] pub mod simple { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { f1: wasmtime::component::Func, @@ -462,7 +460,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/simple") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/simple`" ) })?; @@ -471,7 +469,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/simple` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/simple-lists.rs b/crates/component-macro/tests/expanded/simple-lists.rs index 044e325cead2..3c60e7601f7d 100644 --- a/crates/component-macro/tests/expanded/simple-lists.rs +++ b/crates/component-macro/tests/expanded/simple-lists.rs @@ -103,8 +103,6 @@ pub struct MyWorld { interface0: exports::foo::foo::simple_lists::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl MyWorldIndices { /// Creates a new copy of `MyWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod simple_lists { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T where @@ -326,7 +324,7 @@ pub mod exports { #[allow(clippy::all)] pub mod simple_lists { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { simple_list1: wasmtime::component::Func, @@ -355,7 +353,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/simple-lists") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/simple-lists`" ) })?; @@ -364,7 +362,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/simple-lists` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/simple-lists_async.rs b/crates/component-macro/tests/expanded/simple-lists_async.rs index 06afa4710aaf..224879d1b1d8 100644 --- a/crates/component-macro/tests/expanded/simple-lists_async.rs +++ b/crates/component-macro/tests/expanded/simple-lists_async.rs @@ -103,8 +103,6 @@ pub struct MyWorld { interface0: exports::foo::foo::simple_lists::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl MyWorldIndices { /// Creates a new copy of `MyWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod simple_lists { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T where @@ -350,7 +348,7 @@ pub mod exports { #[allow(clippy::all)] pub mod simple_lists { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { simple_list1: wasmtime::component::Func, @@ -379,7 +377,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/simple-lists") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/simple-lists`" ) })?; @@ -388,7 +386,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/simple-lists` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/simple-lists_concurrent.rs b/crates/component-macro/tests/expanded/simple-lists_concurrent.rs index a0ac7167134e..5e0da20b4c76 100644 --- a/crates/component-macro/tests/expanded/simple-lists_concurrent.rs +++ b/crates/component-macro/tests/expanded/simple-lists_concurrent.rs @@ -103,8 +103,6 @@ pub struct MyWorld { interface0: exports::foo::foo::simple_lists::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl MyWorldIndices { /// Creates a new copy of `MyWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod simple_lists { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send { fn simple_list1( accessor: &wasmtime::component::Accessor, @@ -309,7 +307,7 @@ pub mod exports { #[allow(clippy::all)] pub mod simple_lists { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { simple_list1: wasmtime::component::Func, @@ -338,7 +336,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/simple-lists") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/simple-lists`" ) })?; @@ -347,7 +345,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/simple-lists` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/simple-lists_tracing_async.rs b/crates/component-macro/tests/expanded/simple-lists_tracing_async.rs index 15f519a6ccf6..e999beb3ea3b 100644 --- a/crates/component-macro/tests/expanded/simple-lists_tracing_async.rs +++ b/crates/component-macro/tests/expanded/simple-lists_tracing_async.rs @@ -103,8 +103,6 @@ pub struct MyWorld { interface0: exports::foo::foo::simple_lists::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl MyWorldIndices { /// Creates a new copy of `MyWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod simple_lists { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T where @@ -411,7 +409,7 @@ pub mod exports { #[allow(clippy::all)] pub mod simple_lists { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { simple_list1: wasmtime::component::Func, @@ -440,7 +438,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/simple-lists") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/simple-lists`" ) })?; @@ -449,7 +447,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/simple-lists` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/simple-wasi.rs b/crates/component-macro/tests/expanded/simple-wasi.rs index e03046174c39..0a0ce4ea8946 100644 --- a/crates/component-macro/tests/expanded/simple-wasi.rs +++ b/crates/component-macro/tests/expanded/simple-wasi.rs @@ -99,8 +99,6 @@ pub struct WasiIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Wasi {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl WasiIndices { /// Creates a new copy of `WasiIndices` bindings which can then /// be used to instantiate into a particular store. @@ -185,7 +183,7 @@ pub mod foo { #[allow(clippy::all)] pub mod wasi_filesystem { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -296,7 +294,7 @@ pub mod foo { #[allow(clippy::all)] pub mod wall_clock { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] diff --git a/crates/component-macro/tests/expanded/simple-wasi_async.rs b/crates/component-macro/tests/expanded/simple-wasi_async.rs index 440730644bfa..be9f3ff57b63 100644 --- a/crates/component-macro/tests/expanded/simple-wasi_async.rs +++ b/crates/component-macro/tests/expanded/simple-wasi_async.rs @@ -99,8 +99,6 @@ pub struct WasiIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Wasi {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl WasiIndices { /// Creates a new copy of `WasiIndices` bindings which can then /// be used to instantiate into a particular store. @@ -185,7 +183,7 @@ pub mod foo { #[allow(clippy::all)] pub mod wasi_filesystem { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -312,7 +310,7 @@ pub mod foo { #[allow(clippy::all)] pub mod wall_clock { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] diff --git a/crates/component-macro/tests/expanded/simple-wasi_concurrent.rs b/crates/component-macro/tests/expanded/simple-wasi_concurrent.rs index d4e08f880cb9..94cd4b0c7a28 100644 --- a/crates/component-macro/tests/expanded/simple-wasi_concurrent.rs +++ b/crates/component-macro/tests/expanded/simple-wasi_concurrent.rs @@ -99,8 +99,6 @@ pub struct WasiIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Wasi {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl WasiIndices { /// Creates a new copy of `WasiIndices` bindings which can then /// be used to instantiate into a particular store. @@ -185,7 +183,7 @@ pub mod foo { #[allow(clippy::all)] pub mod wasi_filesystem { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -296,7 +294,7 @@ pub mod foo { #[allow(clippy::all)] pub mod wall_clock { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] diff --git a/crates/component-macro/tests/expanded/simple-wasi_tracing_async.rs b/crates/component-macro/tests/expanded/simple-wasi_tracing_async.rs index bb6257dd21ed..eb159e7c510d 100644 --- a/crates/component-macro/tests/expanded/simple-wasi_tracing_async.rs +++ b/crates/component-macro/tests/expanded/simple-wasi_tracing_async.rs @@ -99,8 +99,6 @@ pub struct WasiIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Wasi {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl WasiIndices { /// Creates a new copy of `WasiIndices` bindings which can then /// be used to instantiate into a particular store. @@ -185,7 +183,7 @@ pub mod foo { #[allow(clippy::all)] pub mod wasi_filesystem { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -338,7 +336,7 @@ pub mod foo { #[allow(clippy::all)] pub mod wall_clock { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] diff --git a/crates/component-macro/tests/expanded/small-anonymous.rs b/crates/component-macro/tests/expanded/small-anonymous.rs index 9b6cf457e89f..c9fbd403d5ab 100644 --- a/crates/component-macro/tests/expanded/small-anonymous.rs +++ b/crates/component-macro/tests/expanded/small-anonymous.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::anon::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -190,7 +188,7 @@ pub mod foo { #[allow(clippy::all)] pub mod anon { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -282,7 +280,7 @@ pub mod exports { #[allow(clippy::all)] pub mod anon { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -360,14 +358,16 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/anon") .ok_or_else(|| { - anyhow::anyhow!("no exported instance named `foo:foo/anon`") + wasmtime::error::format_err!( + "no exported instance named `foo:foo/anon`" + ) })?; let mut lookup = move |name| { _instance_pre .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/anon` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/small-anonymous_async.rs b/crates/component-macro/tests/expanded/small-anonymous_async.rs index bd0df2997c3f..55a7b9be3f09 100644 --- a/crates/component-macro/tests/expanded/small-anonymous_async.rs +++ b/crates/component-macro/tests/expanded/small-anonymous_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::anon::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -190,7 +188,7 @@ pub mod foo { #[allow(clippy::all)] pub mod anon { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -294,7 +292,7 @@ pub mod exports { #[allow(clippy::all)] pub mod anon { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -372,14 +370,16 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/anon") .ok_or_else(|| { - anyhow::anyhow!("no exported instance named `foo:foo/anon`") + wasmtime::error::format_err!( + "no exported instance named `foo:foo/anon`" + ) })?; let mut lookup = move |name| { _instance_pre .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/anon` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/small-anonymous_concurrent.rs b/crates/component-macro/tests/expanded/small-anonymous_concurrent.rs index a14c649b9642..7bc83a4ac032 100644 --- a/crates/component-macro/tests/expanded/small-anonymous_concurrent.rs +++ b/crates/component-macro/tests/expanded/small-anonymous_concurrent.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::anon::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -190,7 +188,7 @@ pub mod foo { #[allow(clippy::all)] pub mod anon { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -279,7 +277,7 @@ pub mod exports { #[allow(clippy::all)] pub mod anon { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -357,14 +355,16 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/anon") .ok_or_else(|| { - anyhow::anyhow!("no exported instance named `foo:foo/anon`") + wasmtime::error::format_err!( + "no exported instance named `foo:foo/anon`" + ) })?; let mut lookup = move |name| { _instance_pre .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/anon` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/small-anonymous_tracing_async.rs b/crates/component-macro/tests/expanded/small-anonymous_tracing_async.rs index a0e22a4b26fb..71c3fdc6731c 100644 --- a/crates/component-macro/tests/expanded/small-anonymous_tracing_async.rs +++ b/crates/component-macro/tests/expanded/small-anonymous_tracing_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::anon::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -190,7 +188,7 @@ pub mod foo { #[allow(clippy::all)] pub mod anon { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -307,7 +305,7 @@ pub mod exports { #[allow(clippy::all)] pub mod anon { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -385,14 +383,16 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/anon") .ok_or_else(|| { - anyhow::anyhow!("no exported instance named `foo:foo/anon`") + wasmtime::error::format_err!( + "no exported instance named `foo:foo/anon`" + ) })?; let mut lookup = move |name| { _instance_pre .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/anon` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/smoke-default.rs b/crates/component-macro/tests/expanded/smoke-default.rs index 8339870717ae..4bf0e770c1ed 100644 --- a/crates/component-macro/tests/expanded/smoke-default.rs +++ b/crates/component-macro/tests/expanded/smoke-default.rs @@ -103,8 +103,6 @@ pub struct TheWorld { y: wasmtime::component::Func, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -119,16 +117,20 @@ const _: () = { let y = { let (item, index) = _component .get_export(None, "y") - .ok_or_else(|| anyhow::anyhow!("no export `y` found"))?; + .ok_or_else(|| wasmtime::error::format_err!("no export `y` found"))?; match item { wasmtime::component::types::ComponentItem::ComponentFunc(func) => { - anyhow::Context::context( + wasmtime::error::Context::context( func.typecheck::<(), ()>(&_instance_type), "type-checking export func `y`", )?; index } - _ => Err(anyhow::anyhow!("export `y` is not a function"))?, + _ => { + Err( + wasmtime::error::format_err!("export `y` is not a function"), + )? + } } }; Ok(TheWorldIndices { y }) diff --git a/crates/component-macro/tests/expanded/smoke-default_async.rs b/crates/component-macro/tests/expanded/smoke-default_async.rs index 13b4fc07bf31..cfc4d2457b83 100644 --- a/crates/component-macro/tests/expanded/smoke-default_async.rs +++ b/crates/component-macro/tests/expanded/smoke-default_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { y: wasmtime::component::Func, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -119,16 +117,20 @@ const _: () = { let y = { let (item, index) = _component .get_export(None, "y") - .ok_or_else(|| anyhow::anyhow!("no export `y` found"))?; + .ok_or_else(|| wasmtime::error::format_err!("no export `y` found"))?; match item { wasmtime::component::types::ComponentItem::ComponentFunc(func) => { - anyhow::Context::context( + wasmtime::error::Context::context( func.typecheck::<(), ()>(&_instance_type), "type-checking export func `y`", )?; index } - _ => Err(anyhow::anyhow!("export `y` is not a function"))?, + _ => { + Err( + wasmtime::error::format_err!("export `y` is not a function"), + )? + } } }; Ok(TheWorldIndices { y }) diff --git a/crates/component-macro/tests/expanded/smoke-default_concurrent.rs b/crates/component-macro/tests/expanded/smoke-default_concurrent.rs index 9e92a8d41aea..ffa34d1ef8f9 100644 --- a/crates/component-macro/tests/expanded/smoke-default_concurrent.rs +++ b/crates/component-macro/tests/expanded/smoke-default_concurrent.rs @@ -103,8 +103,6 @@ pub struct TheWorld { y: wasmtime::component::Func, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -119,16 +117,20 @@ const _: () = { let y = { let (item, index) = _component .get_export(None, "y") - .ok_or_else(|| anyhow::anyhow!("no export `y` found"))?; + .ok_or_else(|| wasmtime::error::format_err!("no export `y` found"))?; match item { wasmtime::component::types::ComponentItem::ComponentFunc(func) => { - anyhow::Context::context( + wasmtime::error::Context::context( func.typecheck::<(), ()>(&_instance_type), "type-checking export func `y`", )?; index } - _ => Err(anyhow::anyhow!("export `y` is not a function"))?, + _ => { + Err( + wasmtime::error::format_err!("export `y` is not a function"), + )? + } } }; Ok(TheWorldIndices { y }) diff --git a/crates/component-macro/tests/expanded/smoke-default_tracing_async.rs b/crates/component-macro/tests/expanded/smoke-default_tracing_async.rs index 34da31174c81..0d60ab73c08b 100644 --- a/crates/component-macro/tests/expanded/smoke-default_tracing_async.rs +++ b/crates/component-macro/tests/expanded/smoke-default_tracing_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { y: wasmtime::component::Func, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -119,16 +117,20 @@ const _: () = { let y = { let (item, index) = _component .get_export(None, "y") - .ok_or_else(|| anyhow::anyhow!("no export `y` found"))?; + .ok_or_else(|| wasmtime::error::format_err!("no export `y` found"))?; match item { wasmtime::component::types::ComponentItem::ComponentFunc(func) => { - anyhow::Context::context( + wasmtime::error::Context::context( func.typecheck::<(), ()>(&_instance_type), "type-checking export func `y`", )?; index } - _ => Err(anyhow::anyhow!("export `y` is not a function"))?, + _ => { + Err( + wasmtime::error::format_err!("export `y` is not a function"), + )? + } } }; Ok(TheWorldIndices { y }) diff --git a/crates/component-macro/tests/expanded/smoke-export.rs b/crates/component-macro/tests/expanded/smoke-export.rs index 5659486b2903..b2198bff6338 100644 --- a/crates/component-macro/tests/expanded/smoke-export.rs +++ b/crates/component-macro/tests/expanded/smoke-export.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::the_name::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -177,7 +175,7 @@ pub mod exports { #[allow(clippy::all)] pub mod the_name { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { y: wasmtime::component::Func, @@ -200,14 +198,16 @@ pub mod exports { .component() .get_export_index(None, "the-name") .ok_or_else(|| { - anyhow::anyhow!("no exported instance named `the-name`") + wasmtime::error::format_err!( + "no exported instance named `the-name`" + ) })?; let mut lookup = move |name| { _instance_pre .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `the-name` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/smoke-export_async.rs b/crates/component-macro/tests/expanded/smoke-export_async.rs index f7838fe51ef8..31e0f05f5db6 100644 --- a/crates/component-macro/tests/expanded/smoke-export_async.rs +++ b/crates/component-macro/tests/expanded/smoke-export_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::the_name::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -177,7 +175,7 @@ pub mod exports { #[allow(clippy::all)] pub mod the_name { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { y: wasmtime::component::Func, @@ -200,14 +198,16 @@ pub mod exports { .component() .get_export_index(None, "the-name") .ok_or_else(|| { - anyhow::anyhow!("no exported instance named `the-name`") + wasmtime::error::format_err!( + "no exported instance named `the-name`" + ) })?; let mut lookup = move |name| { _instance_pre .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `the-name` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/smoke-export_concurrent.rs b/crates/component-macro/tests/expanded/smoke-export_concurrent.rs index 03a04b2de750..7ad88d881b18 100644 --- a/crates/component-macro/tests/expanded/smoke-export_concurrent.rs +++ b/crates/component-macro/tests/expanded/smoke-export_concurrent.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::the_name::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -177,7 +175,7 @@ pub mod exports { #[allow(clippy::all)] pub mod the_name { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { y: wasmtime::component::Func, @@ -200,14 +198,16 @@ pub mod exports { .component() .get_export_index(None, "the-name") .ok_or_else(|| { - anyhow::anyhow!("no exported instance named `the-name`") + wasmtime::error::format_err!( + "no exported instance named `the-name`" + ) })?; let mut lookup = move |name| { _instance_pre .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `the-name` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/smoke-export_tracing_async.rs b/crates/component-macro/tests/expanded/smoke-export_tracing_async.rs index d40a07a0a845..45daac985582 100644 --- a/crates/component-macro/tests/expanded/smoke-export_tracing_async.rs +++ b/crates/component-macro/tests/expanded/smoke-export_tracing_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::the_name::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -177,7 +175,7 @@ pub mod exports { #[allow(clippy::all)] pub mod the_name { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { y: wasmtime::component::Func, @@ -200,14 +198,16 @@ pub mod exports { .component() .get_export_index(None, "the-name") .ok_or_else(|| { - anyhow::anyhow!("no exported instance named `the-name`") + wasmtime::error::format_err!( + "no exported instance named `the-name`" + ) })?; let mut lookup = move |name| { _instance_pre .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `the-name` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/smoke.rs b/crates/component-macro/tests/expanded/smoke.rs index 11017212a3a8..16be78927ed2 100644 --- a/crates/component-macro/tests/expanded/smoke.rs +++ b/crates/component-macro/tests/expanded/smoke.rs @@ -99,8 +99,6 @@ pub struct TheWorldIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct TheWorld {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -179,7 +177,7 @@ const _: () = { #[allow(clippy::all)] pub mod imports { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T where diff --git a/crates/component-macro/tests/expanded/smoke_async.rs b/crates/component-macro/tests/expanded/smoke_async.rs index bffddae5cd29..9bbe696320c3 100644 --- a/crates/component-macro/tests/expanded/smoke_async.rs +++ b/crates/component-macro/tests/expanded/smoke_async.rs @@ -99,8 +99,6 @@ pub struct TheWorldIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct TheWorld {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -179,7 +177,7 @@ const _: () = { #[allow(clippy::all)] pub mod imports { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T where diff --git a/crates/component-macro/tests/expanded/smoke_concurrent.rs b/crates/component-macro/tests/expanded/smoke_concurrent.rs index 28629475ccab..db37d59b587a 100644 --- a/crates/component-macro/tests/expanded/smoke_concurrent.rs +++ b/crates/component-macro/tests/expanded/smoke_concurrent.rs @@ -99,8 +99,6 @@ pub struct TheWorldIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct TheWorld {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -179,7 +177,7 @@ const _: () = { #[allow(clippy::all)] pub mod imports { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send { fn y( accessor: &wasmtime::component::Accessor, diff --git a/crates/component-macro/tests/expanded/smoke_tracing_async.rs b/crates/component-macro/tests/expanded/smoke_tracing_async.rs index 221f9b9bd06e..a2158b63438e 100644 --- a/crates/component-macro/tests/expanded/smoke_tracing_async.rs +++ b/crates/component-macro/tests/expanded/smoke_tracing_async.rs @@ -99,8 +99,6 @@ pub struct TheWorldIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct TheWorld {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -179,7 +177,7 @@ const _: () = { #[allow(clippy::all)] pub mod imports { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T where diff --git a/crates/component-macro/tests/expanded/strings.rs b/crates/component-macro/tests/expanded/strings.rs index 744f839aa45a..75c6dc71e9cf 100644 --- a/crates/component-macro/tests/expanded/strings.rs +++ b/crates/component-macro/tests/expanded/strings.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::strings::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod strings { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData {} impl<_T: ?Sized> HostWithStore for _T where @@ -279,7 +277,7 @@ pub mod exports { #[allow(clippy::all)] pub mod strings { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { a: wasmtime::component::Func, @@ -306,7 +304,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/strings") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/strings`" ) })?; @@ -315,7 +313,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/strings` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/strings_async.rs b/crates/component-macro/tests/expanded/strings_async.rs index c3bca170bcc6..bfb3a014adec 100644 --- a/crates/component-macro/tests/expanded/strings_async.rs +++ b/crates/component-macro/tests/expanded/strings_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::strings::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod strings { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T where @@ -303,7 +301,7 @@ pub mod exports { #[allow(clippy::all)] pub mod strings { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { a: wasmtime::component::Func, @@ -330,7 +328,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/strings") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/strings`" ) })?; @@ -339,7 +337,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/strings` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/strings_concurrent.rs b/crates/component-macro/tests/expanded/strings_concurrent.rs index acf72fecc49f..7adab762d47a 100644 --- a/crates/component-macro/tests/expanded/strings_concurrent.rs +++ b/crates/component-macro/tests/expanded/strings_concurrent.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::strings::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod strings { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send { fn a( accessor: &wasmtime::component::Accessor, @@ -276,7 +274,7 @@ pub mod exports { #[allow(clippy::all)] pub mod strings { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { a: wasmtime::component::Func, @@ -303,7 +301,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/strings") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/strings`" ) })?; @@ -312,7 +310,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/strings` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/strings_tracing_async.rs b/crates/component-macro/tests/expanded/strings_tracing_async.rs index 4d63ddcf3832..60340d16dcdb 100644 --- a/crates/component-macro/tests/expanded/strings_tracing_async.rs +++ b/crates/component-macro/tests/expanded/strings_tracing_async.rs @@ -103,8 +103,6 @@ pub struct TheWorld { interface0: exports::foo::foo::strings::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod strings { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub trait HostWithStore: wasmtime::component::HasData + Send {} impl<_T: ?Sized> HostWithStore for _T where @@ -348,7 +346,7 @@ pub mod exports { #[allow(clippy::all)] pub mod strings { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(Clone)] pub struct Guest { a: wasmtime::component::Func, @@ -375,7 +373,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/strings") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/strings`" ) })?; @@ -384,7 +382,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/strings` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/unstable-features.rs b/crates/component-macro/tests/expanded/unstable-features.rs index bec51d02ca84..06efe9dbd934 100644 --- a/crates/component-macro/tests/expanded/unstable-features.rs +++ b/crates/component-macro/tests/expanded/unstable-features.rs @@ -210,8 +210,6 @@ impl<_T: TheWorldImports + ?Sized> TheWorldImports for &mut _T { } } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -352,7 +350,7 @@ pub mod foo { #[allow(clippy::all)] pub mod the_interface { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; /// Link-time configurations. #[derive(Clone, Debug, Default)] pub struct LinkOptions { diff --git a/crates/component-macro/tests/expanded/unstable-features_async.rs b/crates/component-macro/tests/expanded/unstable-features_async.rs index 9e3ad87967b9..1540f2a2cf44 100644 --- a/crates/component-macro/tests/expanded/unstable-features_async.rs +++ b/crates/component-macro/tests/expanded/unstable-features_async.rs @@ -222,8 +222,6 @@ impl<_T: TheWorldImports + ?Sized + Send> TheWorldImports for &mut _T { } } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -373,7 +371,7 @@ pub mod foo { #[allow(clippy::all)] pub mod the_interface { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; /// Link-time configurations. #[derive(Clone, Debug, Default)] pub struct LinkOptions { diff --git a/crates/component-macro/tests/expanded/unstable-features_concurrent.rs b/crates/component-macro/tests/expanded/unstable-features_concurrent.rs index 2badcc502428..10fa5d11c89a 100644 --- a/crates/component-macro/tests/expanded/unstable-features_concurrent.rs +++ b/crates/component-macro/tests/expanded/unstable-features_concurrent.rs @@ -201,8 +201,6 @@ pub trait TheWorldImportsWithStore: wasmtime::component::HasData + HostBazWithSt pub trait TheWorldImports: HostBaz + Send {} impl<_T: TheWorldImports + ?Sized + Send> TheWorldImports for &mut _T {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -353,7 +351,7 @@ pub mod foo { #[allow(clippy::all)] pub mod the_interface { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; /// Link-time configurations. #[derive(Clone, Debug, Default)] pub struct LinkOptions { diff --git a/crates/component-macro/tests/expanded/unstable-features_tracing_async.rs b/crates/component-macro/tests/expanded/unstable-features_tracing_async.rs index 4b651cdcdcca..49bcca5e20a7 100644 --- a/crates/component-macro/tests/expanded/unstable-features_tracing_async.rs +++ b/crates/component-macro/tests/expanded/unstable-features_tracing_async.rs @@ -222,8 +222,6 @@ impl<_T: TheWorldImports + ?Sized + Send> TheWorldImports for &mut _T { } } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl TheWorldIndices { /// Creates a new copy of `TheWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -402,7 +400,7 @@ pub mod foo { #[allow(clippy::all)] pub mod the_interface { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; /// Link-time configurations. #[derive(Clone, Debug, Default)] pub struct LinkOptions { diff --git a/crates/component-macro/tests/expanded/unversioned-foo.rs b/crates/component-macro/tests/expanded/unversioned-foo.rs index c95d2985a2b4..f0cd89271b8f 100644 --- a/crates/component-macro/tests/expanded/unversioned-foo.rs +++ b/crates/component-macro/tests/expanded/unversioned-foo.rs @@ -99,8 +99,6 @@ pub struct NopeIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Nope {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl NopeIndices { /// Creates a new copy of `NopeIndices` bindings which can then /// be used to instantiate into a particular store. @@ -181,7 +179,7 @@ pub mod foo { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] diff --git a/crates/component-macro/tests/expanded/unversioned-foo_async.rs b/crates/component-macro/tests/expanded/unversioned-foo_async.rs index 38aea6b99e9e..b3cde77ae0f3 100644 --- a/crates/component-macro/tests/expanded/unversioned-foo_async.rs +++ b/crates/component-macro/tests/expanded/unversioned-foo_async.rs @@ -99,8 +99,6 @@ pub struct NopeIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Nope {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl NopeIndices { /// Creates a new copy of `NopeIndices` bindings which can then /// be used to instantiate into a particular store. @@ -181,7 +179,7 @@ pub mod foo { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] diff --git a/crates/component-macro/tests/expanded/unversioned-foo_concurrent.rs b/crates/component-macro/tests/expanded/unversioned-foo_concurrent.rs index ffa5ca4fe304..1ec481afba6b 100644 --- a/crates/component-macro/tests/expanded/unversioned-foo_concurrent.rs +++ b/crates/component-macro/tests/expanded/unversioned-foo_concurrent.rs @@ -99,8 +99,6 @@ pub struct NopeIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Nope {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl NopeIndices { /// Creates a new copy of `NopeIndices` bindings which can then /// be used to instantiate into a particular store. @@ -181,7 +179,7 @@ pub mod foo { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] diff --git a/crates/component-macro/tests/expanded/unversioned-foo_tracing_async.rs b/crates/component-macro/tests/expanded/unversioned-foo_tracing_async.rs index d64a48942bec..3e8ebdac04ae 100644 --- a/crates/component-macro/tests/expanded/unversioned-foo_tracing_async.rs +++ b/crates/component-macro/tests/expanded/unversioned-foo_tracing_async.rs @@ -99,8 +99,6 @@ pub struct NopeIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct Nope {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl NopeIndices { /// Creates a new copy of `NopeIndices` bindings which can then /// be used to instantiate into a particular store. @@ -181,7 +179,7 @@ pub mod foo { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] diff --git a/crates/component-macro/tests/expanded/use-paths.rs b/crates/component-macro/tests/expanded/use-paths.rs index f4d305680605..d82f4e696dd1 100644 --- a/crates/component-macro/tests/expanded/use-paths.rs +++ b/crates/component-macro/tests/expanded/use-paths.rs @@ -99,8 +99,6 @@ pub struct DIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct D {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl DIndices { /// Creates a new copy of `DIndices` bindings which can then /// be used to instantiate into a particular store. @@ -187,7 +185,7 @@ pub mod foo { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -240,7 +238,7 @@ pub mod foo { #[allow(clippy::all)] pub mod b { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Foo = super::super::super::foo::foo::a::Foo; const _: () = { assert!(0 == < Foo as wasmtime::component::ComponentType >::SIZE32); @@ -283,7 +281,7 @@ pub mod foo { #[allow(clippy::all)] pub mod c { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Foo = super::super::super::foo::foo::b::Foo; const _: () = { assert!(0 == < Foo as wasmtime::component::ComponentType >::SIZE32); @@ -328,7 +326,7 @@ pub mod foo { #[allow(clippy::all)] pub mod d { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Foo = super::foo::foo::c::Foo; const _: () = { assert!(0 == < Foo as wasmtime::component::ComponentType >::SIZE32); diff --git a/crates/component-macro/tests/expanded/use-paths_async.rs b/crates/component-macro/tests/expanded/use-paths_async.rs index 83a377cfcb44..aaeed11d0035 100644 --- a/crates/component-macro/tests/expanded/use-paths_async.rs +++ b/crates/component-macro/tests/expanded/use-paths_async.rs @@ -99,8 +99,6 @@ pub struct DIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct D {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl DIndices { /// Creates a new copy of `DIndices` bindings which can then /// be used to instantiate into a particular store. @@ -188,7 +186,7 @@ pub mod foo { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -243,7 +241,7 @@ pub mod foo { #[allow(clippy::all)] pub mod b { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Foo = super::super::super::foo::foo::a::Foo; const _: () = { assert!(0 == < Foo as wasmtime::component::ComponentType >::SIZE32); @@ -288,7 +286,7 @@ pub mod foo { #[allow(clippy::all)] pub mod c { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Foo = super::super::super::foo::foo::b::Foo; const _: () = { assert!(0 == < Foo as wasmtime::component::ComponentType >::SIZE32); @@ -335,7 +333,7 @@ pub mod foo { #[allow(clippy::all)] pub mod d { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Foo = super::foo::foo::c::Foo; const _: () = { assert!(0 == < Foo as wasmtime::component::ComponentType >::SIZE32); diff --git a/crates/component-macro/tests/expanded/use-paths_concurrent.rs b/crates/component-macro/tests/expanded/use-paths_concurrent.rs index 5100a338b6af..a275a676c154 100644 --- a/crates/component-macro/tests/expanded/use-paths_concurrent.rs +++ b/crates/component-macro/tests/expanded/use-paths_concurrent.rs @@ -99,8 +99,6 @@ pub struct DIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct D {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl DIndices { /// Creates a new copy of `DIndices` bindings which can then /// be used to instantiate into a particular store. @@ -188,7 +186,7 @@ pub mod foo { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -237,7 +235,7 @@ pub mod foo { #[allow(clippy::all)] pub mod b { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Foo = super::super::super::foo::foo::a::Foo; const _: () = { assert!(0 == < Foo as wasmtime::component::ComponentType >::SIZE32); @@ -276,7 +274,7 @@ pub mod foo { #[allow(clippy::all)] pub mod c { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Foo = super::super::super::foo::foo::b::Foo; const _: () = { assert!(0 == < Foo as wasmtime::component::ComponentType >::SIZE32); @@ -317,7 +315,7 @@ pub mod foo { #[allow(clippy::all)] pub mod d { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Foo = super::foo::foo::c::Foo; const _: () = { assert!(0 == < Foo as wasmtime::component::ComponentType >::SIZE32); diff --git a/crates/component-macro/tests/expanded/use-paths_tracing_async.rs b/crates/component-macro/tests/expanded/use-paths_tracing_async.rs index bb5596886e8e..0a1b3de7e333 100644 --- a/crates/component-macro/tests/expanded/use-paths_tracing_async.rs +++ b/crates/component-macro/tests/expanded/use-paths_tracing_async.rs @@ -99,8 +99,6 @@ pub struct DIndices {} /// [`Linker`]: wasmtime::component::Linker pub struct D {} const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl DIndices { /// Creates a new copy of `DIndices` bindings which can then /// be used to instantiate into a particular store. @@ -188,7 +186,7 @@ pub mod foo { #[allow(clippy::all)] pub mod a { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -256,7 +254,7 @@ pub mod foo { #[allow(clippy::all)] pub mod b { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Foo = super::super::super::foo::foo::a::Foo; const _: () = { assert!(0 == < Foo as wasmtime::component::ComponentType >::SIZE32); @@ -314,7 +312,7 @@ pub mod foo { #[allow(clippy::all)] pub mod c { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Foo = super::super::super::foo::foo::b::Foo; const _: () = { assert!(0 == < Foo as wasmtime::component::ComponentType >::SIZE32); @@ -374,7 +372,7 @@ pub mod foo { #[allow(clippy::all)] pub mod d { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type Foo = super::foo::foo::c::Foo; const _: () = { assert!(0 == < Foo as wasmtime::component::ComponentType >::SIZE32); diff --git a/crates/component-macro/tests/expanded/variants.rs b/crates/component-macro/tests/expanded/variants.rs index 80895a174627..07372a6f2f27 100644 --- a/crates/component-macro/tests/expanded/variants.rs +++ b/crates/component-macro/tests/expanded/variants.rs @@ -103,8 +103,6 @@ pub struct MyWorld { interface0: exports::foo::foo::variants::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl MyWorldIndices { /// Creates a new copy of `MyWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod variants { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -900,7 +898,7 @@ pub mod exports { #[allow(clippy::all)] pub mod variants { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -1305,7 +1303,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/variants") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/variants`" ) })?; @@ -1314,7 +1312,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/variants` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/variants_async.rs b/crates/component-macro/tests/expanded/variants_async.rs index c4e4958b8082..3df7ad69d3a6 100644 --- a/crates/component-macro/tests/expanded/variants_async.rs +++ b/crates/component-macro/tests/expanded/variants_async.rs @@ -103,8 +103,6 @@ pub struct MyWorld { interface0: exports::foo::foo::variants::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl MyWorldIndices { /// Creates a new copy of `MyWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod variants { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -1031,7 +1029,7 @@ pub mod exports { #[allow(clippy::all)] pub mod variants { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -1436,7 +1434,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/variants") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/variants`" ) })?; @@ -1445,7 +1443,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/variants` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/variants_concurrent.rs b/crates/component-macro/tests/expanded/variants_concurrent.rs index 38f483c9e00e..3c66ccd698de 100644 --- a/crates/component-macro/tests/expanded/variants_concurrent.rs +++ b/crates/component-macro/tests/expanded/variants_concurrent.rs @@ -103,8 +103,6 @@ pub struct MyWorld { interface0: exports::foo::foo::variants::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl MyWorldIndices { /// Creates a new copy of `MyWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod variants { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -885,7 +883,7 @@ pub mod exports { #[allow(clippy::all)] pub mod variants { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -1290,7 +1288,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/variants") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/variants`" ) })?; @@ -1299,7 +1297,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/variants` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/variants_tracing_async.rs b/crates/component-macro/tests/expanded/variants_tracing_async.rs index 32677bd123a1..b612348f4070 100644 --- a/crates/component-macro/tests/expanded/variants_tracing_async.rs +++ b/crates/component-macro/tests/expanded/variants_tracing_async.rs @@ -103,8 +103,6 @@ pub struct MyWorld { interface0: exports::foo::foo::variants::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl MyWorldIndices { /// Creates a new copy of `MyWorldIndices` bindings which can then /// be used to instantiate into a particular store. @@ -192,7 +190,7 @@ pub mod foo { #[allow(clippy::all)] pub mod variants { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -1329,7 +1327,7 @@ pub mod exports { #[allow(clippy::all)] pub mod variants { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; #[derive(wasmtime::component::ComponentType)] #[derive(wasmtime::component::Lift)] #[derive(wasmtime::component::Lower)] @@ -1734,7 +1732,7 @@ pub mod exports { .component() .get_export_index(None, "foo:foo/variants") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `foo:foo/variants`" ) })?; @@ -1743,7 +1741,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `foo:foo/variants` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/wat.rs b/crates/component-macro/tests/expanded/wat.rs index 007df70962f5..97efef24e6b6 100644 --- a/crates/component-macro/tests/expanded/wat.rs +++ b/crates/component-macro/tests/expanded/wat.rs @@ -103,8 +103,6 @@ pub struct Example { interface0: exports::same::name::this_name_is_duplicated::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl ExampleIndices { /// Creates a new copy of `ExampleIndices` bindings which can then /// be used to instantiate into a particular store. @@ -183,7 +181,7 @@ pub mod exports { #[allow(clippy::all)] pub mod this_name_is_duplicated { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type ThisNameIsDuplicated = wasmtime::component::ResourceAny; pub struct GuestThisNameIsDuplicated<'a> { funcs: &'a Guest, @@ -206,7 +204,7 @@ pub mod exports { .component() .get_export_index(None, "same:name/this-name-is-duplicated") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `same:name/this-name-is-duplicated`" ) })?; @@ -215,7 +213,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `same:name/this-name-is-duplicated` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/wat_async.rs b/crates/component-macro/tests/expanded/wat_async.rs index 007df70962f5..97efef24e6b6 100644 --- a/crates/component-macro/tests/expanded/wat_async.rs +++ b/crates/component-macro/tests/expanded/wat_async.rs @@ -103,8 +103,6 @@ pub struct Example { interface0: exports::same::name::this_name_is_duplicated::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl ExampleIndices { /// Creates a new copy of `ExampleIndices` bindings which can then /// be used to instantiate into a particular store. @@ -183,7 +181,7 @@ pub mod exports { #[allow(clippy::all)] pub mod this_name_is_duplicated { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type ThisNameIsDuplicated = wasmtime::component::ResourceAny; pub struct GuestThisNameIsDuplicated<'a> { funcs: &'a Guest, @@ -206,7 +204,7 @@ pub mod exports { .component() .get_export_index(None, "same:name/this-name-is-duplicated") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `same:name/this-name-is-duplicated`" ) })?; @@ -215,7 +213,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `same:name/this-name-is-duplicated` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/wat_concurrent.rs b/crates/component-macro/tests/expanded/wat_concurrent.rs index 007df70962f5..97efef24e6b6 100644 --- a/crates/component-macro/tests/expanded/wat_concurrent.rs +++ b/crates/component-macro/tests/expanded/wat_concurrent.rs @@ -103,8 +103,6 @@ pub struct Example { interface0: exports::same::name::this_name_is_duplicated::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl ExampleIndices { /// Creates a new copy of `ExampleIndices` bindings which can then /// be used to instantiate into a particular store. @@ -183,7 +181,7 @@ pub mod exports { #[allow(clippy::all)] pub mod this_name_is_duplicated { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type ThisNameIsDuplicated = wasmtime::component::ResourceAny; pub struct GuestThisNameIsDuplicated<'a> { funcs: &'a Guest, @@ -206,7 +204,7 @@ pub mod exports { .component() .get_export_index(None, "same:name/this-name-is-duplicated") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `same:name/this-name-is-duplicated`" ) })?; @@ -215,7 +213,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `same:name/this-name-is-duplicated` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/wat_tracing_async.rs b/crates/component-macro/tests/expanded/wat_tracing_async.rs index 007df70962f5..97efef24e6b6 100644 --- a/crates/component-macro/tests/expanded/wat_tracing_async.rs +++ b/crates/component-macro/tests/expanded/wat_tracing_async.rs @@ -103,8 +103,6 @@ pub struct Example { interface0: exports::same::name::this_name_is_duplicated::Guest, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl ExampleIndices { /// Creates a new copy of `ExampleIndices` bindings which can then /// be used to instantiate into a particular store. @@ -183,7 +181,7 @@ pub mod exports { #[allow(clippy::all)] pub mod this_name_is_duplicated { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type ThisNameIsDuplicated = wasmtime::component::ResourceAny; pub struct GuestThisNameIsDuplicated<'a> { funcs: &'a Guest, @@ -206,7 +204,7 @@ pub mod exports { .component() .get_export_index(None, "same:name/this-name-is-duplicated") .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "no exported instance named `same:name/this-name-is-duplicated`" ) })?; @@ -215,7 +213,7 @@ pub mod exports { .component() .get_export_index(Some(&instance), name) .ok_or_else(|| { - anyhow::anyhow!( + wasmtime::error::format_err!( "instance export `same:name/this-name-is-duplicated` does \ not have export `{name}`" ) diff --git a/crates/component-macro/tests/expanded/worlds-with-types.rs b/crates/component-macro/tests/expanded/worlds-with-types.rs index 02825fcbfe8e..a77919dbe2a9 100644 --- a/crates/component-macro/tests/expanded/worlds-with-types.rs +++ b/crates/component-macro/tests/expanded/worlds-with-types.rs @@ -128,8 +128,6 @@ pub struct Foo { f: wasmtime::component::Func, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl FooIndices { /// Creates a new copy of `FooIndices` bindings which can then /// be used to instantiate into a particular store. @@ -144,16 +142,20 @@ const _: () = { let f = { let (item, index) = _component .get_export(None, "f") - .ok_or_else(|| anyhow::anyhow!("no export `f` found"))?; + .ok_or_else(|| wasmtime::error::format_err!("no export `f` found"))?; match item { wasmtime::component::types::ComponentItem::ComponentFunc(func) => { - anyhow::Context::context( + wasmtime::error::Context::context( func.typecheck::<(), ((T, U, R),)>(&_instance_type), "type-checking export func `f`", )?; index } - _ => Err(anyhow::anyhow!("export `f` is not a function"))?, + _ => { + Err( + wasmtime::error::format_err!("export `f` is not a function"), + )? + } } }; Ok(FooIndices { f }) @@ -239,7 +241,7 @@ pub mod foo { #[allow(clippy::all)] pub mod i { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type T = u16; const _: () = { assert!(2 == < T as wasmtime::component::ComponentType >::SIZE32); diff --git a/crates/component-macro/tests/expanded/worlds-with-types_async.rs b/crates/component-macro/tests/expanded/worlds-with-types_async.rs index b0a89166314c..bf33eb51e189 100644 --- a/crates/component-macro/tests/expanded/worlds-with-types_async.rs +++ b/crates/component-macro/tests/expanded/worlds-with-types_async.rs @@ -128,8 +128,6 @@ pub struct Foo { f: wasmtime::component::Func, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl FooIndices { /// Creates a new copy of `FooIndices` bindings which can then /// be used to instantiate into a particular store. @@ -144,16 +142,20 @@ const _: () = { let f = { let (item, index) = _component .get_export(None, "f") - .ok_or_else(|| anyhow::anyhow!("no export `f` found"))?; + .ok_or_else(|| wasmtime::error::format_err!("no export `f` found"))?; match item { wasmtime::component::types::ComponentItem::ComponentFunc(func) => { - anyhow::Context::context( + wasmtime::error::Context::context( func.typecheck::<(), ((T, U, R),)>(&_instance_type), "type-checking export func `f`", )?; index } - _ => Err(anyhow::anyhow!("export `f` is not a function"))?, + _ => { + Err( + wasmtime::error::format_err!("export `f` is not a function"), + )? + } } }; Ok(FooIndices { f }) @@ -242,7 +244,7 @@ pub mod foo { #[allow(clippy::all)] pub mod i { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type T = u16; const _: () = { assert!(2 == < T as wasmtime::component::ComponentType >::SIZE32); diff --git a/crates/component-macro/tests/expanded/worlds-with-types_concurrent.rs b/crates/component-macro/tests/expanded/worlds-with-types_concurrent.rs index 29615ead4218..8726f94fc7c5 100644 --- a/crates/component-macro/tests/expanded/worlds-with-types_concurrent.rs +++ b/crates/component-macro/tests/expanded/worlds-with-types_concurrent.rs @@ -128,8 +128,6 @@ pub struct Foo { f: wasmtime::component::Func, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl FooIndices { /// Creates a new copy of `FooIndices` bindings which can then /// be used to instantiate into a particular store. @@ -144,16 +142,20 @@ const _: () = { let f = { let (item, index) = _component .get_export(None, "f") - .ok_or_else(|| anyhow::anyhow!("no export `f` found"))?; + .ok_or_else(|| wasmtime::error::format_err!("no export `f` found"))?; match item { wasmtime::component::types::ComponentItem::ComponentFunc(func) => { - anyhow::Context::context( + wasmtime::error::Context::context( func.typecheck::<(), ((T, U, R),)>(&_instance_type), "type-checking export func `f`", )?; index } - _ => Err(anyhow::anyhow!("export `f` is not a function"))?, + _ => { + Err( + wasmtime::error::format_err!("export `f` is not a function"), + )? + } } }; Ok(FooIndices { f }) @@ -242,7 +244,7 @@ pub mod foo { #[allow(clippy::all)] pub mod i { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type T = u16; const _: () = { assert!(2 == < T as wasmtime::component::ComponentType >::SIZE32); diff --git a/crates/component-macro/tests/expanded/worlds-with-types_tracing_async.rs b/crates/component-macro/tests/expanded/worlds-with-types_tracing_async.rs index 074dd6c1d63d..14a8faf37bbc 100644 --- a/crates/component-macro/tests/expanded/worlds-with-types_tracing_async.rs +++ b/crates/component-macro/tests/expanded/worlds-with-types_tracing_async.rs @@ -128,8 +128,6 @@ pub struct Foo { f: wasmtime::component::Func, } const _: () = { - #[allow(unused_imports)] - use wasmtime::component::__internal::anyhow; impl FooIndices { /// Creates a new copy of `FooIndices` bindings which can then /// be used to instantiate into a particular store. @@ -144,16 +142,20 @@ const _: () = { let f = { let (item, index) = _component .get_export(None, "f") - .ok_or_else(|| anyhow::anyhow!("no export `f` found"))?; + .ok_or_else(|| wasmtime::error::format_err!("no export `f` found"))?; match item { wasmtime::component::types::ComponentItem::ComponentFunc(func) => { - anyhow::Context::context( + wasmtime::error::Context::context( func.typecheck::<(), ((T, U, R),)>(&_instance_type), "type-checking export func `f`", )?; index } - _ => Err(anyhow::anyhow!("export `f` is not a function"))?, + _ => { + Err( + wasmtime::error::format_err!("export `f` is not a function"), + )? + } } }; Ok(FooIndices { f }) @@ -250,7 +252,7 @@ pub mod foo { #[allow(clippy::all)] pub mod i { #[allow(unused_imports)] - use wasmtime::component::__internal::{anyhow, Box}; + use wasmtime::component::__internal::Box; pub type T = u16; const _: () = { assert!(2 == < T as wasmtime::component::ComponentType >::SIZE32); diff --git a/crates/wasmtime/Cargo.toml b/crates/wasmtime/Cargo.toml index 87636c934328..7657e1c57a64 100644 --- a/crates/wasmtime/Cargo.toml +++ b/crates/wasmtime/Cargo.toml @@ -38,7 +38,6 @@ wasm-encoder = { workspace = true, optional = true } wasm-wave = { workspace = true, optional = true } wasm-compose = { workspace = true, optional = true } tempfile = { workspace = true, optional = true } -anyhow = { workspace = true } libc = { workspace = true } cfg-if = { workspace = true } log = { workspace = true } diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rs index 49e4b537c91a..d4b4485d9de1 100644 --- a/crates/wasmtime/src/config.rs +++ b/crates/wasmtime/src/config.rs @@ -362,7 +362,7 @@ impl Config { /// This method will error if the given target triple is not supported. pub fn target(&mut self, target: &str) -> Result<&mut Self> { self.target = - Some(target_lexicon::Triple::from_str(target).map_err(|e| anyhow::anyhow!(e))?); + Some(target_lexicon::Triple::from_str(target).map_err(|e| crate::format_err!(e))?); Ok(self) } @@ -543,9 +543,9 @@ impl Config { /// suitable in concurrent environments since one thread capturing a /// backtrace won't block other threads. /// - /// Collected backtraces are attached via [`anyhow::Error::context`] to + /// Collected backtraces are attached via [`wasmtime::Error::context`] to /// errors returned from host functions. The [`WasmBacktrace`] type can be - /// acquired via [`anyhow::Error::downcast_ref`] to inspect the backtrace. + /// acquired via [`wasmtime::Error::downcast_ref`] to inspect the backtrace. /// When this option is disabled then this context is never applied to /// errors coming out of wasm. /// @@ -2127,7 +2127,7 @@ impl Config { } /// Configures whether or not a coredump should be generated and attached to - /// the anyhow::Error when a trap is raised. + /// the [`wasmtime::Error`] when a trap is raised. /// /// This option is disabled by default. #[cfg(feature = "coredump")] diff --git a/crates/wasmtime/src/engine.rs b/crates/wasmtime/src/engine.rs index 6fcfe6395702..a2092dabf9be 100644 --- a/crates/wasmtime/src/engine.rs +++ b/crates/wasmtime/src/engine.rs @@ -302,7 +302,7 @@ impl Engine { .compatible_with_native_host .get_or_init(|| self._check_compatible_with_native_host()) .clone() - .map_err(anyhow::Error::msg) + .map_err(crate::Error::msg) } fn _check_compatible_with_native_host(&self) -> Result<(), String> { diff --git a/crates/wasmtime/src/engine/serialization.rs b/crates/wasmtime/src/engine/serialization.rs index ba1b1a7813c1..8d5d4cd9ac8e 100644 --- a/crates/wasmtime/src/engine/serialization.rs +++ b/crates/wasmtime/src/engine/serialization.rs @@ -225,7 +225,7 @@ impl Metadata<'_> { for (name, val) in self.shared_flags.iter() { engine .check_compatible_with_shared_flag(name, val) - .map_err(|s| anyhow::Error::msg(s)) + .map_err(|s| crate::Error::msg(s)) .context("compilation settings of module incompatible with native host")?; } Ok(()) @@ -235,7 +235,7 @@ impl Metadata<'_> { for (name, val) in self.isa_flags.iter() { engine .check_compatible_with_isa_flag(name, val) - .map_err(|s| anyhow::Error::msg(s)) + .map_err(|s| crate::Error::msg(s)) .context("compilation settings of module incompatible with native host")?; } Ok(()) diff --git a/crates/wasmtime/src/lib.rs b/crates/wasmtime/src/lib.rs index e8245220b04d..f5bf0f8b1e10 100644 --- a/crates/wasmtime/src/lib.rs +++ b/crates/wasmtime/src/lib.rs @@ -310,8 +310,7 @@ extern crate std; extern crate alloc; pub(crate) mod prelude { - pub use crate::{Error, Result}; - pub use anyhow::{Context, anyhow, bail, ensure, format_err}; + pub use crate::error::{Context, Error, Result, anyhow, bail, ensure, format_err}; pub use wasmtime_environ::prelude::*; } @@ -409,14 +408,10 @@ mod sync_nostd; #[cfg(not(feature = "std"))] use sync_nostd as sync; -/// A convenience wrapper for `Result`. -/// -/// This type can be used to interact with `wasmtimes`'s extensive use -/// of `anyhow::Error` while still not directly depending on `anyhow`. -/// -/// This type alias is identical to `anyhow::Result`. -#[doc(no_inline)] -pub use anyhow::{Error, Result}; +#[doc(inline)] +pub use wasmtime_environ::error; + +pub use self::error::{Error, Result, bail, ensure, format_err}; /// A re-exported instance of Wasmtime's `wasmparser` dependency. /// diff --git a/crates/wasmtime/src/runtime/code.rs b/crates/wasmtime/src/runtime/code.rs index 203b5128cf33..38f8a422da24 100644 --- a/crates/wasmtime/src/runtime/code.rs +++ b/crates/wasmtime/src/runtime/code.rs @@ -1,12 +1,12 @@ use crate::Engine; use crate::Module; +use crate::Result; use crate::module::ModuleRegistry; use crate::vm::ModuleMemoryImageSource; use crate::{code_memory::CodeMemory, type_registry::TypeCollection}; #[cfg(feature = "debug")] use alloc::boxed::Box; use alloc::sync::Arc; -use anyhow::Result; use core::ops::{Add, Range, Sub}; use wasmtime_environ::DefinedFuncIndex; use wasmtime_environ::ModuleTypes; diff --git a/crates/wasmtime/src/runtime/code_memory.rs b/crates/wasmtime/src/runtime/code_memory.rs index 622a9bc6cee7..bfb24a68e387 100644 --- a/crates/wasmtime/src/runtime/code_memory.rs +++ b/crates/wasmtime/src/runtime/code_memory.rs @@ -95,7 +95,7 @@ pub trait CustomCodeMemory: Send + Sync { /// /// `ptr` and `ptr.offset(len)` are guaranteed to be aligned as /// per `required_alignment()`. - fn publish_executable(&self, ptr: *const u8, len: usize) -> anyhow::Result<()>; + fn publish_executable(&self, ptr: *const u8, len: usize) -> crate::Result<()>; /// Unpublish a region of memory. /// @@ -106,7 +106,7 @@ pub trait CustomCodeMemory: Send + Sync { /// /// `ptr` and `ptr.offset(len)` are guaranteed to be aligned as /// per `required_alignment()`. - fn unpublish_executable(&self, ptr: *const u8, len: usize) -> anyhow::Result<()>; + fn unpublish_executable(&self, ptr: *const u8, len: usize) -> crate::Result<()>; } impl CodeMemory { diff --git a/crates/wasmtime/src/runtime/component/component.rs b/crates/wasmtime/src/runtime/component/component.rs index c4d581272363..d53889a3d009 100644 --- a/crates/wasmtime/src/runtime/component/component.rs +++ b/crates/wasmtime/src/runtime/component/component.rs @@ -141,7 +141,7 @@ impl Component { /// ```no_run /// # use wasmtime::*; /// # use wasmtime::component::Component; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// # let wasm_bytes: Vec = Vec::new(); /// let component = Component::new(&engine, &wasm_bytes)?; @@ -155,7 +155,7 @@ impl Component { /// ``` /// # use wasmtime::*; /// # use wasmtime::component::Component; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// let component = Component::new(&engine, "(component (core module))")?; /// # Ok(()) diff --git a/crates/wasmtime/src/runtime/component/concurrent.rs b/crates/wasmtime/src/runtime/component/concurrent.rs index bd1a8b6f74dd..552831da06af 100644 --- a/crates/wasmtime/src/runtime/component/concurrent.rs +++ b/crates/wasmtime/src/runtime/component/concurrent.rs @@ -55,6 +55,7 @@ use crate::component::store::StoreComponentInstanceId; use crate::component::{ ComponentInstanceId, HasData, HasSelf, Instance, Resource, ResourceTable, ResourceTableError, }; +use crate::error::{Context as _, Result, anyhow, bail}; use crate::fiber::{self, StoreFiber, StoreFiberYield}; use crate::store::{Store, StoreId, StoreInner, StoreOpaque, StoreToken}; use crate::vm::component::{ @@ -62,7 +63,6 @@ use crate::vm::component::{ }; use crate::vm::{AlwaysMut, SendSyncPtr, VMFuncRef, VMMemoryDefinition, VMStore}; use crate::{AsContext, AsContextMut, FuncType, StoreContext, StoreContextMut, ValRaw, ValType}; -use anyhow::{Context as _, Result, anyhow, bail}; use error_contexts::GlobalErrorContextRefCount; use futures::channel::oneshot; use futures::future::{self, Either, FutureExt}; @@ -1028,8 +1028,8 @@ impl StoreContextMut<'_, T> { /// /// ``` /// # use { - /// # anyhow::{Result}, /// # wasmtime::{ + /// # error::{Result}, /// # component::{ Component, Linker, Resource, ResourceTable}, /// # Config, Engine, Store /// # }, @@ -5199,7 +5199,7 @@ pub(crate) fn queue_call( rx.map(move |result| { result .map(|v| (*v.downcast().unwrap(), exit_rx)) - .map_err(anyhow::Error::from) + .map_err(crate::Error::from) }), )) } diff --git a/crates/wasmtime/src/runtime/component/concurrent/future_stream_any.rs b/crates/wasmtime/src/runtime/component/concurrent/future_stream_any.rs index f29193bbe82d..1b3816c39fcd 100644 --- a/crates/wasmtime/src/runtime/component/concurrent/future_stream_any.rs +++ b/crates/wasmtime/src/runtime/component/concurrent/future_stream_any.rs @@ -9,8 +9,8 @@ use crate::component::types::{self, FutureType, StreamType}; use crate::component::{ ComponentInstanceId, ComponentType, FutureReader, Lift, Lower, StreamReader, }; +use crate::error::{Context, Result, bail}; use crate::store::StoreOpaque; -use anyhow::{Context, Result, bail}; use std::any::TypeId; use std::mem::MaybeUninit; use wasmtime_environ::component::{ diff --git a/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs b/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs index 9f59bb89927b..93a02058b7da 100644 --- a/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs +++ b/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs @@ -9,11 +9,11 @@ use crate::component::{ AsAccessor, ComponentInstanceId, ComponentType, FutureAny, Instance, Lift, Lower, StreamAny, Val, WasmList, }; +use crate::error::{Context as _, Error, Result, anyhow, bail}; use crate::store::{StoreOpaque, StoreToken}; use crate::vm::component::{ComponentInstance, HandleTable, TransmitLocalState}; use crate::vm::{AlwaysMut, VMStore}; use crate::{AsContextMut, StoreContextMut, ValRaw}; -use anyhow::{Context as _, Error, Result, anyhow, bail}; use buffers::{Extender, SliceBuffer, UntypedWriteBuffer}; use core::fmt; use core::future; @@ -160,7 +160,7 @@ fn lower, U: 'static>( .as_slice_mut() .get_mut(address..) .and_then(|b| b.get_mut(..T::SIZE32 * count)) - .ok_or_else(|| anyhow::anyhow!("read pointer out of bounds of memory"))?; + .ok_or_else(|| crate::format_err!("read pointer out of bounds of memory"))?; if let Some(ty) = payload(ty, lower.types) { T::linear_store_list_to_memory(lower, ty, address, &buffer.remaining()[..count])?; @@ -194,7 +194,7 @@ fn lift>( lift.memory() .get(address..) .and_then(|b| b.get(..T::SIZE32 * count)) - .ok_or_else(|| anyhow::anyhow!("write pointer out of bounds of memory"))?; + .ok_or_else(|| crate::format_err!("write pointer out of bounds of memory"))?; let list = &WasmList::new(address, count, lift, ty)?; T::linear_lift_into_from_memory(lift, list, &mut Extender(buffer))? @@ -2715,7 +2715,7 @@ impl StoreContextMut<'_, T> { let future = async move { loop { if tls::get(|store| { - anyhow::Ok(matches!( + crate::error::Ok(matches!( store.concurrent_state_mut().get_mut(id)?.read, ReadState::Dropped )) @@ -2763,7 +2763,7 @@ async fn write) -> anyhow::Result<()> { + /// # fn foo(func: &Func, store: &mut Store<()>) -> wasmtime::Result<()> { /// let typed = func.typed::<(), ()>(&store)?; /// typed.call(store, ())?; /// # Ok(()) @@ -116,7 +115,7 @@ impl Func { /// ``` /// # use wasmtime::component::Func; /// # use wasmtime::Store; - /// # fn foo(func: &Func, mut store: Store<()>) -> anyhow::Result<()> { + /// # fn foo(func: &Func, mut store: Store<()>) -> wasmtime::Result<()> { /// let typed = func.typed::<(&str,), (String,)>(&store)?; /// let ret = typed.call(&mut store, ("Hello, ",))?.0; /// println!("returned string was: {}", ret); @@ -129,7 +128,7 @@ impl Func { /// ``` /// # use wasmtime::component::Func; /// # use wasmtime::Store; - /// # fn foo(func: &Func, mut store: Store<()>) -> anyhow::Result<()> { + /// # fn foo(func: &Func, mut store: Store<()>) -> wasmtime::Result<()> { /// let typed = func.typed::<(u32, Option<&str>, &[u8]), (bool,)>(&store)?; /// let ok: bool = typed.call(&mut store, (1, Some("hello"), b"bytes!"))?.0; /// println!("return value was: {ok}"); @@ -881,7 +880,7 @@ impl Func { .memory() .get(ptr..) .and_then(|b| b.get(..usize::try_from(results_ty.abi.size32).unwrap())) - .ok_or_else(|| anyhow::anyhow!("pointer out of bounds of memory"))?; + .ok_or_else(|| crate::format_err!("pointer out of bounds of memory"))?; let mut offset = 0; Ok(results_ty.types.iter().map(move |ty| { diff --git a/crates/wasmtime/src/runtime/component/func/typed.rs b/crates/wasmtime/src/runtime/component/func/typed.rs index dceddd3285b5..ee3a46c187cb 100644 --- a/crates/wasmtime/src/runtime/component/func/typed.rs +++ b/crates/wasmtime/src/runtime/component/func/typed.rs @@ -543,7 +543,7 @@ where .memory() .get(ptr..) .and_then(|b| b.get(..Return::SIZE32)) - .ok_or_else(|| anyhow::anyhow!("pointer out of bounds of memory"))?; + .ok_or_else(|| crate::format_err!("pointer out of bounds of memory"))?; Return::linear_lift_from_memory(cx, ty, bytes) } diff --git a/crates/wasmtime/src/runtime/component/mod.rs b/crates/wasmtime/src/runtime/component/mod.rs index 43fb2c7ea6b3..12ab9c4313fd 100644 --- a/crates/wasmtime/src/runtime/component/mod.rs +++ b/crates/wasmtime/src/runtime/component/mod.rs @@ -161,7 +161,6 @@ pub mod __internal { pub use alloc::boxed::Box; pub use alloc::string::String; pub use alloc::vec::Vec; - pub use anyhow; pub use core::cell::RefCell; pub use core::future::Future; pub use core::mem::transmute; diff --git a/crates/wasmtime/src/runtime/component/resources/any.rs b/crates/wasmtime/src/runtime/component/resources/any.rs index 279038f3837b..343b331bcc49 100644 --- a/crates/wasmtime/src/runtime/component/resources/any.rs +++ b/crates/wasmtime/src/runtime/component/resources/any.rs @@ -101,7 +101,7 @@ impl ResourceAny { let store = store.as_context_mut(); let mut tables = HostResourceTables::new_host(store.0); let ResourceAny { idx, ty, owned } = self; - let ty = T::typecheck(ty).ok_or_else(|| anyhow::anyhow!("resource type mismatch"))?; + let ty = T::typecheck(ty).ok_or_else(|| crate::format_err!("resource type mismatch"))?; if owned { let rep = tables.host_resource_lift_own(idx)?; Ok(HostResource::new_own(rep, ty)) diff --git a/crates/wasmtime/src/runtime/component/types.rs b/crates/wasmtime/src/runtime/component/types.rs index 54434005a24d..948fc8e51f9d 100644 --- a/crates/wasmtime/src/runtime/component/types.rs +++ b/crates/wasmtime/src/runtime/component/types.rs @@ -535,7 +535,7 @@ impl Eq for Flags {} pub(crate) fn typecheck_payload( payload: Option<&InterfaceType>, types: &InstanceType<'_>, -) -> anyhow::Result<()> +) -> crate::Result<()> where T: ComponentType, { @@ -545,7 +545,7 @@ where if T::IS_RUST_UNIT_TYPE { Ok(()) } else { - anyhow::bail!("future payload types differ") + crate::bail!("future payload types differ") } } } @@ -589,7 +589,7 @@ impl FutureType { } #[cfg(feature = "component-model-async")] - pub(crate) fn equivalent_payload_host(&self) -> anyhow::Result<()> + pub(crate) fn equivalent_payload_host(&self) -> crate::Result<()> where T: ComponentType, { @@ -646,7 +646,7 @@ impl StreamType { } #[cfg(feature = "component-model-async")] - pub(crate) fn equivalent_payload_host(&self) -> anyhow::Result<()> + pub(crate) fn equivalent_payload_host(&self) -> crate::Result<()> where T: ComponentType, { @@ -924,7 +924,7 @@ impl ComponentFunc { } #[doc(hidden)] - pub fn typecheck(&self, cx: &InstanceType) -> anyhow::Result<()> + pub fn typecheck(&self, cx: &InstanceType) -> crate::Result<()> where Params: crate::component::ComponentNamedList + crate::component::Lower, Return: crate::component::ComponentNamedList + crate::component::Lift, diff --git a/crates/wasmtime/src/runtime/component/values.rs b/crates/wasmtime/src/runtime/component/values.rs index 0215ea504e25..43a4335c1280 100644 --- a/crates/wasmtime/src/runtime/component/values.rs +++ b/crates/wasmtime/src/runtime/component/values.rs @@ -1015,7 +1015,7 @@ fn lower_list( let size = items .len() .checked_mul(elt_size) - .ok_or_else(|| anyhow::anyhow!("size overflow copying a list"))?; + .ok_or_else(|| crate::format_err!("size overflow copying a list"))?; let ptr = cx.realloc(0, 0, elt_align, size)?; let mut element_ptr = ptr; for item in items { @@ -1046,7 +1046,7 @@ fn flags_to_storage(ty: &TypeFlags, flags: &[String]) -> Result> { let bit = ty .names .get_index_of(flag) - .ok_or_else(|| anyhow::anyhow!("unknown flag: `{flag}`"))?; + .ok_or_else(|| crate::format_err!("unknown flag: `{flag}`"))?; storage[bit / 32] |= 1 << (bit % 32); } Ok(storage) @@ -1055,7 +1055,7 @@ fn flags_to_storage(ty: &TypeFlags, flags: &[String]) -> Result> { fn get_enum_discriminant(ty: &TypeEnum, n: &str) -> Result { ty.names .get_index_of(n) - .ok_or_else(|| anyhow::anyhow!("enum variant name `{n}` is not valid")) + .ok_or_else(|| crate::format_err!("enum variant name `{n}` is not valid")) .map(|i| i.try_into().unwrap()) } @@ -1066,7 +1066,7 @@ fn get_variant_discriminant<'a>( let (i, _, ty) = ty .cases .get_full(name) - .ok_or_else(|| anyhow::anyhow!("unknown variant case: `{name}`"))?; + .ok_or_else(|| crate::format_err!("unknown variant case: `{name}`"))?; Ok((i.try_into().unwrap(), ty)) } diff --git a/crates/wasmtime/src/runtime/coredump.rs b/crates/wasmtime/src/runtime/coredump.rs index c62b316d9e10..38bf793f143f 100644 --- a/crates/wasmtime/src/runtime/coredump.rs +++ b/crates/wasmtime/src/runtime/coredump.rs @@ -9,9 +9,9 @@ use std::fmt; /// Representation of a core dump of a WebAssembly module /// /// When the Config::coredump_on_trap option is enabled this structure is -/// attached to the [`anyhow::Error`] returned from many Wasmtime functions that -/// execute WebAssembly such as [`Instance::new`] or [`Func::call`]. This can be -/// acquired with the [`anyhow::Error::downcast`] family of methods to +/// attached to the [`wasmtime::Error`] returned from many Wasmtime functions +/// that execute WebAssembly such as [`Instance::new`] or [`Func::call`]. This +/// can be acquired with the [`wasmtime::Error::downcast`] family of methods to /// programmatically inspect the coredump. Otherwise since it's part of the /// error returned this will get printed along with the rest of the error when /// the error is logged. diff --git a/crates/wasmtime/src/runtime/debug.rs b/crates/wasmtime/src/runtime/debug.rs index 5cc329b8ab88..3138465ae0ae 100644 --- a/crates/wasmtime/src/runtime/debug.rs +++ b/crates/wasmtime/src/runtime/debug.rs @@ -1,5 +1,6 @@ //! Debugging API. +use crate::Result; use crate::{ AnyRef, AsContext, AsContextMut, CodeMemory, ExnRef, ExternRef, Func, Instance, Module, OwnedRooted, StoreContext, StoreContextMut, Val, @@ -11,7 +12,6 @@ use crate::{ use alloc::collections::BTreeSet; use alloc::vec; use alloc::vec::Vec; -use anyhow::Result; use core::{ffi::c_void, ptr::NonNull}; #[cfg(feature = "gc")] use wasmtime_environ::FrameTable; @@ -501,8 +501,8 @@ impl<'a, T: 'static> AsContextMut for DebugFrameCursor<'a, T> { /// a debug handler attached. #[derive(Debug)] pub enum DebugEvent<'a> { - /// An `anyhow::Error` was raised by a hostcall. - HostcallError(&'a anyhow::Error), + /// A [`wasmtime::Error`] was raised by a hostcall. + HostcallError(&'a crate::Error), /// An exception is thrown and caught by Wasm. The current state /// is at the throw-point. CaughtExceptionThrown(OwnedRooted), @@ -790,7 +790,7 @@ impl<'a> Drop for BreakpointEdit<'a> { /// /// [1]: https://searchfox.org/firefox-main/rev/7496c8515212669451d7e775a00c2be07da38ca5/js/src/jit/AutoWritableJitCode.h#26-56 #[cfg(feature = "std")] -fn abort_on_republish_error(e: anyhow::Error) -> ! { +fn abort_on_republish_error(e: crate::Error) -> ! { log::error!( "Failed to re-publish executable code: {e:?}. Wasmtime cannot return through JIT code on the stack and cannot even panic; aborting the process." ); @@ -804,6 +804,6 @@ fn abort_on_republish_error(e: anyhow::Error) -> ! { /// let's panic anyway; the panic propagation through the trampolines /// will at least deterministically crash. #[cfg(not(feature = "std"))] -fn abort_on_republish_error(e: anyhow::Error) -> ! { +fn abort_on_republish_error(e: crate::Error) -> ! { panic!("Failed to re-publish executable code: {e:?}"); } diff --git a/crates/wasmtime/src/runtime/exception.rs b/crates/wasmtime/src/runtime/exception.rs index c32568e34e92..69b2cf78ea53 100644 --- a/crates/wasmtime/src/runtime/exception.rs +++ b/crates/wasmtime/src/runtime/exception.rs @@ -41,7 +41,8 @@ #[derive(Debug)] pub struct ThrownException; -/// We need to implement Error for `ThrownException` so it can be boxed up into an `anyhow::Error`. +/// We need to implement Error for `ThrownException` so it can be boxed up into +/// a `wasmtime::Error`. impl core::error::Error for ThrownException {} /// `Error` requires `Display`. diff --git a/crates/wasmtime/src/runtime/externals/global.rs b/crates/wasmtime/src/runtime/externals/global.rs index 88daa9c32610..d10c0cbecb95 100644 --- a/crates/wasmtime/src/runtime/externals/global.rs +++ b/crates/wasmtime/src/runtime/externals/global.rs @@ -63,7 +63,7 @@ impl Global { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// let engine = Engine::default(); /// let mut store = Store::new(&engine, ()); /// @@ -286,7 +286,7 @@ impl Global { } Val::ContRef(Some(_)) => { // TODO(#10248): Implement non-null global continuation reference handling - return Err(anyhow::anyhow!( + return Err(crate::format_err!( "setting non-null continuation references in globals not yet supported" )); } diff --git a/crates/wasmtime/src/runtime/externals/table.rs b/crates/wasmtime/src/runtime/externals/table.rs index 7d524184e8b5..bca5c3200d61 100644 --- a/crates/wasmtime/src/runtime/externals/table.rs +++ b/crates/wasmtime/src/runtime/externals/table.rs @@ -71,7 +71,7 @@ impl Table { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// let engine = Engine::default(); /// let mut store = Store::new(&engine, ()); /// diff --git a/crates/wasmtime/src/runtime/fiber.rs b/crates/wasmtime/src/runtime/fiber.rs index 1ab5120ef30e..3ff6381304cf 100644 --- a/crates/wasmtime/src/runtime/fiber.rs +++ b/crates/wasmtime/src/runtime/fiber.rs @@ -1,9 +1,9 @@ +use crate::error::{Result, anyhow}; use crate::prelude::*; use crate::store::{AsStoreOpaque, Executor, StoreId, StoreOpaque}; use crate::vm::mpk::{self, ProtectionMask}; use crate::vm::{AlwaysMut, AsyncWasmCallState}; use crate::{Engine, StoreContextMut}; -use anyhow::{Result, anyhow}; use core::mem; use core::ops::Range; use core::pin::Pin; diff --git a/crates/wasmtime/src/runtime/func.rs b/crates/wasmtime/src/runtime/func.rs index 5dc48488bede..ae4ec58da371 100644 --- a/crates/wasmtime/src/runtime/func.rs +++ b/crates/wasmtime/src/runtime/func.rs @@ -161,7 +161,7 @@ impl NoFunc { /// /// ``` /// # use wasmtime::*; -/// # fn main() -> anyhow::Result<()> { +/// # fn main() -> Result<()> { /// let engine = Engine::default(); /// let module = Module::new(&engine, r#"(module (func (export "foo")))"#)?; /// let mut store = Store::new(&engine, ()); @@ -192,7 +192,7 @@ impl NoFunc { /// /// ``` /// # use wasmtime::*; -/// # fn main() -> anyhow::Result<()> { +/// # fn main() -> Result<()> { /// let mut store = Store::<()>::default(); /// /// // Create a custom `Func` which can execute arbitrary code inside of the @@ -227,7 +227,7 @@ impl NoFunc { /// /// ``` /// # use wasmtime::*; -/// # fn main() -> anyhow::Result<()> { +/// # fn main() -> Result<()> { /// let mut store = Store::<()>::default(); /// /// // Here we need to define the type signature of our `Double` function and @@ -351,7 +351,7 @@ impl Func { /// # Errors /// /// The host-provided function here returns a - /// [`Result<()>`](anyhow::Result). If the function returns `Ok(())` then + /// [`Result<()>`](crate::Result). If the function returns `Ok(())` then /// that indicates that the host function completed successfully and wrote /// the result into the `&mut [Val]` argument. /// @@ -461,7 +461,7 @@ impl Func { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// // Simulate some application-specific state as well as asynchronous /// // functions to query that state. /// struct MyDatabase { @@ -642,7 +642,7 @@ impl Func { /// # Errors /// /// The closure provided here to `wrap` can optionally return a - /// [`Result`](anyhow::Result). Returning `Ok(t)` represents the host + /// [`Result`](crate::Result). Returning `Ok(t)` represents the host /// function successfully completing with the `t` result. Returning /// `Err(e)`, however, is equivalent to raising a custom wasm trap. /// Execution of WebAssembly does not resume and the stack is unwound to the @@ -660,7 +660,7 @@ impl Func { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let mut store = Store::<()>::default(); /// let add = Func::wrap(&mut store, |a: i32, b: i32| a + b); /// let module = Module::new( @@ -686,12 +686,12 @@ impl Func { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let mut store = Store::<()>::default(); /// let add = Func::wrap(&mut store, |a: i32, b: i32| { /// match a.checked_add(b) { /// Some(i) => Ok(i), - /// None => anyhow::bail!("overflow"), + /// None => bail!("overflow"), /// } /// }); /// let module = Module::new( @@ -717,7 +717,7 @@ impl Func { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let mut store = Store::<()>::default(); /// let debug = Func::wrap(&mut store, |a: i32, b: u32, c: f32, d: i64, e: u64, f: f64| { /// @@ -757,12 +757,12 @@ impl Func { /// use std::str; /// /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let mut store = Store::default(); /// let log_str = Func::wrap(&mut store, |mut caller: Caller<'_, ()>, ptr: i32, len: i32| { /// let mem = match caller.get_export("memory") { /// Some(Extern::Memory(mem)) => mem, - /// _ => anyhow::bail!("failed to find host memory"), + /// _ => bail!("failed to find host memory"), /// }; /// let data = mem.data(&caller) /// .get(ptr as u32 as usize..) @@ -770,9 +770,9 @@ impl Func { /// let string = match data { /// Some(data) => match str::from_utf8(data) { /// Ok(s) => s, - /// Err(_) => anyhow::bail!("invalid utf-8"), + /// Err(_) => bail!("invalid utf-8"), /// }, - /// None => anyhow::bail!("pointer/length out of bounds"), + /// None => bail!("pointer/length out of bounds"), /// }; /// assert_eq!(string, "Hello, world!"); /// println!("{}", string); @@ -924,7 +924,7 @@ impl Func { /// # Errors /// /// Any error which occurs throughout the execution of the function will be - /// returned as `Err(e)`. The [`Error`](anyhow::Error) type can be inspected + /// returned as `Err(e)`. The [`Error`](crate::Error) type can be inspected /// for the precise error cause such as: /// /// * [`Trap`] - indicates that a wasm trap happened and execution was @@ -1407,7 +1407,7 @@ impl Func { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// let engine = Engine::default(); /// let mut store = Store::new(&engine, ()); /// let module = Module::new(&engine, r#"(module (func (export "foo")))"#)?; @@ -1429,7 +1429,7 @@ impl Func { /// /// ``` /// # use wasmtime::*; - /// # fn foo(add: &Func, mut store: Store<()>) -> anyhow::Result<()> { + /// # fn foo(add: &Func, mut store: Store<()>) -> Result<()> { /// let typed = add.typed::<(i32, i64), f32>(&store)?; /// assert_eq!(typed.call(&mut store, (1, 2))?, 3.0); /// # Ok(()) @@ -1440,7 +1440,7 @@ impl Func { /// /// ``` /// # use wasmtime::*; - /// # fn foo(add_with_overflow: &Func, mut store: Store<()>) -> anyhow::Result<()> { + /// # fn foo(add_with_overflow: &Func, mut store: Store<()>) -> Result<()> { /// let typed = add_with_overflow.typed::<(u32, u32), (u32, i32)>(&store)?; /// let (result, overflow) = typed.call(&mut store, (u32::max_value(), 2))?; /// assert_eq!(result, 1); @@ -2119,7 +2119,7 @@ impl Caller<'_, T> { /// use std::str; /// /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let mut store = Store::default(); /// /// let module = Module::new( @@ -2137,13 +2137,13 @@ impl Caller<'_, T> { /// )?; /// /// let Some(module_export) = module.get_export_index("memory") else { - /// anyhow::bail!("failed to find `memory` export in module"); + /// bail!("failed to find `memory` export in module"); /// }; /// /// let log_str = Func::wrap(&mut store, move |mut caller: Caller<'_, ()>, ptr: i32, len: i32| { /// let mem = match caller.get_module_export(&module_export) { /// Some(Extern::Memory(mem)) => mem, - /// _ => anyhow::bail!("failed to find host memory"), + /// _ => bail!("failed to find host memory"), /// }; /// let data = mem.data(&caller) /// .get(ptr as u32 as usize..) @@ -2151,9 +2151,9 @@ impl Caller<'_, T> { /// let string = match data { /// Some(data) => match str::from_utf8(data) { /// Ok(s) => s, - /// Err(_) => anyhow::bail!("invalid utf-8"), + /// Err(_) => bail!("invalid utf-8"), /// }, - /// None => anyhow::bail!("pointer/length out of bounds"), + /// None => bail!("pointer/length out of bounds"), /// }; /// assert_eq!(string, "Hello, world!"); /// println!("{}", string); diff --git a/crates/wasmtime/src/runtime/limits.rs b/crates/wasmtime/src/runtime/limits.rs index 26f7fcb28103..657f7f96ad16 100644 --- a/crates/wasmtime/src/runtime/limits.rs +++ b/crates/wasmtime/src/runtime/limits.rs @@ -85,7 +85,7 @@ pub trait ResourceLimiter: Send { /// /// See the details on the return values for `memory_growing` for what the /// return value of this function indicates. - fn memory_grow_failed(&mut self, error: anyhow::Error) -> Result<()> { + fn memory_grow_failed(&mut self, error: crate::Error) -> Result<()> { log::debug!("ignoring memory growth failure error: {error:?}"); Ok(()) } @@ -120,7 +120,7 @@ pub trait ResourceLimiter: Send { /// /// See the details on the return values for `memory_growing` for what the /// return value of this function indicates. - fn table_grow_failed(&mut self, error: anyhow::Error) -> Result<()> { + fn table_grow_failed(&mut self, error: crate::Error) -> Result<()> { log::debug!("ignoring table growth failure error: {error:?}"); Ok(()) } @@ -182,7 +182,7 @@ pub trait ResourceLimiterAsync: Send { ) -> Result; /// Identical to [`ResourceLimiter::memory_grow_failed`] - fn memory_grow_failed(&mut self, error: anyhow::Error) -> Result<()> { + fn memory_grow_failed(&mut self, error: crate::Error) -> Result<()> { log::debug!("ignoring memory growth failure error: {error:?}"); Ok(()) } @@ -196,7 +196,7 @@ pub trait ResourceLimiterAsync: Send { ) -> Result; /// Identical to [`ResourceLimiter::table_grow_failed`] - fn table_grow_failed(&mut self, error: anyhow::Error) -> Result<()> { + fn table_grow_failed(&mut self, error: crate::Error) -> Result<()> { log::debug!("ignoring table growth failure error: {error:?}"); Ok(()) } @@ -356,7 +356,7 @@ impl ResourceLimiter for StoreLimits { } } - fn memory_grow_failed(&mut self, error: anyhow::Error) -> Result<()> { + fn memory_grow_failed(&mut self, error: crate::Error) -> Result<()> { if self.trap_on_grow_failure { Err(error.context("forcing a memory growth failure to be a trap")) } else { @@ -385,7 +385,7 @@ impl ResourceLimiter for StoreLimits { } } - fn table_grow_failed(&mut self, error: anyhow::Error) -> Result<()> { + fn table_grow_failed(&mut self, error: crate::Error) -> Result<()> { if self.trap_on_grow_failure { Err(error.context("forcing a table growth failure to be a trap")) } else { diff --git a/crates/wasmtime/src/runtime/linker.rs b/crates/wasmtime/src/runtime/linker.rs index 377f3a606cb3..a04a4b6dbc1a 100644 --- a/crates/wasmtime/src/runtime/linker.rs +++ b/crates/wasmtime/src/runtime/linker.rs @@ -4,7 +4,7 @@ use crate::instance::InstancePre; use crate::store::StoreOpaque; use crate::{ AsContext, AsContextMut, Caller, Engine, Extern, ExternType, Func, FuncType, ImportType, - Instance, Module, StoreContextMut, Val, ValRaw, + Instance, Module, Result, StoreContextMut, Val, ValRaw, }; use crate::{IntoFunc, prelude::*}; use alloc::sync::Arc; @@ -173,7 +173,7 @@ impl Linker { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// let mut linker = Linker::<()>::new(&engine); /// linker.func_wrap("", "", || {})?; @@ -204,7 +204,7 @@ impl Linker { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// # let module = Module::new(&engine, "(module)")?; /// # let mut store = Store::new(&engine, ()); @@ -230,7 +230,7 @@ impl Linker { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// # let module = Module::new(&engine, "(module (import \"unknown\" \"import\" (func)))")?; /// # let mut store = Store::new(&engine, ()); @@ -240,7 +240,7 @@ impl Linker { /// # Ok(()) /// # } /// ``` - pub fn define_unknown_imports_as_traps(&mut self, module: &Module) -> anyhow::Result<()> + pub fn define_unknown_imports_as_traps(&mut self, module: &Module) -> Result<()> where T: 'static, { @@ -267,7 +267,7 @@ impl Linker { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// # let module = Module::new(&engine, "(module (import \"unknown\" \"import\" (func)))")?; /// # let mut store = Store::new(&engine, ()); @@ -281,7 +281,7 @@ impl Linker { &mut self, mut store: impl AsContextMut, module: &Module, - ) -> anyhow::Result<()> + ) -> Result<()> where T: 'static, { @@ -324,7 +324,7 @@ impl Linker { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// # let mut store = Store::new(&engine, ()); /// let mut linker = Linker::new(&engine); @@ -512,7 +512,7 @@ impl Linker { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// let mut linker = Linker::new(&engine); /// linker.func_wrap("host", "double", |x: i32| x * 2)?; @@ -617,7 +617,7 @@ impl Linker { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// # let mut store = Store::new(&engine, ()); /// let mut linker = Linker::new(&engine); @@ -708,7 +708,7 @@ impl Linker { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// # let mut store = Store::new(&engine, ()); /// let mut linker = Linker::new(&engine); @@ -738,7 +738,7 @@ impl Linker { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// # let mut store = Store::new(&engine, ()); /// let mut linker = Linker::new(&engine); @@ -1102,7 +1102,7 @@ impl Linker { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// # let mut store = Store::new(&engine, ()); /// let mut linker = Linker::new(&engine); @@ -1163,7 +1163,7 @@ impl Linker { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// # let mut store = Store::new(&engine, ()); /// let mut linker = Linker::new(&engine); @@ -1488,8 +1488,9 @@ impl ModuleKind { /// Error for an unresolvable import. /// -/// Returned - wrapped in an [`anyhow::Error`] - by [`Linker::instantiate`] and -/// related methods for modules with unresolvable imports. +/// Returned - wrapped in an [`Error`][crate::Error] - by +/// [`Linker::instantiate`] and related methods for modules with unresolvable +/// imports. #[derive(Clone, Debug)] pub struct UnknownImportError { module: String, diff --git a/crates/wasmtime/src/runtime/memory.rs b/crates/wasmtime/src/runtime/memory.rs index 6ec6fef44a1e..64f4897a00b3 100644 --- a/crates/wasmtime/src/runtime/memory.rs +++ b/crates/wasmtime/src/runtime/memory.rs @@ -106,8 +106,7 @@ impl core::error::Error for MemoryAccessError {} /// **unsafe** usages of `Memory`. Do not do these things! /// /// ```rust -/// # use anyhow::Result; -/// use wasmtime::{Memory, Store}; +/// use wasmtime::{Memory, Result, Store}; /// /// // NOTE: All code in this function is not safe to execute and may cause /// // segfaults/undefined behavior at runtime. Do not copy/paste these examples @@ -246,7 +245,7 @@ impl Memory { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// let engine = Engine::default(); /// let mut store = Store::new(&engine, ()); /// @@ -304,7 +303,7 @@ impl Memory { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// let engine = Engine::default(); /// let mut store = Store::new(&engine, ()); /// let module = Module::new(&engine, "(module (memory (export \"mem\") 1))")?; @@ -587,7 +586,7 @@ impl Memory { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// let engine = Engine::default(); /// let mut store = Store::new(&engine, ()); /// let module = Module::new(&engine, "(module (memory (export \"mem\") 1 2))")?; @@ -795,7 +794,7 @@ pub unsafe trait MemoryCreator: Send + Sync { /// /// ``` /// # use wasmtime::*; -/// # fn main() -> anyhow::Result<()> { +/// # fn main() -> Result<()> { /// let mut config = Config::new(); /// config.wasm_threads(true); /// config.shared_memory(true); diff --git a/crates/wasmtime/src/runtime/module.rs b/crates/wasmtime/src/runtime/module.rs index 82bf6eab50c0..28231d82e577 100644 --- a/crates/wasmtime/src/runtime/module.rs +++ b/crates/wasmtime/src/runtime/module.rs @@ -73,7 +73,7 @@ pub use registry::*; /// /// ```no_run /// # use wasmtime::*; -/// # fn main() -> anyhow::Result<()> { +/// # fn main() -> Result<()> { /// let engine = Engine::default(); /// let module = Module::from_file(&engine, "path/to/foo.wasm")?; /// # Ok(()) @@ -84,7 +84,7 @@ pub use registry::*; /// /// ```no_run /// # use wasmtime::*; -/// # fn main() -> anyhow::Result<()> { +/// # fn main() -> Result<()> { /// let engine = Engine::default(); /// // Now we're using the WebAssembly text extension: `.wat`! /// let module = Module::from_file(&engine, "path/to/foo.wat")?; @@ -97,7 +97,7 @@ pub use registry::*; /// /// ```no_run /// # use wasmtime::*; -/// # fn main() -> anyhow::Result<()> { +/// # fn main() -> Result<()> { /// let engine = Engine::default(); /// # let wasm_bytes: Vec = Vec::new(); /// let module = Module::new(&engine, &wasm_bytes)?; @@ -112,7 +112,7 @@ pub use registry::*; /// /// ```no_run /// # use wasmtime::*; -/// # fn main() -> anyhow::Result<()> { +/// # fn main() -> Result<()> { /// let engine = Engine::default(); /// # let wasm_bytes: Vec = Vec::new(); /// let module = Module::new(&engine, &wasm_bytes)?; @@ -225,7 +225,7 @@ impl Module { /// /// ```no_run /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// # let wasm_bytes: Vec = Vec::new(); /// let module = Module::new(&engine, &wasm_bytes)?; @@ -238,7 +238,7 @@ impl Module { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// let module = Module::new(&engine, "(module (func))")?; /// # Ok(()) @@ -262,7 +262,7 @@ impl Module { /// /// ```no_run /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// let engine = Engine::default(); /// let module = Module::from_file(&engine, "./path/to/foo.wasm")?; /// # Ok(()) @@ -273,7 +273,7 @@ impl Module { /// /// ```no_run /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// let module = Module::from_file(&engine, "./path/to/foo.wat")?; /// # Ok(()) @@ -299,7 +299,7 @@ impl Module { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// let wasm = b"\0asm\x01\0\0\0"; /// let module = Module::from_binary(&engine, wasm)?; @@ -311,7 +311,7 @@ impl Module { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// assert!(Module::from_binary(&engine, b"(module)").is_err()); /// # Ok(()) @@ -666,7 +666,7 @@ impl Module { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// let module = Module::new(&engine, "(module $foo)")?; /// assert_eq!(module.name(), Some("foo")); @@ -699,7 +699,7 @@ impl Module { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// let module = Module::new(&engine, "(module)")?; /// assert_eq!(module.imports().len(), 0); @@ -711,7 +711,7 @@ impl Module { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// let wat = r#" /// (module @@ -760,7 +760,7 @@ impl Module { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// let module = Module::new(&engine, "(module)")?; /// assert!(module.exports().next().is_none()); @@ -772,7 +772,7 @@ impl Module { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// let wat = r#" /// (module @@ -821,7 +821,7 @@ impl Module { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// let module = Module::new(&engine, "(module)")?; /// assert!(module.get_export("foo").is_none()); @@ -833,7 +833,7 @@ impl Module { /// /// ``` /// # use wasmtime::*; - /// # fn main() -> anyhow::Result<()> { + /// # fn main() -> Result<()> { /// # let engine = Engine::default(); /// let wat = r#" /// (module diff --git a/crates/wasmtime/src/runtime/module/registry.rs b/crates/wasmtime/src/runtime/module/registry.rs index e7d5bce632c3..ad86cf158b89 100644 --- a/crates/wasmtime/src/runtime/module/registry.rs +++ b/crates/wasmtime/src/runtime/module/registry.rs @@ -333,7 +333,7 @@ pub fn unregister_code(address: Range) { #[test] #[cfg_attr(miri, ignore)] -fn test_frame_info() -> Result<(), anyhow::Error> { +fn test_frame_info() -> Result<(), crate::Error> { use crate::*; let mut store = Store::<()>::default(); diff --git a/crates/wasmtime/src/runtime/profiling.rs b/crates/wasmtime/src/runtime/profiling.rs index 6baac6064a24..30234e32bcbe 100644 --- a/crates/wasmtime/src/runtime/profiling.rs +++ b/crates/wasmtime/src/runtime/profiling.rs @@ -119,7 +119,7 @@ impl GuestProfiler { // instantiation (for breakpoint patching) so the logic below // is incorrect. if engine.tunables().debug_guest { - anyhow::bail!("Profiling cannot be performed when guest-debugging is enabled."); + crate::bail!("Profiling cannot be performed when guest-debugging is enabled."); } let zero = ReferenceTimestamp::from_millis_since_unix_epoch(0.0); diff --git a/crates/wasmtime/src/runtime/store.rs b/crates/wasmtime/src/runtime/store.rs index aae8397212ac..f41c401daf10 100644 --- a/crates/wasmtime/src/runtime/store.rs +++ b/crates/wasmtime/src/runtime/store.rs @@ -345,7 +345,7 @@ impl StoreResourceLimiter<'_> { } } - pub(crate) fn memory_grow_failed(&mut self, error: anyhow::Error) -> Result<()> { + pub(crate) fn memory_grow_failed(&mut self, error: crate::Error) -> Result<()> { match self { Self::Sync(s) => s.memory_grow_failed(error), #[cfg(feature = "async")] @@ -366,7 +366,7 @@ impl StoreResourceLimiter<'_> { } } - pub(crate) fn table_grow_failed(&mut self, error: anyhow::Error) -> Result<()> { + pub(crate) fn table_grow_failed(&mut self, error: crate::Error) -> Result<()> { match self { Self::Sync(s) => s.table_grow_failed(error), #[cfg(feature = "async")] @@ -2288,7 +2288,7 @@ impl StoreOpaque { } pub fn get_fuel(&self) -> Result { - anyhow::ensure!( + crate::ensure!( self.engine().tunables().consume_fuel, "fuel is not configured in this store" ); @@ -2306,7 +2306,7 @@ impl StoreOpaque { } pub fn set_fuel(&mut self, fuel: u64) -> Result<()> { - anyhow::ensure!( + crate::ensure!( self.engine().tunables().consume_fuel, "fuel is not configured in this store" ); @@ -2321,15 +2321,15 @@ impl StoreOpaque { } pub fn fuel_async_yield_interval(&mut self, interval: Option) -> Result<()> { - anyhow::ensure!( + crate::ensure!( self.engine().tunables().consume_fuel, "fuel is not configured in this store" ); - anyhow::ensure!( + crate::ensure!( self.engine().config().async_support, "async support is not configured in this store" ); - anyhow::ensure!( + crate::ensure!( interval != Some(0), "fuel_async_yield_interval must not be 0" ); @@ -2837,7 +2837,7 @@ unsafe impl VMStore for StoreInner { } #[cfg(feature = "debug")] - fn block_on_debug_handler(&mut self, event: crate::DebugEvent<'_>) -> anyhow::Result<()> { + fn block_on_debug_handler(&mut self, event: crate::DebugEvent<'_>) -> crate::Result<()> { if let Some(handler) = self.debug_handler.take() { if !self.can_block() { bail!("could not invoke debug handler without async context"); diff --git a/crates/wasmtime/src/runtime/trampoline/global.rs b/crates/wasmtime/src/runtime/trampoline/global.rs index 5ef0a6ddf2cc..6c3099d59a27 100644 --- a/crates/wasmtime/src/runtime/trampoline/global.rs +++ b/crates/wasmtime/src/runtime/trampoline/global.rs @@ -76,7 +76,7 @@ pub fn generate_global_export( } Val::ContRef(Some(_)) => { // TODO(#10248): Implement non-null trampoline continuation reference handling - return Err(anyhow::anyhow!( + return Err(crate::format_err!( "non-null continuation references in trampoline globals not yet supported" )); } diff --git a/crates/wasmtime/src/runtime/trampoline/memory.rs b/crates/wasmtime/src/runtime/trampoline/memory.rs index 9b91d7eadf31..e9a1c5ca2c25 100644 --- a/crates/wasmtime/src/runtime/trampoline/memory.rs +++ b/crates/wasmtime/src/runtime/trampoline/memory.rs @@ -137,7 +137,7 @@ unsafe impl InstanceAllocator for SingleMemoryInstance<'_> { } fn validate_module(&self, module: &Module, offsets: &VMOffsets) -> Result<()> { - anyhow::ensure!( + crate::ensure!( module.memories.len() == 1, "`SingleMemoryInstance` allocator can only be used for modules with a single memory" ); diff --git a/crates/wasmtime/src/runtime/trap.rs b/crates/wasmtime/src/runtime/trap.rs index fbe103cb2d76..d0c3fa95b6ce 100644 --- a/crates/wasmtime/src/runtime/trap.rs +++ b/crates/wasmtime/src/runtime/trap.rs @@ -20,21 +20,21 @@ use wasmtime_environ::{FilePos, demangle_function_name, demangle_function_name_o /// # Errors in Wasmtime /// /// Error-handling in Wasmtime is primarily done through the -/// [`anyhow`][mod@anyhow] crate where most results are a -/// [`Result`](anyhow::Result) which is an alias for [`Result`](std::result::Result). Errors in Wasmtime are represented -/// with [`anyhow::Error`] which acts as a container for any type of error in +/// [`wasmtime::Error`][crate::Error] type where most results are a +/// [`wasmtime::Result`](crate::Result) which is an alias for [`Result`](std::result::Result). Errors in Wasmtime are represented +/// with [`wasmtime::Error`] which acts as a container for any type of error in /// addition to optional context for this error. The "base" error or -/// [`anyhow::Error::root_cause`] is a [`Trap`] whenever WebAssembly hits a +/// [`wasmtime::Error::root_cause`] is a [`Trap`] whenever WebAssembly hits a /// trap, or otherwise it's whatever the host created the error with when /// returning an error for a host call. /// /// Any error which happens while WebAssembly is executing will also, by /// default, capture a backtrace of the wasm frames while executing. This /// backtrace is represented with a [`WasmBacktrace`] instance and is attached -/// to the [`anyhow::Error`] return value as a -/// [`context`](anyhow::Error::context). Inspecting a [`WasmBacktrace`] can be -/// done with the [`downcast_ref`](anyhow::Error::downcast_ref) function. For +/// to the [`wasmtime::Error`] return value as a +/// [`context`](crate::Error::context). Inspecting a [`WasmBacktrace`] can be +/// done with the [`downcast_ref`](crate::Error::downcast_ref) function. For /// information on this see the [`WasmBacktrace`] documentation. /// /// # Examples @@ -83,7 +83,7 @@ pub(crate) fn from_runtime_box( let (mut error, pc) = match reason { #[cfg(feature = "gc")] crate::runtime::vm::TrapReason::Exception => (ThrownException.into(), None), - // For user-defined errors they're already an `anyhow::Error` so no + // For user-defined errors they're already an `crate::Error` so no // conversion is really necessary here, but a `backtrace` may have // been captured so it's attempted to get inserted here. // @@ -137,9 +137,9 @@ pub(crate) fn from_runtime_box( /// Representation of a backtrace of function frames in a WebAssembly module for /// where an error happened. /// -/// This structure is attached to the [`anyhow::Error`] returned from many +/// This structure is attached to the [`wasmtime::Error`] returned from many /// Wasmtime functions that execute WebAssembly such as [`Instance::new`] or -/// [`Func::call`]. This can be acquired with the [`anyhow::Error::downcast`] +/// [`Func::call`]. This can be acquired with the [`wasmtime::Error::downcast`] /// family of methods to programmatically inspect the backtrace. Otherwise since /// it's part of the error returned this will get printed along with the rest of /// the error when the error is logged. diff --git a/crates/wasmtime/src/runtime/types/matching.rs b/crates/wasmtime/src/runtime/types/matching.rs index e9431c75dac9..49ffc3c67f32 100644 --- a/crates/wasmtime/src/runtime/types/matching.rs +++ b/crates/wasmtime/src/runtime/types/matching.rs @@ -100,11 +100,7 @@ pub fn entity_ty(engine: &Engine, expected: &EntityType, actual: &EntityType) -> } } -fn concrete_type_mismatch( - msg: &str, - expected: &WasmSubType, - actual: &WasmSubType, -) -> anyhow::Error { +fn concrete_type_mismatch(msg: &str, expected: &WasmSubType, actual: &WasmSubType) -> crate::Error { anyhow!("{msg}: expected type `{expected}`, found type `{actual}`") } diff --git a/crates/wasmtime/src/runtime/v128.rs b/crates/wasmtime/src/runtime/v128.rs index b92135785e85..c4c6ffe01705 100644 --- a/crates/wasmtime/src/runtime/v128.rs +++ b/crates/wasmtime/src/runtime/v128.rs @@ -92,7 +92,7 @@ unsafe impl WasmTy for V128 { _: &StoreOpaque, _: bool, _: &crate::HeapType, - ) -> anyhow::Result<()> { + ) -> crate::Result<()> { unreachable!() } diff --git a/crates/wasmtime/src/runtime/values.rs b/crates/wasmtime/src/runtime/values.rs index 15aa627b8bd4..af0b86d32afd 100644 --- a/crates/wasmtime/src/runtime/values.rs +++ b/crates/wasmtime/src/runtime/values.rs @@ -192,7 +192,7 @@ impl Val { Val::ExnRef(Some(e)) => ValType::Ref(RefType::new(false, e._ty(store)?.into())), Val::ContRef(_) => { // TODO(#10248): Return proper continuation reference type when available - return Err(anyhow::anyhow!( + return Err(crate::format_err!( "continuation references not yet supported in embedder API" )); } @@ -290,7 +290,7 @@ impl Val { })), Val::ContRef(_) => { // TODO(#10248): Implement proper continuation reference to_raw conversion - Err(anyhow::anyhow!( + Err(crate::format_err!( "continuation references not yet supported in to_raw conversion" )) } diff --git a/crates/wasmtime/src/runtime/vm.rs b/crates/wasmtime/src/runtime/vm.rs index 2eb24859f71b..cbdfa2587615 100644 --- a/crates/wasmtime/src/runtime/vm.rs +++ b/crates/wasmtime/src/runtime/vm.rs @@ -231,7 +231,7 @@ pub unsafe trait VMStore: 'static { /// Invoke a debug handler, if present, at a debug event. #[cfg(feature = "debug")] - fn block_on_debug_handler(&mut self, event: crate::DebugEvent) -> anyhow::Result<()>; + fn block_on_debug_handler(&mut self, event: crate::DebugEvent) -> crate::Result<()>; } impl Deref for dyn VMStore + '_ { @@ -354,10 +354,7 @@ impl ModuleRuntimeInfo { /// Returns the `MemoryImage` structure used for copy-on-write /// initialization of the memory, if it's applicable. - fn memory_image( - &self, - memory: DefinedMemoryIndex, - ) -> anyhow::Result>> { + fn memory_image(&self, memory: DefinedMemoryIndex) -> crate::Result>> { match self { ModuleRuntimeInfo::Module(m) => { let images = m.memory_images()?; diff --git a/crates/wasmtime/src/runtime/vm/component.rs b/crates/wasmtime/src/runtime/vm/component.rs index a75bbb303698..a10db5053ae6 100644 --- a/crates/wasmtime/src/runtime/vm/component.rs +++ b/crates/wasmtime/src/runtime/vm/component.rs @@ -6,6 +6,7 @@ //! Eventually it's intended that module-to-module calls, which would be //! cranelift-compiled adapters, will use this `VMComponentContext` as well. +use crate::Result; use crate::component::{Component, Instance, InstancePre, ResourceType, RuntimeImport}; use crate::module::ModuleRegistry; use crate::runtime::component::ComponentInstanceId; @@ -22,7 +23,6 @@ use crate::store::InstanceId; use crate::{Func, vm}; use alloc::alloc::Layout; use alloc::sync::Arc; -use anyhow::Result; use core::mem; use core::mem::offset_of; use core::pin::Pin; @@ -998,12 +998,12 @@ impl ComponentInstance { pub(crate) fn check_may_leave( &self, instance: RuntimeComponentInstanceIndex, - ) -> anyhow::Result<()> { + ) -> crate::Result<()> { let flags = self.instance_flags(instance); if unsafe { flags.may_leave() } { Ok(()) } else { - Err(anyhow::anyhow!(crate::Trap::CannotLeaveComponent)) + Err(crate::format_err!(crate::Trap::CannotLeaveComponent)) } } } diff --git a/crates/wasmtime/src/runtime/vm/component/handle_table.rs b/crates/wasmtime/src/runtime/vm/component/handle_table.rs index 60ce64793c30..309451c0f9fc 100644 --- a/crates/wasmtime/src/runtime/vm/component/handle_table.rs +++ b/crates/wasmtime/src/runtime/vm/component/handle_table.rs @@ -1,6 +1,6 @@ use super::{TypedResource, TypedResourceIndex}; +use crate::error::{Result, bail}; use alloc::vec::Vec; -use anyhow::{Result, bail}; use core::mem; use wasmtime_environ::component::{TypeFutureTableIndex, TypeStreamTableIndex}; diff --git a/crates/wasmtime/src/runtime/vm/gc/enabled/arrayref.rs b/crates/wasmtime/src/runtime/vm/gc/enabled/arrayref.rs index 5d6f525f8a5f..d700497df4a1 100644 --- a/crates/wasmtime/src/runtime/vm/gc/enabled/arrayref.rs +++ b/crates/wasmtime/src/runtime/vm/gc/enabled/arrayref.rs @@ -278,7 +278,7 @@ impl VMArrayRef { } Val::ContRef(_) => { // TODO(#10248): Implement array continuation reference element handling - return Err(anyhow::anyhow!( + return Err(crate::format_err!( "setting continuation references in array elements not yet supported" )); } @@ -391,7 +391,7 @@ impl VMArrayRef { } Val::ContRef(_) => { // TODO(#10248): Implement array continuation reference init handling - return Err(anyhow::anyhow!( + return Err(crate::format_err!( "initializing continuation references in array elements not yet supported" )); } diff --git a/crates/wasmtime/src/runtime/vm/gc/enabled/free_list.rs b/crates/wasmtime/src/runtime/vm/gc/enabled/free_list.rs index 9d227f04d219..7d0fb7c877aa 100644 --- a/crates/wasmtime/src/runtime/vm/gc/enabled/free_list.rs +++ b/crates/wasmtime/src/runtime/vm/gc/enabled/free_list.rs @@ -153,7 +153,7 @@ impl FreeList { let alloc_size = u32::try_from(layout.size()).map_err(|e| { let trap = crate::Trap::AllocationTooLarge; - let err = anyhow::Error::from(trap); + let err = crate::Error::from(trap); err.context(e) .context("requested allocation's size does not fit in a u32") })?; @@ -161,7 +161,7 @@ impl FreeList { .checked_next_multiple_of(ALIGN_U32) .ok_or_else(|| { let trap = crate::Trap::AllocationTooLarge; - let err = anyhow::Error::from(trap); + let err = crate::Error::from(trap); let err = err.context(format!( "failed to round allocation size of {alloc_size} up to next \ multiple of {ALIGN_USIZE}" diff --git a/crates/wasmtime/src/runtime/vm/gc/enabled/structref.rs b/crates/wasmtime/src/runtime/vm/gc/enabled/structref.rs index a8ecfea074e4..74333e568325 100644 --- a/crates/wasmtime/src/runtime/vm/gc/enabled/structref.rs +++ b/crates/wasmtime/src/runtime/vm/gc/enabled/structref.rs @@ -235,7 +235,7 @@ impl VMStructRef { } Val::ContRef(_) => { // TODO(#10248): Implement struct continuation reference field handling - return Err(anyhow::anyhow!( + return Err(crate::format_err!( "setting continuation references in struct fields not yet supported" )); } @@ -394,7 +394,7 @@ pub(crate) fn initialize_field_impl( } Val::ContRef(_) => { // TODO(#10248): Implement struct continuation reference field init handling - return Err(anyhow::anyhow!( + return Err(crate::format_err!( "initializing continuation references in struct fields not yet supported" )); } diff --git a/crates/wasmtime/src/runtime/vm/instance/allocator/on_demand.rs b/crates/wasmtime/src/runtime/vm/instance/allocator/on_demand.rs index cbcfec3dfcf1..d3015c70c1b6 100644 --- a/crates/wasmtime/src/runtime/vm/instance/allocator/on_demand.rs +++ b/crates/wasmtime/src/runtime/vm/instance/allocator/on_demand.rs @@ -177,7 +177,7 @@ unsafe impl InstanceAllocator for OnDemandInstanceAllocator { #[cfg(feature = "async")] fn allocate_fiber_stack(&self) -> Result { if self.stack_size == 0 { - anyhow::bail!("fiber stacks are not supported by the allocator") + crate::bail!("fiber stacks are not supported by the allocator") } let stack = match &self.stack_creator { Some(stack_creator) => { diff --git a/crates/wasmtime/src/runtime/vm/instance/allocator/pooling/generic_stack_pool.rs b/crates/wasmtime/src/runtime/vm/instance/allocator/pooling/generic_stack_pool.rs index f7856558952c..c191580b3760 100644 --- a/crates/wasmtime/src/runtime/vm/instance/allocator/pooling/generic_stack_pool.rs +++ b/crates/wasmtime/src/runtime/vm/instance/allocator/pooling/generic_stack_pool.rs @@ -65,7 +65,7 @@ impl StackPool { Ok(stack) => Ok(stack), Err(e) => { self.live_stacks.fetch_sub(1, Ordering::AcqRel); - Err(anyhow::Error::from(e)) + Err(crate::Error::from(e)) } } } diff --git a/crates/wasmtime/src/runtime/vm/libcalls.rs b/crates/wasmtime/src/runtime/vm/libcalls.rs index 7fe172f17295..9e2f74e8b00c 100644 --- a/crates/wasmtime/src/runtime/vm/libcalls.rs +++ b/crates/wasmtime/src/runtime/vm/libcalls.rs @@ -199,7 +199,7 @@ macro_rules! block_on { // Note that if `async_support` is disabled then it should not be // possible to introduce await points so the provided future should // always be ready. - anyhow::Ok(vm::assert_ready(closure(store))) + crate::error::Ok(vm::assert_ready(closure(store))) } }}; } diff --git a/crates/wasmtime/src/runtime/vm/mmap_vec.rs b/crates/wasmtime/src/runtime/vm/mmap_vec.rs index 5900cb31046e..5e779d43ac57 100644 --- a/crates/wasmtime/src/runtime/vm/mmap_vec.rs +++ b/crates/wasmtime/src/runtime/vm/mmap_vec.rs @@ -296,7 +296,7 @@ impl MmapVec { MmapVec::from_slice_with_alignment(&self[..], layout.align()) } MmapVec::ExternallyOwned { .. } => { - anyhow::bail!("Cannot clone an externally-owned code memory."); + crate::bail!("Cannot clone an externally-owned code memory."); } #[cfg(has_virtual_memory)] MmapVec::Mmap { mmap, len } => { diff --git a/crates/wasmtime/src/runtime/vm/stack_switching.rs b/crates/wasmtime/src/runtime/vm/stack_switching.rs index a96c896ae1ff..d46e607e62c6 100644 --- a/crates/wasmtime/src/runtime/vm/stack_switching.rs +++ b/crates/wasmtime/src/runtime/vm/stack_switching.rs @@ -302,7 +302,7 @@ pub fn cont_new( func: *mut u8, param_count: u32, result_count: u32, -) -> anyhow::Result<*mut VMContRef> { +) -> crate::Result<*mut VMContRef> { let instance = store.instance_mut(instance); let caller_vmctx = instance.vmctx(); diff --git a/crates/wasmtime/src/runtime/vm/stack_switching/stack.rs b/crates/wasmtime/src/runtime/vm/stack_switching/stack.rs index 831a60e8d3c2..9138aca7359f 100644 --- a/crates/wasmtime/src/runtime/vm/stack_switching/stack.rs +++ b/crates/wasmtime/src/runtime/vm/stack_switching/stack.rs @@ -1,7 +1,7 @@ //! This module contains a modified version of the `wasmtime_fiber` crate, //! specialized for executing stack switching continuations. -use anyhow::Result; +use crate::Result; use core::ops::Range; use crate::runtime::vm::stack_switching::VMHostArray; diff --git a/crates/wasmtime/src/runtime/vm/stack_switching/stack/dummy.rs b/crates/wasmtime/src/runtime/vm/stack_switching/stack/dummy.rs index e2b977c15717..5d364da7fd3a 100644 --- a/crates/wasmtime/src/runtime/vm/stack_switching/stack/dummy.rs +++ b/crates/wasmtime/src/runtime/vm/stack_switching/stack/dummy.rs @@ -1,4 +1,4 @@ -use anyhow::Result; +use crate::Result; use core::ops::Range; use crate::runtime::vm::stack_switching::VMHostArray; @@ -16,7 +16,7 @@ pub struct VMContinuationStack { impl VMContinuationStack { pub fn new(_size: usize) -> Result { - anyhow::bail!("Stack switching disabled or not implemented on this platform") + crate::bail!("Stack switching disabled or not implemented on this platform") } pub fn unallocated() -> Self { @@ -28,7 +28,7 @@ impl VMContinuationStack { } pub unsafe fn from_raw_parts(_base: *mut u8, _guard_size: usize, _len: usize) -> Result { - anyhow::bail!("Stack switching disabled or not implemented on this platform") + crate::bail!("Stack switching disabled or not implemented on this platform") } pub fn is_from_raw_parts(&self) -> bool { diff --git a/crates/wasmtime/src/runtime/vm/sys/custom/mmap.rs b/crates/wasmtime/src/runtime/vm/sys/custom/mmap.rs index 2b4bc8bdcd37..bc2ff78d8b32 100644 --- a/crates/wasmtime/src/runtime/vm/sys/custom/mmap.rs +++ b/crates/wasmtime/src/runtime/vm/sys/custom/mmap.rs @@ -9,7 +9,7 @@ use std::{fs::File, path::Path}; #[cfg(feature = "std")] pub fn open_file_for_mmap(_path: &Path) -> Result { - anyhow::bail!("not supported on this platform"); + crate::bail!("not supported on this platform"); } #[derive(Debug)] @@ -48,7 +48,7 @@ impl Mmap { #[cfg(feature = "std")] pub fn from_file(_file: &File) -> Result { - anyhow::bail!("not supported on this platform"); + crate::bail!("not supported on this platform"); } pub unsafe fn make_accessible( diff --git a/crates/wasmtime/src/runtime/vm/sys/unix/mmap.rs b/crates/wasmtime/src/runtime/vm/sys/unix/mmap.rs index 477a1309f586..9ff73a8ecbf0 100644 --- a/crates/wasmtime/src/runtime/vm/sys/unix/mmap.rs +++ b/crates/wasmtime/src/runtime/vm/sys/unix/mmap.rs @@ -88,7 +88,7 @@ impl Mmap { .metadata() .context("failed to get file metadata")? .len(); - let len = usize::try_from(len).map_err(|_| anyhow::anyhow!("file too large to map"))?; + let len = usize::try_from(len).map_err(|_| crate::format_err!("file too large to map"))?; let ptr = unsafe { rustix::mm::mmap( ptr::null_mut(), diff --git a/crates/wasmtime/src/runtime/vm/sys/unix/vm.rs b/crates/wasmtime/src/runtime/vm/sys/unix/vm.rs index 237b8d9b28ff..8ffac0d79605 100644 --- a/crates/wasmtime/src/runtime/vm/sys/unix/vm.rs +++ b/crates/wasmtime/src/runtime/vm/sys/unix/vm.rs @@ -108,7 +108,7 @@ impl MemoryImageSource { } #[cfg(target_os = "linux")] - pub fn from_data(data: &[u8]) -> anyhow::Result> { + pub fn from_data(data: &[u8]) -> crate::Result> { // On Linux `memfd_create` is used to create an anonymous // in-memory file to represent the heap image. This anonymous // file is then used as the basis for further mmaps. diff --git a/crates/wasmtime/tests/engine_across_forks.rs b/crates/wasmtime/tests/engine_across_forks.rs index dce3caabd00e..d03232f962e2 100644 --- a/crates/wasmtime/tests/engine_across_forks.rs +++ b/crates/wasmtime/tests/engine_across_forks.rs @@ -72,7 +72,7 @@ mod unix { let memory = instance.get_memory(&mut store, "").unwrap(); let data = memory.data(&store); assert_eq!(data[0], 0x0a); - anyhow::Ok((store, memory)) + wasmtime::error::Ok((store, memory)) }; run_in_child(|| { // Allocate a memory, and then mutate it. diff --git a/crates/wit-bindgen/src/lib.rs b/crates/wit-bindgen/src/lib.rs index 621a089fde80..0220c3473027 100644 --- a/crates/wit-bindgen/src/lib.rs +++ b/crates/wit-bindgen/src/lib.rs @@ -450,7 +450,7 @@ impl Wasmtime { #[allow(clippy::all)] pub mod {snake} {{ #[allow(unused_imports)] - use {wt}::component::__internal::{{anyhow, Box}}; + use {wt}::component::__internal::{{Box}}; {module} }} @@ -503,19 +503,19 @@ impl Wasmtime { let typecheck = format!( "match item {{ {wt}::component::types::ComponentItem::ComponentFunc(func) => {{ - anyhow::Context::context( + {wt}::error::Context::context( func.typecheck::<{sig}>(&_instance_type), \"type-checking export func `{0}`\" )?; index }} - _ => Err(anyhow::anyhow!(\"export `{0}` is not a function\"))?, + _ => Err({wt}::error::format_err!(\"export `{0}` is not a function\"))?, }}", func.name ); get_index = format!( "{{ let (item, index) = _component.get_export(None, \"{}\") - .ok_or_else(|| anyhow::anyhow!(\"no export `{0}` found\"))?; + .ok_or_else(|| {wt}::error::format_err!(\"no export `{0}` found\"))?; {typecheck} }}", func.name @@ -573,10 +573,10 @@ pub fn new<_T>( _instance_pre: &{wt}::component::InstancePre<_T>, ) -> {wt}::Result<{struct_name}Indices> {{ let instance = _instance_pre.component().get_export_index(None, \"{instance_name}\") - .ok_or_else(|| anyhow::anyhow!(\"no exported instance named `{instance_name}`\"))?; + .ok_or_else(|| {wt}::error::format_err!(\"no exported instance named `{instance_name}`\"))?; let mut lookup = move |name| {{ _instance_pre.component().get_export_index(Some(&instance), name).ok_or_else(|| {{ - anyhow::anyhow!( + {wt}::error::format_err!( \"instance export `{instance_name}` does \\ not have export `{{name}}`\" ) @@ -673,7 +673,7 @@ pub fn new<_T>( #[allow(clippy::all)] pub mod {snake} {{ #[allow(unused_imports)] - use {wt}::component::__internal::{{anyhow, Box}}; + use {wt}::component::__internal::Box; {module} }} @@ -872,13 +872,6 @@ impl<_T: Send + 'static> {camel}Pre<_T> {{ let world_trait = self.world_imports_trait(resolve, world); uwriteln!(self.src, "const _: () = {{"); - uwriteln!( - self.src, - " - #[allow(unused_imports)] - use {wt}::component::__internal::anyhow; - " - ); uwriteln!( self.src,