Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Migrate the `wasmtime` crate to `wasmtime_environ::error::*` (#12231)

Nick Fitzgerald96e19700da9a
diff --git a/Cargo.lock b/Cargo.lock
index 9bb699ba1b..ac6bfaaf27 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4490,7 +4490,6 @@ name = "wasmtime"
version = "42.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 64504fa82e..3a408dd83f 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::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<Self> {
+ ) -> #wt::Result<Self> {
#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<Self> {
+ ) -> #wt::Result<Self> {
#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<Self> {
+ ) -> #wt::Result<Self> {
#extract_ty
Ok(match src.tag.get_u32() {
#lifts
- discrim => #internal::anyhow::bail!("unexpected discriminant: {}", discrim),
+ discrim => #wt::bail!("unexpected discriminant: {}", discrim),
})
}
@@ -593,7 +593,7 @@ impl Expander for LiftExpander {
cx: &mut #internal::LiftContext<'_>,
ty: #internal::InterfaceType,
bytes: &[u8],
- ) -> #internal::anyhow::Result<Self> {
+ ) -> #wt::Result<Self> {
let align = <Self as #wt::component::ComponentType>::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::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<Self> {
+ ) -> #wt::Result<Self> {
#extract_ty
let discrim = src.tag.get_u32();
if discrim >= #discrim_limit {
- #internal::anyhow::bail!("unexpected discriminant: {discrim}");
+ #wt::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<Self> {
+ ) -> #wt::Result<Self> {
let align = <Self as #wt::component::ComponentType>::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::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<Self::Lower>,
- ) -> #internal::anyhow::Result<()> {
+ ) -> #wt::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::Result<()> {
debug_assert!(offset % (<Self as #wt::component::ComponentType>::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<Self::Lower>,
- ) -> #internal::anyhow::Result<()> {
+ ) -> #wt::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::Result<()> {
#extract_ty
debug_assert!(offset % (<Self as #wt::component::ComponentType>::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<Self::Lower>,
- ) -> #internal::anyhow::Result<()> {
+ ) -> #wt::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::Result<()> {
#extract_ty
debug_assert!(offset % (<Self as #wt::component::ComponentType>::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::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::Result<()> {
#internal::typecheck_enum(ty, types, &[#case_names])
}
@@ -1472,7 +1472,7 @@ pub fn expand_flags(flags: &Flags) -> Result<TokenStream> {
cx: &mut #internal::LowerContext<'_, T>,
_ty: #internal::InterfaceType,
dst: &mut core::mem::MaybeUninit<Self::Lower>,
- ) -> #internal::anyhow::Result<()> {
+ ) -> #wt::Result<()> {
#(
self.#field_names.linear_lower_to_flat(
cx,
@@ -1488,7 +1488,7 @@ pub fn expand_flags(flags: &Flags) -> Result<TokenStream> {
cx: &mut #internal::LowerContext<'_, T>,
_ty: #internal::InterfaceType,
mut offset: usize
- ) -> #internal::anyhow::Result<()> {
+ ) -> #wt::Result<()> {
debug_assert!(offset % (<Self as #wt::component::ComponentType>::ALIGN32 as usize) == 0);
#(
self.#field_names.linear_lower_to_memory(
@@ -1507,7 +1507,7 @@ pub fn expand_flags(flags: &Flags) -> Result<TokenStream> {
cx: &mut #internal::LiftContext<'_>,
_ty: #internal::InterfaceType,
src: &Self::Lower,
- ) -> #internal::anyhow::Result<Self> {
+ ) -> #wt::Result<Self> {
Ok(Self {
#(
#field_names: #wt::component::Lift::linear_lift_from_flat(
@@ -1523,7 +1523,7 @@ pub fn expand_flags(flags: &Flags) -> Result<TokenStream> {
cx: &mut #internal::LiftContext<'_>,
_ty: #internal::InterfaceType,
bytes: &[u8],
- ) -> #internal::anyhow::Result<Self> {
+ ) -> #wt::Result<Self> {
debug_assert!(
(bytes.as_ptr() as usize)
% (<Self as #wt::component::ComponentType>::ALIGN32 as usize)
diff --git a/crates/component-macro/tests/codegen.rs b/crates/component-macro/tests/codegen.rs
index 87427d8d61..826aedfa00 100644
--- a/crates/component-macro/tests/codegen.rs
+++ b/crates/component-macro/tests/codegen.rs
@@ -43,7 +43,7 @@ macro_rules! gentest {
component_macro_test_helpers::foreach!(gentest);
mod with_key_and_resources {
- use anyhow::Result;
+ use wasmtime::Result;
use wasmtime::component::Resource;
wasmtime::component::bindgen!({
diff --git a/crates/component-macro/tests/expanded.rs b/crates/component-macro/tests/expanded.rs
index bb4711522c..4b27b2ae68 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::{Result, bail, error::Context};
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 c17404c9df..273780c38b 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::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::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 203b118db4..4dd42e6782 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::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::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 a22cd8e218..cd266fa9b8 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<T>(
@@ -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::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::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 0314bf0e20..19835e7fd9 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::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::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 6e52b654da..a623593be4 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::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::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 918136e41a..cf55278a69 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::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::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 a61d3326f4..7306158989 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::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::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 3a8238c1fa..516a50f58e 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::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::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 147d40b2ec..a0b2da6c50 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 cb7c088904..9a56d63681 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 d0f83b9558..a277b8c7de 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 23e631fb8f..bbe2b7fb49 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 387956071b..e4f7ccb2a4 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 5c5b53cdb4..741b9eb5e7 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 ea69794385..81606a4d8e 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 20bfe56554..ed529cb434 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 e0bbef06aa..ecb6b606aa 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 e0bbef06aa..ecb6b606aa 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 e0bbef06aa..ecb6b606aa 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 e0bbef06aa..ecb6b606aa 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 0a348636b6..4b7150019c 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::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::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 f5aef11f2e..8b263ef392 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::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::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 2368bf5c40..fa3e3b8906 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::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::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 6f140e753c..f5dc442560 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::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::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 94e34f2f23..a41e1425d0 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::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::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 be44742453..f977c62c47 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::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::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 f28ef61743..14361bf3d4 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<T>(
accessor: &wasmtime::component::Accessor<T, Self>,
@@ -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::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::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 654d38cb24..63c8ed1bb6 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::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::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 e316c531fa..8ccbaa0412 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,16 @@ const _: () = {
let new = {
let (item, index) = _component
.get_export(None, "new")
- .ok_or_else(|| anyhow::anyhow!("no export `new` found"))?;
+ .ok_or_else(|| wasmtime::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::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 354c3148d8..3fe487f070 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,16 @@ const _: () = {
let new = {
let (item, index) = _component
.get_export(None, "new")
- .ok_or_else(|| anyhow::anyhow!("no export `new` found"))?;
+ .ok_or_else(|| wasmtime::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::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 ba3192bc7b..35d488c5f8 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,16 @@ const _: () = {
let new = {
let (item, index) = _component
.get_export(None, "new")
- .ok_or_else(|| anyhow::anyhow!("no export `new` found"))?;
+ .ok_or_else(|| wasmtime::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::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 31a5da2973..46563e6308 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,16 @@ const _: () = {
let new = {
let (item, index) = _component
.get_export(None, "new")
- .ok_or_else(|| anyhow::anyhow!("no export `new` found"))?;
+ .ok_or_else(|| wasmtime::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::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 1b5a4077ee..0b58744ef7 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 8bad79ba6b..4e23ad1741 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 9788455fc2..a5e3b741ac 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 768b4565a1..56c56073f6 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 d8b002493e..9498a81ccf 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::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::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 68f1477360..016aa0fc40 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::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::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 98e0a04f3d..aceff239d6 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<T>(
accessor: &wasmtime::component::Accessor<T, Self>,
@@ -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::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::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 a2976eb15e..15093f08d7 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::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::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 294b2a7e74..51800bae0f 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::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::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 4c3292e783..fdb896fdcd 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::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::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 9291504fae..13a868eba2 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::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::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 cf47e764cf..5dc0cfbd47 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::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::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 c934894ec5..1c18b77b25 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::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::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 bdb7301eb0..4d9700235c 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::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::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 3a35627bf5..32b4e7ab57 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::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::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 1fe25868ca..0e5049be7d 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::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::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 9414ffa0b4..cbef90e275 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::format_err!(
"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::format_err!(
"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::format_err!(
"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 3d5192e1c0..ab9291731c 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/[email protected]")
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"no exported instance named `my:dep/[email protected]`"
)
})?;
@@ -316,7 +314,7 @@ pub mod exports {
.component()
.get_export_index(Some(&instance), name)
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"instance export `my:dep/[email protected]` 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/[email protected]")
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"no exported instance named `my:dep/[email protected]`"
)
})?;
@@ -396,7 +394,7 @@ pub mod exports {
.component()
.get_export_index(Some(&instance), name)
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"instance export `my:dep/[email protected]` 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 03fe15c242..7774844f2b 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/[email protected]")
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"no exported instance named `my:dep/[email protected]`"
)
})?;
@@ -320,7 +318,7 @@ pub mod exports {
.component()
.get_export_index(Some(&instance), name)
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"instance export `my:dep/[email protected]` 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/[email protected]")
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"no exported instance named `my:dep/[email protected]`"
)
})?;
@@ -403,7 +401,7 @@ pub mod exports {
.component()
.get_export_index(Some(&instance), name)
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"instance export `my:dep/[email protected]` 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 0b3529e92c..0153166b6a 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<T>(
accessor: &wasmtime::component::Accessor<T, Self>,
@@ -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<T>(
accessor: &wasmtime::component::Accessor<T, Self>,
@@ -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/[email protected]")
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"no exported instance named `my:dep/[email protected]`"
)
})?;
@@ -308,7 +306,7 @@ pub mod exports {
.component()
.get_export_index(Some(&instance), name)
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"instance export `my:dep/[email protected]` 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/[email protected]")
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"no exported instance named `my:dep/[email protected]`"
)
})?;
@@ -391,7 +389,7 @@ pub mod exports {
.component()
.get_export_index(Some(&instance), name)
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"instance export `my:dep/[email protected]` 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 bab3788cde..3935f76f3c 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/[email protected]")
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"no exported instance named `my:dep/[email protected]`"
)
})?;
@@ -346,7 +344,7 @@ pub mod exports {
.component()
.get_export_index(Some(&instance), name)
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"instance export `my:dep/[email protected]` 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/[email protected]")
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"no exported instance named `my:dep/[email protected]`"
)
})?;
@@ -440,7 +438,7 @@ pub mod exports {
.component()
.get_export_index(Some(&instance), name)
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"instance export `my:dep/[email protected]` does \
not have export `{name}`"
)
diff --git a/crates/component-macro/tests/expanded/path1.rs b/crates/component-macro/tests/expanded/path1.rs
index 23b059eb7f..f0ac543157 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 f985453a30..a6de5e5469 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 f985453a30..a6de5e5469 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 f985453a30..a6de5e5469 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 597c2d702e..d399ee46de 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 5e456f30b1..a6d98f0564 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 5e456f30b1..a6d98f0564 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 5e456f30b1..a6d98f0564 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 4462a77430..0ad1a56b86 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::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::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 bd51cda2fb..d9864b7058 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::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::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 8839ca3f53..2c78b24500 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::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::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 b5c3d75c9a..9a45e17af3 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::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::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 7345a2013f..c0182645fd 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 c17861447a..87047d0661 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 52b004712e..5f036f6cdd 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 258c98c8c1..384b4cbaef 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 cc34bbf437..45f5d523e4 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::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::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::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::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::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::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::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::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 a7f9a84648..b76fe9a4db 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::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::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::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::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::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::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::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::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 a08a729331..c3d5ec53a8 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<T>(
@@ -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::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::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::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::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::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::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::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::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 49ad4526ce..d206775ffc 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::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::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::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::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::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::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::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::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 ff7fce1d5f..d1bee31e25 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,11 @@ const _: () = {
let (item, index) = _component
.get_export(None, "some-world-func2")
.ok_or_else(|| {
- anyhow::anyhow!("no export `some-world-func2` found")
+ wasmtime::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 +184,7 @@ const _: () = {
}
_ => {
Err(
- anyhow::anyhow!(
+ wasmtime::format_err!(
"export `some-world-func2` is not a function"
),
)?
@@ -377,7 +375,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 +934,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 +986,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 +1011,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 +1036,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 +1075,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 +1133,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 +1157,7 @@ pub mod exports {
.component()
.get_export_index(None, "foo:foo/uses-resource-transitively")
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"no exported instance named `foo:foo/uses-resource-transitively`"
)
})?;
@@ -1168,7 +1166,7 @@ pub mod exports {
.component()
.get_export_index(Some(&instance), name)
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::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 3ea8ce555c..4a05233865 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,11 @@ const _: () = {
let (item, index) = _component
.get_export(None, "some-world-func2")
.ok_or_else(|| {
- anyhow::anyhow!("no export `some-world-func2` found")
+ wasmtime::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 +206,7 @@ const _: () = {
}
_ => {
Err(
- anyhow::anyhow!(
+ wasmtime::format_err!(
"export `some-world-func2` is not a function"
),
)?
@@ -413,7 +411,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 +1101,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 +1158,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 +1183,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 +1208,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 +1257,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 +1320,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 +1344,7 @@ pub mod exports {
.component()
.get_export_index(None, "foo:foo/uses-resource-transitively")
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"no exported instance named `foo:foo/uses-resource-transitively`"
)
})?;
@@ -1355,7 +1353,7 @@ pub mod exports {
.component()
.get_export_index(Some(&instance), name)
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::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 4c40a6aa51..1ced3553c9 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,11 @@ const _: () = {
let (item, index) = _component
.get_export(None, "some-world-func2")
.ok_or_else(|| {
- anyhow::anyhow!("no export `some-world-func2` found")
+ wasmtime::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 +171,7 @@ const _: () = {
}
_ => {
Err(
- anyhow::anyhow!(
+ wasmtime::format_err!(
"export `some-world-func2` is not a function"
),
)?
@@ -384,7 +382,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<T>(
@@ -914,7 +912,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<T>(
@@ -963,7 +961,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 +986,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 +1011,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<T>(
@@ -1050,7 +1048,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<T>(
@@ -1105,7 +1103,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 +1127,7 @@ pub mod exports {
.component()
.get_export_index(None, "foo:foo/uses-resource-transitively")
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"no exported instance named `foo:foo/uses-resource-transitively`"
)
})?;
@@ -1138,7 +1136,7 @@ pub mod exports {
.component()
.get_export_index(Some(&instance), name)
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::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 1556124d3c..f8c847b39c 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,11 @@ const _: () = {
let (item, index) = _component
.get_export(None, "some-world-func2")
.ok_or_else(|| {
- anyhow::anyhow!("no export `some-world-func2` found")
+ wasmtime::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 +206,7 @@ const _: () = {
}
_ => {
Err(
- anyhow::anyhow!(
+ wasmtime::format_err!(
"export `some-world-func2` is not a function"
),
)?
@@ -476,7 +474,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 +1505,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 +1562,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 +1587,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 +1612,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 +1674,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 +1737,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 +1761,7 @@ pub mod exports {
.component()
.get_export_index(None, "foo:foo/uses-resource-transitively")
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::format_err!(
"no exported instance named `foo:foo/uses-resource-transitively`"
)
})?;
@@ -1772,7 +1770,7 @@ pub mod exports {
.component()
.get_export_index(Some(&instance), name)
.ok_or_else(|| {
- anyhow::anyhow!(
+ wasmtime::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 a71fac51f1..01de354735 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::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::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 f972dd9f87..40df5be0fe 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::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::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 663eb83db1..8d2d4e406b 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::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::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 0f6f82cecb..528b1bdfab 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::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::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 141b83ca37..b84b8ce9ae 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::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::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 974577688f..8d657a642a 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::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::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 a7d02c9ea4..bab73ac4a3 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<T>(
accessor: &wasmtime::component::Accessor<T, Self>,
@@ -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::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::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 b2c7c618bc..da8d87114b 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::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::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 044e325cea..4baa0f1e35 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::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::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 06afa4710a..45351a3270 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::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::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 a0ac716713..8eaf44b90c 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<T>(
accessor: &wasmtime::component::Accessor<T, Self>,
@@ -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::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::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 15f519a6cc..a4dd7f2c92 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::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::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 e03046174c..0a0ce4ea89 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 440730644b..be9f3ff57b 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 d4e08f880c..94cd4b0c7a 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 bb6257dd21..eb159e7c51 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 9b6cf457e8..b9fc3f1755 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::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::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 bd0df2997c..8eefe0a159 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::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::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 a14c649b96..c33b98a1f5 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::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::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 a0e22a4b26..b1af31909f 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::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::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 8339870717..9d963544c9 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,16 @@ const _: () = {
let y = {
let (item, index) = _component
.get_export(None, "y")
- .ok_or_else(|| anyhow::anyhow!("no export `y` found"))?;
+ .ok_or_else(|| wasmtime::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::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 13b4fc07bf..aac53efe63 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,16 @@ const _: () = {
let y = {
let (item, index) = _component
.get_export(None, "y")
- .ok_or_else(|| anyhow::anyhow!("no export `y` found"))?;
+ .ok_or_else(|| wasmtime::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::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 9e92a8d41a..277ea3beb8 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,16 @@ const _: () = {
let y = {
let (item, index) = _component
.get_export(None, "y")
- .ok_or_else(|| anyhow::anyhow!("no export `y` found"))?;
+ .ok_or_else(|| wasmtime::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::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 34da31174c..be3c62e52f 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,16 @@ const _: () = {
let y = {
let (item, index) = _component
.get_export(None, "y")
- .ok_or_else(|| anyhow::anyhow!("no export `y` found"))?;
+ .ok_or_else(|| wasmtime::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::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 5659486b29..258a037411 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,14 @@ pub mod exports {
.component()
.get_export_index(None, "the-name")
.ok_or_else(|| {
- anyhow::anyhow!("no exported instance named `the-name`")
+ wasmtime::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::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 f7838fe51e..e0ec6d94bf 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,14 @@ pub mod exports {
.component()
.get_export_index(None, "the-name")
.ok_or_else(|| {
- anyhow::anyhow!("no exported instance named `the-name`")
+ wasmtime::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::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 03a04b2de7..364941538c 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,14 @@ pub mod exports {
.component()
.get_export_index(None, "the-name")
.ok_or_else(|| {
- anyhow::anyhow!("no exported instance named `the-name`")
+ wasmtime::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::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 d40a07a0a8..2cd5f96758 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,14 @@ pub mod exports {
.component()
.get_export_index(None, "the-name")
.ok_or_else(|| {
- anyhow::anyhow!("no exported instance named `the-name`")
+ wasmtime::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::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 11017212a3..16be78927e 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 bffddae5cd..9bbe696320 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 28629475cc..db37d59b58 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<T>(
accessor: &wasmtime::component::Accessor<T, Self>,
diff --git a/crates/component-macro/tests/expanded/smoke_tracing_async.rs b/crates/component-macro/tests/expanded/smoke_tracing_async.rs
index 221f9b9bd0..a2158b6343 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 744f839aa4..c3abeab1c2 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::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::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 c3bca170bc..9c9b93d739 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::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::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 acf72fecc4..40ece95cc2 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<T>(
accessor: &wasmtime::component::Accessor<T, Self>,
@@ -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::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::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 4d63ddcf38..834bbfe78d 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::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::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 bec51d02ca..06efe9dbd9 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 9e3ad87967..1540f2a2cf 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 2badcc5024..10fa5d11c8 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 4b651cdcdc..49bcca5e20 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 c95d2985a2..f0cd89271b 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 38aea6b99e..b3cde77ae0 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 ffa5ca4fe3..1ec481afba 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 d64a48942b..3e8ebdac04 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 f4d3056806..d82f4e696d 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 83a377cfcb..aaeed11d00 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 5100a338b6..a275a676c1 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 bb5596886e..0a1b3de7e3 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 80895a1746..dc2572b7de 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::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::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 c4e4958b80..63fb6f5566 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::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::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 38f483c9e0..25e0b0d623 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::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::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 32677bd123..b3bd51ad46 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::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::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 007df70962..9eb5a50e79 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::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::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 007df70962..9eb5a50e79 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::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::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 007df70962..9eb5a50e79 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::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::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 007df70962..9eb5a50e79 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::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::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 02825fcbfe..851cbd9a20 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,16 @@ const _: () = {
let f = {
let (item, index) = _component
.get_export(None, "f")
- .ok_or_else(|| anyhow::anyhow!("no export `f` found"))?;
+ .ok_or_else(|| wasmtime::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::format_err!("export `f` is not a function"))?,
}
};
Ok(FooIndices { f })
@@ -239,7 +237,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 b0a8916631..e15c9de984 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,16 @@ const _: () = {
let f = {
let (item, index) = _component
.get_export(None, "f")
- .ok_or_else(|| anyhow::anyhow!("no export `f` found"))?;
+ .ok_or_else(|| wasmtime::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::format_err!("export `f` is not a function"))?,
}
};
Ok(FooIndices { f })
@@ -242,7 +240,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 29615ead42..98d25a64b2 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,16 @@ const _: () = {
let f = {
let (item, index) = _component
.get_export(None, "f")
- .ok_or_else(|| anyhow::anyhow!("no export `f` found"))?;
+ .ok_or_else(|| wasmtime::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::format_err!("export `f` is not a function"))?,
}
};
Ok(FooIndices { f })
@@ -242,7 +240,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 074dd6c1d6..6222f35d2e 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,16 @@ const _: () = {
let f = {
let (item, index) = _component
.get_export(None, "f")
- .ok_or_else(|| anyhow::anyhow!("no export `f` found"))?;
+ .ok_or_else(|| wasmtime::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::format_err!("export `f` is not a function"))?,
}
};
Ok(FooIndices { f })
@@ -250,7 +248,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 87636c9343..7657e1c57a 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 49e4b537c9..d4b4485d9d 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 6fcfe63957..a2092dabf9 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 ba1b1a7813..8d5d4cd9ac 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 e8245220b0..f5bf0f8b1e 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<T, anyhow::Error>`.
-///
-/// 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 203b5128cf..38f8a422da 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 622a9bc6ce..bfb24a68e3 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 c4d5812723..d53889a3d0 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<u8> = 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 d42e6aea0d..f4e084c69f 100644
--- a/crates/wasmtime/src/runtime/component/concurrent.rs
+++ b/crates/wasmtime/src/runtime/component/concurrent.rs
@@ -61,8 +61,11 @@ use crate::vm::component::{
CallContext, ComponentInstance, HandleTable, InstanceFlags, ResourceTables,
};
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 crate::{
+ AsContext, AsContextMut, FuncType, Result, StoreContext, StoreContextMut, ValRaw, ValType,
+ bail,
+ error::{Context as _, format_err},
+};
use error_contexts::GlobalErrorContextRefCount;
use futures::channel::oneshot;
use futures::future::{self, Either, FutureExt};
@@ -1031,8 +1034,8 @@ impl<T> StoreContextMut<'_, T> {
///
/// ```
/// # use {
- /// # anyhow::{Result},
/// # wasmtime::{
+ /// # error::{Result},
/// # component::{ Component, Linker, Resource, ResourceTable},
/// # Config, Engine, Store
/// # },
@@ -1214,7 +1217,7 @@ impl<T> StoreContextMut<'_, T> {
if trap_on_idle {
// `trap_on_idle` is true, so we exit
// immediately.
- Poll::Ready(Err(anyhow!(crate::Trap::AsyncDeadlock)))
+ Poll::Ready(Err(format_err!(crate::Trap::AsyncDeadlock)))
} else {
// `trap_on_idle` is false, so we assume
// that future will wake up and give us
@@ -1460,7 +1463,7 @@ impl StoreOpaque {
) -> Result<()> {
let state = self.instance_state(caller_instance);
let old = state.backpressure;
- let new = modify(old).ok_or_else(|| anyhow!("backpressure counter overflow"))?;
+ let new = modify(old).ok_or_else(|| format_err!("backpressure counter overflow"))?;
state.backpressure = new;
if old > 0 && new == 0 {
@@ -2736,7 +2739,7 @@ impl Instance {
.lift_result
.take()
.ok_or_else(|| {
- anyhow!("`task.return` or `task.cancel` called more than once for current task")
+ format_err!("`task.return` or `task.cancel` called more than once for current task")
})?;
assert!(state.get_mut(guest_thread.task)?.result.is_none());
@@ -2793,7 +2796,7 @@ impl Instance {
bail!("`task.cancel` called by task which has not been cancelled")
}
_ = task.lift_result.take().ok_or_else(|| {
- anyhow!("`task.return` or `task.cancel` called more than once for current task")
+ format_err!("`task.return` or `task.cancel` called more than once for current task")
})?;
assert!(task.result.is_none());
@@ -3079,7 +3082,7 @@ impl Instance {
let thread_id = store
.concurrent_state_mut()
.guest_thread
- .ok_or_else(|| anyhow!("no current thread"))?
+ .ok_or_else(|| format_err!("no current thread"))?
.thread;
// The unwrap is safe because `instance_rep` must be `Some` by this point
Ok(store
@@ -3108,7 +3111,7 @@ impl Instance {
let callee = instance
.index_runtime_func_table(registry, start_func_table_idx, start_func_idx as u64)?
.ok_or_else(|| {
- anyhow!("the start function index points to an uninitialized function")
+ format_err!("the start function index points to an uninitialized function")
})?;
if callee.type_index(store.0) != start_func_ty.type_index() {
bail!(
@@ -5214,7 +5217,7 @@ pub(crate) fn queue_call<T: 'static, R: Send + 'static>(
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 f29193bbe8..c14e74dd5b 100644
--- a/crates/wasmtime/src/runtime/component/concurrent/future_stream_any.rs
+++ b/crates/wasmtime/src/runtime/component/concurrent/future_stream_any.rs
@@ -1,6 +1,5 @@
//! Implementation of [`FutureAny`] and [`StreamAny`].
-use crate::AsContextMut;
use crate::component::concurrent::futures_and_streams::{self, TransmitOrigin};
use crate::component::concurrent::{TableId, TransmitHandle};
use crate::component::func::{LiftContext, LowerContext, bad_type_info, desc};
@@ -10,7 +9,7 @@ use crate::component::{
ComponentInstanceId, ComponentType, FutureReader, Lift, Lower, StreamReader,
};
use crate::store::StoreOpaque;
-use anyhow::{Context, Result, bail};
+use crate::{AsContextMut, Result, bail, error::Context};
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 9f59bb8992..913e43d393 100644
--- a/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs
+++ b/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs
@@ -13,7 +13,10 @@ 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 crate::{
+ Error, Result, bail,
+ error::{Context as _, format_err},
+};
use buffers::{Extender, SliceBuffer, UntypedWriteBuffer};
use core::fmt;
use core::future;
@@ -160,7 +163,7 @@ fn lower<T: func::Lower + Send + 'static, B: WriteBuffer<T>, 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 +197,7 @@ fn lift<T: func::Lift + Send + 'static, B: ReadBuffer<T>>(
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))?
@@ -2451,7 +2454,7 @@ impl<T> StoreContextMut<'_, T> {
|| *guest_offset > 0
|| host_offset > 0
{
- return Poll::Ready(Err(anyhow!(
+ return Poll::Ready(Err(format_err!(
"StreamProducer::poll_produce returned Poll::Pending \
after producing at least one item"
)));
@@ -2715,7 +2718,7 @@ impl<T> 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 +2766,7 @@ async fn write<D: 'static, P: Send + 'static, T: func::Lower + 'static, B: Write
None
};
- anyhow::Ok((
+ crate::error::Ok((
mem::replace(&mut transmit.read, ReadState::Open),
guest_offset,
))
@@ -2785,7 +2788,7 @@ async fn write<D: 'static, P: Send + 'static, T: func::Lower + 'static, B: Write
if let TransmitKind::Future = kind {
tls::get(|store| {
store.concurrent_state_mut().get_mut(id)?.done = true;
- anyhow::Ok(())
+ crate::error::Ok(())
})?;
}
@@ -2802,7 +2805,7 @@ async fn write<D: 'static, P: Send + 'static, T: func::Lower + 'static, B: Write
count - guest_offset,
&mut pair.lock().unwrap().as_mut().unwrap().1,
)?;
- anyhow::Ok(())
+ crate::error::Ok(())
}
};
@@ -2856,7 +2859,7 @@ async fn write<D: 'static, P: Send + 'static, T: func::Lower + 'static, B: Write
caller,
};
- anyhow::Ok(())
+ crate::error::Ok(())
})?;
Ok(())
@@ -2896,7 +2899,7 @@ async fn write<D: 'static, P: Send + 'static, T: func::Lower + 'static, B: Write
},
};
- anyhow::Ok(())
+ crate::error::Ok(())
})?;
Ok(())
}
@@ -3010,7 +3013,7 @@ impl Instance {
TransmitIndex::Future(_) => store.host_drop_writer(
id,
Some(|| {
- Err(anyhow!(
+ Err(format_err!(
"cannot drop future write end without first writing a value"
))
}),
@@ -3064,7 +3067,7 @@ impl Instance {
.get(write_address..)
.and_then(|b| b.get(..usize::try_from(abi.size32).unwrap()))
.ok_or_else(|| {
- anyhow::anyhow!("write pointer out of bounds of memory")
+ crate::format_err!("write pointer out of bounds of memory")
})?;
Val::load(lift, ty, bytes)
@@ -3111,7 +3114,7 @@ impl Instance {
.get(write_address..)
.and_then(|b| b.get(..length_in_bytes))
.ok_or_else(|| {
- anyhow::anyhow!("write pointer out of bounds of memory")
+ crate::format_err!("write pointer out of bounds of memory")
})?
.as_ptr();
let dst = self
@@ -3119,7 +3122,7 @@ impl Instance {
.get_mut(read_address..)
.and_then(|b| b.get_mut(..length_in_bytes))
.ok_or_else(|| {
- anyhow::anyhow!("read pointer out of bounds of memory")
+ crate::format_err!("read pointer out of bounds of memory")
})?
.as_mut_ptr();
// SAFETY: Both `src` and `dst` have been validated
@@ -3153,7 +3156,9 @@ impl Instance {
.memory()
.get(write_address..)
.and_then(|b| b.get(..size * 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 values = (0..count)
.map(|index| Val::load(lift, ty, &bytes[(index * size)..][..size]))
@@ -3173,7 +3178,9 @@ impl Instance {
.as_slice_mut()
.get_mut(read_address..)
.and_then(|b| b.get_mut(..size * 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")
+ })?;
let mut ptr = read_address;
for value in values {
value.store(lower, ty, ptr)?;
@@ -3214,7 +3221,7 @@ impl Instance {
.get(address..)
.and_then(|b| b.get(..(size * count)))
.map(drop)
- .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"))
} else {
Ok(())
}
@@ -4023,7 +4030,7 @@ impl Instance {
.get(debug_msg_address..)
.and_then(|b| b.get(..debug_msg.bytes().len()))
.map(|_| debug_msg_address)
- .ok_or_else(|| anyhow::anyhow!("invalid debug message pointer: out of bounds"))?;
+ .ok_or_else(|| crate::format_err!("invalid debug message pointer: out of bounds"))?;
debug_msg
.as_str()
.linear_lower_to_memory(lower_cx, InterfaceType::String, offset)?;
@@ -4592,13 +4599,13 @@ mod tests {
#[test]
fn future_producer() {
- let mut fut = pin!(async { anyhow::Ok(()) });
+ let mut fut = pin!(async { crate::error::Ok(()) });
assert!(matches!(
poll_future_producer(fut.as_mut(), false),
Poll::Ready(Ok(Some(()))),
));
- let mut fut = pin!(async { anyhow::Ok(()) });
+ let mut fut = pin!(async { crate::error::Ok(()) });
assert!(matches!(
poll_future_producer(fut.as_mut(), true),
Poll::Ready(Ok(Some(()))),
diff --git a/crates/wasmtime/src/runtime/component/concurrent_disabled.rs b/crates/wasmtime/src/runtime/component/concurrent_disabled.rs
index 4cc35f93f4..68f58ec5f9 100644
--- a/crates/wasmtime/src/runtime/component/concurrent_disabled.rs
+++ b/crates/wasmtime/src/runtime/component/concurrent_disabled.rs
@@ -2,7 +2,7 @@ use crate::component::func::{LiftContext, LowerContext};
use crate::component::matching::InstanceType;
use crate::component::{ComponentType, Lift, Lower, Val};
use crate::runtime::vm::VMStore;
-use anyhow::{Result, anyhow, bail};
+use crate::{Result, bail, error::format_err};
use core::convert::Infallible;
use core::mem::MaybeUninit;
use wasmtime_environ::component::{CanonicalAbiInfo, InterfaceType};
@@ -13,7 +13,7 @@ pub struct ConcurrentState;
fn should_have_failed_validation<T>(what: &str) -> Result<T> {
// This should be unreachable; if we trap here, it indicates a
// bug in Wasmtime rather than in the guest.
- Err(anyhow!(
+ Err(format_err!(
"{what} should have failed validation \
when `component-model-async` feature disabled"
))
diff --git a/crates/wasmtime/src/runtime/component/func.rs b/crates/wasmtime/src/runtime/component/func.rs
index 4b2ead4645..fb9d3138bf 100644
--- a/crates/wasmtime/src/runtime/component/func.rs
+++ b/crates/wasmtime/src/runtime/component/func.rs
@@ -8,7 +8,6 @@ use crate::runtime::vm::component::{ComponentInstance, InstanceFlags, ResourceTa
use crate::runtime::vm::{Export, VMFuncRef};
use crate::store::StoreOpaque;
use crate::{AsContext, AsContextMut, StoreContextMut, ValRaw};
-use anyhow::Context as _;
use core::mem::{self, MaybeUninit};
use core::ptr::NonNull;
use wasmtime_environ::component::{
@@ -103,7 +102,7 @@ impl Func {
/// ```
/// # use wasmtime::component::Func;
/// # use wasmtime::Store;
- /// # fn foo(func: &Func, store: &mut Store<()>) -> 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 dceddd3285..ee3a46c187 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 43fb2c7ea6..12ab9c4313 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 279038f383..343b331bcc 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 54434005a2..948fc8e51f 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<T>(
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<T>(&self) -> anyhow::Result<()>
+ pub(crate) fn equivalent_payload_host<T>(&self) -> crate::Result<()>
where
T: ComponentType,
{
@@ -646,7 +646,7 @@ impl StreamType {
}
#[cfg(feature = "component-model-async")]
- pub(crate) fn equivalent_payload_host<T>(&self) -> anyhow::Result<()>
+ pub(crate) fn equivalent_payload_host<T>(&self) -> crate::Result<()>
where
T: ComponentType,
{
@@ -924,7 +924,7 @@ impl ComponentFunc {
}
#[doc(hidden)]
- pub fn typecheck<Params, Return>(&self, cx: &InstanceType) -> anyhow::Result<()>
+ pub fn typecheck<Params, Return>(&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 0215ea504e..43a4335c12 100644
--- a/crates/wasmtime/src/runtime/component/values.rs
+++ b/crates/wasmtime/src/runtime/component/values.rs
@@ -1015,7 +1015,7 @@ fn lower_list<T>(
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<Vec<u32>> {
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<Vec<u32>> {
fn get_enum_discriminant(ty: &TypeEnum, n: &str) -> Result<u32> {
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 c62b316d9e..38bf793f14 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 5cc329b8ab..3138465ae0 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<ExnRef>),
@@ -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 c32568e34e..69b2cf78ea 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 88daa9c326..d10c0cbecb 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 7d524184e8..bca5c3200d 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 1ab5120ef3..f7aa94c081 100644
--- a/crates/wasmtime/src/runtime/fiber.rs
+++ b/crates/wasmtime/src/runtime/fiber.rs
@@ -3,7 +3,6 @@ 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;
@@ -421,7 +420,7 @@ impl<'a> StoreFiber<'a> {
pub(crate) fn dispose(&mut self, store: &mut StoreOpaque) {
if let Some(fiber) = self.fiber() {
if !fiber.done() {
- let result = resume_fiber(store, self, Err(anyhow!("future dropped")));
+ let result = resume_fiber(store, self, Err(format_err!("future dropped")));
debug_assert!(result.is_ok());
}
}
diff --git a/crates/wasmtime/src/runtime/func.rs b/crates/wasmtime/src/runtime/func.rs
index 5dc48488be..ae4ec58da3 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<T>`](anyhow::Result). Returning `Ok(t)` represents the host
+ /// [`Result<T>`](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<T> 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<T> 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<T> 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 26f7fcb281..657f7f96ad 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<bool>;
/// 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<bool>;
/// 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 377f3a606c..a04a4b6dbc 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<T> Linker<T> {
///
/// ```
/// # 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<T> Linker<T> {
///
/// ```
/// # 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<T> Linker<T> {
///
/// ```
/// # 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<T> Linker<T> {
/// # 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<T> Linker<T> {
///
/// ```
/// # 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<T> Linker<T> {
&mut self,
mut store: impl AsContextMut<Data = T>,
module: &Module,
- ) -> anyhow::Result<()>
+ ) -> Result<()>
where
T: 'static,
{
@@ -324,7 +324,7 @@ impl<T> Linker<T> {
///
/// ```
/// # 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<T> Linker<T> {
///
/// ```
/// # 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<T> Linker<T> {
///
/// ```
/// # 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<T> Linker<T> {
///
/// ```
/// # 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<T> Linker<T> {
///
/// ```
/// # 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<T> Linker<T> {
///
/// ```
/// # 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<T> Linker<T> {
///
/// ```
/// # 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 6ec6fef44a..64f4897a00 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 82bf6eab50..28231d82e5 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<u8> = 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<u8> = 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<u8> = 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 e7d5bce632..ad86cf158b 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<usize>) {
#[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 6baac6064a..30234e32bc 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 aae8397212..f41c401daf 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<u64> {
- 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<u64>) -> 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<T> VMStore for StoreInner<T> {
}
#[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 5ef0a6ddf2..6c3099d59a 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 9b91d7eadf..e9a1c5ca2c 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<HostPtr>) -> 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 fbe103cb2d..d0c3fa95b6 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<T>`](anyhow::Result) which is an alias for [`Result<T,
-/// anyhow::Error>`](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<T>`](crate::Result) which is an alias for [`Result<T,
+/// wasmtime::Error>`](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 e9431c75da..49ffc3c67f 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 b92135785e..c4c6ffe017 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 15aa627b8b..af0b86d32a 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 2eb24859f7..cbdfa25876 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<Option<&Arc<MemoryImage>>> {
+ fn memory_image(&self, memory: DefinedMemoryIndex) -> crate::Result<Option<&Arc<MemoryImage>>> {
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 a75bbb3036..a10db5053a 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 60ce64793c..7f451f4ed3 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::{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 5d6f525f8a..d700497df4 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 9d227f04d2..7d0fb7c877 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 a8ecfea074..74333e5683 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 cbcfec3dfc..d3015c70c1 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<wasmtime_fiber::FiberStack> {
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 f785655895..c191580b37 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 7fe172f172..9e2f74e8b0 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 5900cb3104..5e779d43ac 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 a96c896ae1..d46e607e62 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 831a60e8d3..9138aca735 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 e2b977c157..5d364da7fd 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<Self> {
- 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<Self> {
- 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 2b4bc8bdcd..bc2ff78d8b 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<File> {
- 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<Self> {
- 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 477a1309f5..9ff73a8ecb 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 237b8d9b28..8ffac0d796 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<Option<MemoryImageSource>> {
+ pub fn from_data(data: &[u8]) -> crate::Result<Option<MemoryImageSource>> {
// 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 dce3caabd0..d03232f962 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 621a089fde..a4a9cd8dab 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}::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}::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}::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}::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,