Coverage Report

Created: 2025-07-23 06:18

/rust/registry/src/index.crates.io-6f17d22bba15001f/anyhow-1.0.58/src/error.rs
Line
Count
Source (jump to first uncovered line)
1
use crate::backtrace::Backtrace;
2
use crate::chain::Chain;
3
#[cfg(any(feature = "std", anyhow_no_ptr_addr_of))]
4
use crate::ptr::Mut;
5
use crate::ptr::{Own, Ref};
6
use crate::{Error, StdError};
7
use alloc::boxed::Box;
8
use core::any::TypeId;
9
use core::fmt::{self, Debug, Display};
10
use core::mem::ManuallyDrop;
11
#[cfg(not(anyhow_no_ptr_addr_of))]
12
use core::ptr;
13
use core::ptr::NonNull;
14
15
#[cfg(feature = "std")]
16
use core::ops::{Deref, DerefMut};
17
18
impl Error {
19
    /// Create a new error object from any error type.
20
    ///
21
    /// The error type must be threadsafe and `'static`, so that the `Error`
22
    /// will be as well.
23
    ///
24
    /// If the error type does not provide a backtrace, a backtrace will be
25
    /// created here to ensure that a backtrace exists.
26
    #[cfg(feature = "std")]
27
    #[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
28
    #[cold]
29
    #[must_use]
30
0
    pub fn new<E>(error: E) -> Self
31
0
    where
32
0
        E: StdError + Send + Sync + 'static,
33
0
    {
34
0
        let backtrace = backtrace_if_absent!(error);
35
0
        Error::from_std(error, backtrace)
36
0
    }
Unexecuted instantiation: <anyhow::Error>::new::<devices::virtio::vhost::user::device::handler::Error>
Unexecuted instantiation: <anyhow::Error>::new::<core::num::error::TryFromIntError>
Unexecuted instantiation: <anyhow::Error>::new::<core::str::error::Utf8Error>
Unexecuted instantiation: <anyhow::Error>::new::<std::io::error::Error>
Unexecuted instantiation: <anyhow::Error>::new::<_>
37
38
    /// Create a new error object from a printable error message.
39
    ///
40
    /// If the argument implements std::error::Error, prefer `Error::new`
41
    /// instead which preserves the underlying error's cause chain and
42
    /// backtrace. If the argument may or may not implement std::error::Error
43
    /// now or in the future, use `anyhow!(err)` which handles either way
44
    /// correctly.
45
    ///
46
    /// `Error::msg("...")` is equivalent to `anyhow!("...")` but occasionally
47
    /// convenient in places where a function is preferable over a macro, such
48
    /// as iterator or stream combinators:
49
    ///
50
    /// ```
51
    /// # mod ffi {
52
    /// #     pub struct Input;
53
    /// #     pub struct Output;
54
    /// #     pub async fn do_some_work(_: Input) -> Result<Output, &'static str> {
55
    /// #         unimplemented!()
56
    /// #     }
57
    /// # }
58
    /// #
59
    /// # use ffi::{Input, Output};
60
    /// #
61
    /// use anyhow::{Error, Result};
62
    /// use futures::stream::{Stream, StreamExt, TryStreamExt};
63
    ///
64
    /// async fn demo<S>(stream: S) -> Result<Vec<Output>>
65
    /// where
66
    ///     S: Stream<Item = Input>,
67
    /// {
68
    ///     stream
69
    ///         .then(ffi::do_some_work) // returns Result<Output, &str>
70
    ///         .map_err(Error::msg)
71
    ///         .try_collect()
72
    ///         .await
73
    /// }
74
    /// ```
75
    #[cold]
76
    #[must_use]
77
376
    pub fn msg<M>(message: M) -> Self
78
376
    where
79
376
        M: Display + Debug + Send + Sync + 'static,
80
376
    {
81
376
        Error::from_adhoc(message, backtrace!())
82
376
    }
Unexecuted instantiation: <anyhow::Error>::msg::<alloc::ffi::c_str::NulError>
<anyhow::Error>::msg::<alloc::string::String>
Line
Count
Source
77
339
    pub fn msg<M>(message: M) -> Self
78
339
    where
79
339
        M: Display + Debug + Send + Sync + 'static,
80
339
    {
81
339
        Error::from_adhoc(message, backtrace!())
82
339
    }
<anyhow::Error>::msg::<&str>
Line
Count
Source
77
37
    pub fn msg<M>(message: M) -> Self
78
37
    where
79
37
        M: Display + Debug + Send + Sync + 'static,
80
37
    {
81
37
        Error::from_adhoc(message, backtrace!())
82
37
    }
83
84
    #[cfg(feature = "std")]
85
    #[cold]
86
0
    pub(crate) fn from_std<E>(error: E, backtrace: Option<Backtrace>) -> Self
87
0
    where
88
0
        E: StdError + Send + Sync + 'static,
89
0
    {
90
0
        let vtable = &ErrorVTable {
91
0
            object_drop: object_drop::<E>,
92
0
            object_ref: object_ref::<E>,
93
0
            #[cfg(anyhow_no_ptr_addr_of)]
94
0
            object_mut: object_mut::<E>,
95
0
            object_boxed: object_boxed::<E>,
96
0
            object_downcast: object_downcast::<E>,
97
0
            #[cfg(anyhow_no_ptr_addr_of)]
98
0
            object_downcast_mut: object_downcast_mut::<E>,
99
0
            object_drop_rest: object_drop_front::<E>,
100
0
            #[cfg(all(not(backtrace), feature = "backtrace"))]
101
0
            object_backtrace: no_backtrace,
102
0
        };
103
0
104
0
        // Safety: passing vtable that operates on the right type E.
105
0
        unsafe { Error::construct(error, vtable, backtrace) }
106
0
    }
Unexecuted instantiation: <anyhow::Error>::from_std::<ciborium::de::error::Error<std::io::error::Error>>
Unexecuted instantiation: <anyhow::Error>::from_std::<ciborium::ser::error::Error<std::io::error::Error>>
Unexecuted instantiation: <anyhow::Error>::from_std::<vhost::Error>
Unexecuted instantiation: <anyhow::Error>::from_std::<vmm_vhost::Error>
Unexecuted instantiation: <anyhow::Error>::from_std::<devices::serial_device::Error>
Unexecuted instantiation: <anyhow::Error>::from_std::<cros_async::io_ext::AsyncError>
Unexecuted instantiation: <anyhow::Error>::from_std::<base::tube::Error>
Unexecuted instantiation: <anyhow::Error>::from_std::<devices::pci::pci_device::Error>
Unexecuted instantiation: <anyhow::Error>::from_std::<devices::pci::msix::MsixError>
Unexecuted instantiation: <anyhow::Error>::from_std::<devices::virtio::vhost::Error>
Unexecuted instantiation: <anyhow::Error>::from_std::<devices::irqchip::ioapic::IoapicError>
Unexecuted instantiation: <anyhow::Error>::from_std::<devices::virtio::vhost_user_frontend::error::Error>
Unexecuted instantiation: <anyhow::Error>::from_std::<devices::virtio::vhost::user::device::handler::Error>
Unexecuted instantiation: <anyhow::Error>::from_std::<minijail::Error>
Unexecuted instantiation: <anyhow::Error>::from_std::<base::errno::Error>
Unexecuted instantiation: <anyhow::Error>::from_std::<core::num::error::TryFromIntError>
Unexecuted instantiation: <anyhow::Error>::from_std::<core::str::error::Utf8Error>
Unexecuted instantiation: <anyhow::Error>::from_std::<std::io::error::Error>
Unexecuted instantiation: <anyhow::Error>::from_std::<ciborium::value::error::Error>
Unexecuted instantiation: <anyhow::Error>::from_std::<base::mmap::Error>
Unexecuted instantiation: <anyhow::Error>::from_std::<base::errno::Error>
Unexecuted instantiation: <anyhow::Error>::from_std::<std::io::error::Error>
Unexecuted instantiation: <anyhow::Error>::from_std::<_>
107
108
    #[cold]
109
376
    pub(crate) fn from_adhoc<M>(message: M, backtrace: Option<Backtrace>) -> Self
110
376
    where
111
376
        M: Display + Debug + Send + Sync + 'static,
112
376
    {
113
        use crate::wrapper::MessageError;
114
376
        let error: MessageError<M> = MessageError(message);
115
376
        let vtable = &ErrorVTable {
116
376
            object_drop: object_drop::<MessageError<M>>,
117
376
            object_ref: object_ref::<MessageError<M>>,
118
376
            #[cfg(all(feature = "std", anyhow_no_ptr_addr_of))]
119
376
            object_mut: object_mut::<MessageError<M>>,
120
376
            object_boxed: object_boxed::<MessageError<M>>,
121
376
            object_downcast: object_downcast::<M>,
122
376
            #[cfg(anyhow_no_ptr_addr_of)]
123
376
            object_downcast_mut: object_downcast_mut::<M>,
124
376
            object_drop_rest: object_drop_front::<M>,
125
376
            #[cfg(all(not(backtrace), feature = "backtrace"))]
126
376
            object_backtrace: no_backtrace,
127
376
        };
128
376
129
376
        // Safety: MessageError is repr(transparent) so it is okay for the
130
376
        // vtable to allow casting the MessageError<M> to M.
131
376
        unsafe { Error::construct(error, vtable, backtrace) }
132
376
    }
Unexecuted instantiation: <anyhow::Error>::from_adhoc::<alloc::ffi::c_str::NulError>
<anyhow::Error>::from_adhoc::<alloc::string::String>
Line
Count
Source
109
339
    pub(crate) fn from_adhoc<M>(message: M, backtrace: Option<Backtrace>) -> Self
110
339
    where
111
339
        M: Display + Debug + Send + Sync + 'static,
112
339
    {
113
        use crate::wrapper::MessageError;
114
339
        let error: MessageError<M> = MessageError(message);
115
339
        let vtable = &ErrorVTable {
116
339
            object_drop: object_drop::<MessageError<M>>,
117
339
            object_ref: object_ref::<MessageError<M>>,
118
339
            #[cfg(all(feature = "std", anyhow_no_ptr_addr_of))]
119
339
            object_mut: object_mut::<MessageError<M>>,
120
339
            object_boxed: object_boxed::<MessageError<M>>,
121
339
            object_downcast: object_downcast::<M>,
122
339
            #[cfg(anyhow_no_ptr_addr_of)]
123
339
            object_downcast_mut: object_downcast_mut::<M>,
124
339
            object_drop_rest: object_drop_front::<M>,
125
339
            #[cfg(all(not(backtrace), feature = "backtrace"))]
126
339
            object_backtrace: no_backtrace,
127
339
        };
128
339
129
339
        // Safety: MessageError is repr(transparent) so it is okay for the
130
339
        // vtable to allow casting the MessageError<M> to M.
131
339
        unsafe { Error::construct(error, vtable, backtrace) }
132
339
    }
<anyhow::Error>::from_adhoc::<&str>
Line
Count
Source
109
37
    pub(crate) fn from_adhoc<M>(message: M, backtrace: Option<Backtrace>) -> Self
110
37
    where
111
37
        M: Display + Debug + Send + Sync + 'static,
112
37
    {
113
        use crate::wrapper::MessageError;
114
37
        let error: MessageError<M> = MessageError(message);
115
37
        let vtable = &ErrorVTable {
116
37
            object_drop: object_drop::<MessageError<M>>,
117
37
            object_ref: object_ref::<MessageError<M>>,
118
37
            #[cfg(all(feature = "std", anyhow_no_ptr_addr_of))]
119
37
            object_mut: object_mut::<MessageError<M>>,
120
37
            object_boxed: object_boxed::<MessageError<M>>,
121
37
            object_downcast: object_downcast::<M>,
122
37
            #[cfg(anyhow_no_ptr_addr_of)]
123
37
            object_downcast_mut: object_downcast_mut::<M>,
124
37
            object_drop_rest: object_drop_front::<M>,
125
37
            #[cfg(all(not(backtrace), feature = "backtrace"))]
126
37
            object_backtrace: no_backtrace,
127
37
        };
128
37
129
37
        // Safety: MessageError is repr(transparent) so it is okay for the
130
37
        // vtable to allow casting the MessageError<M> to M.
131
37
        unsafe { Error::construct(error, vtable, backtrace) }
132
37
    }
133
134
    #[cold]
135
0
    pub(crate) fn from_display<M>(message: M, backtrace: Option<Backtrace>) -> Self
136
0
    where
137
0
        M: Display + Send + Sync + 'static,
138
0
    {
139
        use crate::wrapper::DisplayError;
140
0
        let error: DisplayError<M> = DisplayError(message);
141
0
        let vtable = &ErrorVTable {
142
0
            object_drop: object_drop::<DisplayError<M>>,
143
0
            object_ref: object_ref::<DisplayError<M>>,
144
0
            #[cfg(all(feature = "std", anyhow_no_ptr_addr_of))]
145
0
            object_mut: object_mut::<DisplayError<M>>,
146
0
            object_boxed: object_boxed::<DisplayError<M>>,
147
0
            object_downcast: object_downcast::<M>,
148
0
            #[cfg(anyhow_no_ptr_addr_of)]
149
0
            object_downcast_mut: object_downcast_mut::<M>,
150
0
            object_drop_rest: object_drop_front::<M>,
151
0
            #[cfg(all(not(backtrace), feature = "backtrace"))]
152
0
            object_backtrace: no_backtrace,
153
0
        };
154
0
155
0
        // Safety: DisplayError is repr(transparent) so it is okay for the
156
0
        // vtable to allow casting the DisplayError<M> to M.
157
0
        unsafe { Error::construct(error, vtable, backtrace) }
158
0
    }
Unexecuted instantiation: <anyhow::Error>::from_display::<alloc::string::String>
Unexecuted instantiation: <anyhow::Error>::from_display::<&str>
Unexecuted instantiation: <anyhow::Error>::from_display::<_>
159
160
    #[cfg(feature = "std")]
161
    #[cold]
162
0
    pub(crate) fn from_context<C, E>(context: C, error: E, backtrace: Option<Backtrace>) -> Self
163
0
    where
164
0
        C: Display + Send + Sync + 'static,
165
0
        E: StdError + Send + Sync + 'static,
166
0
    {
167
0
        let error: ContextError<C, E> = ContextError { context, error };
168
0
169
0
        let vtable = &ErrorVTable {
170
0
            object_drop: object_drop::<ContextError<C, E>>,
171
0
            object_ref: object_ref::<ContextError<C, E>>,
172
0
            #[cfg(anyhow_no_ptr_addr_of)]
173
0
            object_mut: object_mut::<ContextError<C, E>>,
174
0
            object_boxed: object_boxed::<ContextError<C, E>>,
175
0
            object_downcast: context_downcast::<C, E>,
176
0
            #[cfg(anyhow_no_ptr_addr_of)]
177
0
            object_downcast_mut: context_downcast_mut::<C, E>,
178
0
            object_drop_rest: context_drop_rest::<C, E>,
179
0
            #[cfg(all(not(backtrace), feature = "backtrace"))]
180
0
            object_backtrace: no_backtrace,
181
0
        };
182
0
183
0
        // Safety: passing vtable that operates on the right type.
184
0
        unsafe { Error::construct(error, vtable, backtrace) }
185
0
    }
Unexecuted instantiation: <anyhow::Error>::from_context::<alloc::string::String, vm_memory::guest_memory::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<alloc::string::String, base::tube::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<alloc::string::String, base::errno::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<devices::pci::coiommu::Error, vm_memory::guest_memory::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<devices::pci::coiommu::Error, base::errno::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, ciborium::de::error::Error<std::io::error::Error>>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, ciborium::ser::error::Error<std::io::error::Error>>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, std::sync::mpsc::SendError<devices::virtio::console::worker::WorkerRequest>>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, vhost::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, resources::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, vmm_vhost::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, disk::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, devices::pit::PitError>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, devices::vfio::VfioError>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, vm_memory::guest_memory::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, cros_async::io_ext::AsyncError>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, vm_control::api::ApiClientError>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, std::time::SystemTimeError>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, base::mmap::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, devices::pci::pci_device::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, devices::virtio::iommu::IommuError>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, devices::irqchip::ioapic::IoapicError>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, devices::irqchip::userspace::TimerWorkerError>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, std::sync::mpsc::RecvError>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, devices::virtio::vhost_user_frontend::error::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, devices::virtio::block::asynchronous::ControlError>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, devices::virtio::block::asynchronous::ExecuteError>
Unexecuted instantiation: <anyhow::Error>::from_context::<alloc::string::String, minijail::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, minijail::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<alloc::string::String, rutabaga_gfx::rutabaga_utils::RutabagaError>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, base::tube::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<alloc::string::String, serde_json::error::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<alloc::string::String, std::io::error::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind, std::io::error::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, base::errno::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<alloc::string::String, std::io::error::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<&str, std::io::error::Error>
Unexecuted instantiation: <anyhow::Error>::from_context::<_, _>
186
187
    #[cfg(feature = "std")]
188
    #[cold]
189
0
    pub(crate) fn from_boxed(
190
0
        error: Box<dyn StdError + Send + Sync>,
191
0
        backtrace: Option<Backtrace>,
192
0
    ) -> Self {
193
        use crate::wrapper::BoxedError;
194
0
        let error = BoxedError(error);
195
0
        let vtable = &ErrorVTable {
196
0
            object_drop: object_drop::<BoxedError>,
197
0
            object_ref: object_ref::<BoxedError>,
198
0
            #[cfg(anyhow_no_ptr_addr_of)]
199
0
            object_mut: object_mut::<BoxedError>,
200
0
            object_boxed: object_boxed::<BoxedError>,
201
0
            object_downcast: object_downcast::<Box<dyn StdError + Send + Sync>>,
202
0
            #[cfg(anyhow_no_ptr_addr_of)]
203
0
            object_downcast_mut: object_downcast_mut::<Box<dyn StdError + Send + Sync>>,
204
0
            object_drop_rest: object_drop_front::<Box<dyn StdError + Send + Sync>>,
205
0
            #[cfg(all(not(backtrace), feature = "backtrace"))]
206
0
            object_backtrace: no_backtrace,
207
0
        };
208
0
209
0
        // Safety: BoxedError is repr(transparent) so it is okay for the vtable
210
0
        // to allow casting to Box<dyn StdError + Send + Sync>.
211
0
        unsafe { Error::construct(error, vtable, backtrace) }
212
0
    }
213
214
    // Takes backtrace as argument rather than capturing it here so that the
215
    // user sees one fewer layer of wrapping noise in the backtrace.
216
    //
217
    // Unsafe because the given vtable must have sensible behavior on the error
218
    // value of type E.
219
    #[cold]
220
632
    unsafe fn construct<E>(
221
632
        error: E,
222
632
        vtable: &'static ErrorVTable,
223
632
        backtrace: Option<Backtrace>,
224
632
    ) -> Self
225
632
    where
226
632
        E: StdError + Send + Sync + 'static,
227
632
    {
228
632
        let inner: Box<ErrorImpl<E>> = Box::new(ErrorImpl {
229
632
            vtable,
230
632
            backtrace,
231
632
            _object: error,
232
632
        });
233
632
        // Erase the concrete type of E from the compile-time type system. This
234
632
        // is equivalent to the safe unsize coercion from Box<ErrorImpl<E>> to
235
632
        // Box<ErrorImpl<dyn StdError + Send + Sync + 'static>> except that the
236
632
        // result is a thin pointer. The necessary behavior for manipulating the
237
632
        // underlying ErrorImpl<E> is preserved in the vtable provided by the
238
632
        // caller rather than a builtin fat pointer vtable.
239
632
        let inner = Own::new(inner).cast::<ErrorImpl>();
240
632
        Error { inner }
241
632
    }
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<alloc::string::String, vm_memory::guest_memory::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<alloc::string::String, base::tube::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<alloc::string::String, base::errno::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<devices::pci::coiommu::Error, vm_memory::guest_memory::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<devices::pci::coiommu::Error, base::errno::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, ciborium::de::error::Error<std::io::error::Error>>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, ciborium::ser::error::Error<std::io::error::Error>>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, std::sync::mpsc::SendError<devices::virtio::console::worker::WorkerRequest>>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, vhost::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, resources::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, vmm_vhost::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, disk::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, devices::pit::PitError>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, devices::vfio::VfioError>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, vm_memory::guest_memory::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, cros_async::io_ext::AsyncError>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, vm_control::api::ApiClientError>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, std::time::SystemTimeError>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, base::mmap::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, devices::pci::pci_device::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, devices::virtio::iommu::IommuError>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, devices::irqchip::ioapic::IoapicError>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, devices::irqchip::userspace::TimerWorkerError>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, std::sync::mpsc::RecvError>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, devices::virtio::vhost_user_frontend::error::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, devices::virtio::block::asynchronous::ControlError>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, devices::virtio::block::asynchronous::ExecuteError>>
Unexecuted instantiation: <anyhow::Error>::construct::<ciborium::de::error::Error<std::io::error::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<ciborium::ser::error::Error<std::io::error::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<vhost::Error>
Unexecuted instantiation: <anyhow::Error>::construct::<vmm_vhost::Error>
Unexecuted instantiation: <anyhow::Error>::construct::<devices::serial_device::Error>
Unexecuted instantiation: <anyhow::Error>::construct::<cros_async::io_ext::AsyncError>
Unexecuted instantiation: <anyhow::Error>::construct::<base::tube::Error>
Unexecuted instantiation: <anyhow::Error>::construct::<devices::pci::pci_device::Error>
Unexecuted instantiation: <anyhow::Error>::construct::<devices::pci::msix::MsixError>
Unexecuted instantiation: <anyhow::Error>::construct::<devices::virtio::vhost::Error>
Unexecuted instantiation: <anyhow::Error>::construct::<devices::irqchip::ioapic::IoapicError>
Unexecuted instantiation: <anyhow::Error>::construct::<devices::virtio::vhost_user_frontend::error::Error>
Unexecuted instantiation: <anyhow::Error>::construct::<devices::virtio::vhost::user::device::handler::Error>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<alloc::string::String, minijail::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, minijail::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::wrapper::DisplayError<alloc::string::String>>
Unexecuted instantiation: <anyhow::Error>::construct::<minijail::Error>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<alloc::string::String, anyhow::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<alloc::string::String, rutabaga_gfx::rutabaga_utils::RutabagaError>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, base::tube::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<base::errno::Error>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<alloc::string::String, serde_json::error::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<alloc::string::String, std::io::error::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind, anyhow::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind, std::io::error::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::wrapper::DisplayError<&str>>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::wrapper::MessageError<alloc::ffi::c_str::NulError>>
Unexecuted instantiation: <anyhow::Error>::construct::<core::num::error::TryFromIntError>
Unexecuted instantiation: <anyhow::Error>::construct::<core::str::error::Utf8Error>
Unexecuted instantiation: <anyhow::Error>::construct::<std::io::error::Error>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, base::errno::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<ciborium::value::error::Error>
Unexecuted instantiation: <anyhow::Error>::construct::<base::mmap::Error>
Unexecuted instantiation: <anyhow::Error>::construct::<base::errno::Error>
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<alloc::string::String, std::io::error::Error>>
<anyhow::Error>::construct::<anyhow::error::ContextError<&str, anyhow::Error>>
Line
Count
Source
220
256
    unsafe fn construct<E>(
221
256
        error: E,
222
256
        vtable: &'static ErrorVTable,
223
256
        backtrace: Option<Backtrace>,
224
256
    ) -> Self
225
256
    where
226
256
        E: StdError + Send + Sync + 'static,
227
256
    {
228
256
        let inner: Box<ErrorImpl<E>> = Box::new(ErrorImpl {
229
256
            vtable,
230
256
            backtrace,
231
256
            _object: error,
232
256
        });
233
256
        // Erase the concrete type of E from the compile-time type system. This
234
256
        // is equivalent to the safe unsize coercion from Box<ErrorImpl<E>> to
235
256
        // Box<ErrorImpl<dyn StdError + Send + Sync + 'static>> except that the
236
256
        // result is a thin pointer. The necessary behavior for manipulating the
237
256
        // underlying ErrorImpl<E> is preserved in the vtable provided by the
238
256
        // caller rather than a builtin fat pointer vtable.
239
256
        let inner = Own::new(inner).cast::<ErrorImpl>();
240
256
        Error { inner }
241
256
    }
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::error::ContextError<&str, std::io::error::Error>>
Unexecuted instantiation: <anyhow::Error>::construct::<std::io::error::Error>
<anyhow::Error>::construct::<anyhow::wrapper::MessageError<alloc::string::String>>
Line
Count
Source
220
339
    unsafe fn construct<E>(
221
339
        error: E,
222
339
        vtable: &'static ErrorVTable,
223
339
        backtrace: Option<Backtrace>,
224
339
    ) -> Self
225
339
    where
226
339
        E: StdError + Send + Sync + 'static,
227
339
    {
228
339
        let inner: Box<ErrorImpl<E>> = Box::new(ErrorImpl {
229
339
            vtable,
230
339
            backtrace,
231
339
            _object: error,
232
339
        });
233
339
        // Erase the concrete type of E from the compile-time type system. This
234
339
        // is equivalent to the safe unsize coercion from Box<ErrorImpl<E>> to
235
339
        // Box<ErrorImpl<dyn StdError + Send + Sync + 'static>> except that the
236
339
        // result is a thin pointer. The necessary behavior for manipulating the
237
339
        // underlying ErrorImpl<E> is preserved in the vtable provided by the
238
339
        // caller rather than a builtin fat pointer vtable.
239
339
        let inner = Own::new(inner).cast::<ErrorImpl>();
240
339
        Error { inner }
241
339
    }
<anyhow::Error>::construct::<anyhow::wrapper::MessageError<&str>>
Line
Count
Source
220
37
    unsafe fn construct<E>(
221
37
        error: E,
222
37
        vtable: &'static ErrorVTable,
223
37
        backtrace: Option<Backtrace>,
224
37
    ) -> Self
225
37
    where
226
37
        E: StdError + Send + Sync + 'static,
227
37
    {
228
37
        let inner: Box<ErrorImpl<E>> = Box::new(ErrorImpl {
229
37
            vtable,
230
37
            backtrace,
231
37
            _object: error,
232
37
        });
233
37
        // Erase the concrete type of E from the compile-time type system. This
234
37
        // is equivalent to the safe unsize coercion from Box<ErrorImpl<E>> to
235
37
        // Box<ErrorImpl<dyn StdError + Send + Sync + 'static>> except that the
236
37
        // result is a thin pointer. The necessary behavior for manipulating the
237
37
        // underlying ErrorImpl<E> is preserved in the vtable provided by the
238
37
        // caller rather than a builtin fat pointer vtable.
239
37
        let inner = Own::new(inner).cast::<ErrorImpl>();
240
37
        Error { inner }
241
37
    }
Unexecuted instantiation: <anyhow::Error>::construct::<anyhow::wrapper::BoxedError>
242
243
    /// Wrap the error value with additional context.
244
    ///
245
    /// For attaching context to a `Result` as it is propagated, the
246
    /// [`Context`][crate::Context] extension trait may be more convenient than
247
    /// this function.
248
    ///
249
    /// The primary reason to use `error.context(...)` instead of
250
    /// `result.context(...)` via the `Context` trait would be if the context
251
    /// needs to depend on some data held by the underlying error:
252
    ///
253
    /// ```
254
    /// # use std::fmt::{self, Debug, Display};
255
    /// #
256
    /// # type T = ();
257
    /// #
258
    /// # impl std::error::Error for ParseError {}
259
    /// # impl Debug for ParseError {
260
    /// #     fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
261
    /// #         unimplemented!()
262
    /// #     }
263
    /// # }
264
    /// # impl Display for ParseError {
265
    /// #     fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
266
    /// #         unimplemented!()
267
    /// #     }
268
    /// # }
269
    /// #
270
    /// use anyhow::Result;
271
    /// use std::fs::File;
272
    /// use std::path::Path;
273
    ///
274
    /// struct ParseError {
275
    ///     line: usize,
276
    ///     column: usize,
277
    /// }
278
    ///
279
    /// fn parse_impl(file: File) -> Result<T, ParseError> {
280
    ///     # const IGNORE: &str = stringify! {
281
    ///     ...
282
    ///     # };
283
    ///     # unimplemented!()
284
    /// }
285
    ///
286
    /// pub fn parse(path: impl AsRef<Path>) -> Result<T> {
287
    ///     let file = File::open(&path)?;
288
    ///     parse_impl(file).map_err(|error| {
289
    ///         let context = format!(
290
    ///             "only the first {} lines of {} are valid",
291
    ///             error.line, path.as_ref().display(),
292
    ///         );
293
    ///         anyhow::Error::new(error).context(context)
294
    ///     })
295
    /// }
296
    /// ```
297
    #[cold]
298
    #[must_use]
299
256
    pub fn context<C>(self, context: C) -> Self
300
256
    where
301
256
        C: Display + Send + Sync + 'static,
302
256
    {
303
256
        let error: ContextError<C, Error> = ContextError {
304
256
            context,
305
256
            error: self,
306
256
        };
307
256
308
256
        let vtable = &ErrorVTable {
309
256
            object_drop: object_drop::<ContextError<C, Error>>,
310
256
            object_ref: object_ref::<ContextError<C, Error>>,
311
256
            #[cfg(all(feature = "std", anyhow_no_ptr_addr_of))]
312
256
            object_mut: object_mut::<ContextError<C, Error>>,
313
256
            object_boxed: object_boxed::<ContextError<C, Error>>,
314
256
            object_downcast: context_chain_downcast::<C>,
315
256
            #[cfg(anyhow_no_ptr_addr_of)]
316
256
            object_downcast_mut: context_chain_downcast_mut::<C>,
317
256
            object_drop_rest: context_chain_drop_rest::<C>,
318
256
            #[cfg(all(not(backtrace), feature = "backtrace"))]
319
256
            object_backtrace: context_backtrace::<C>,
320
256
        };
321
256
322
256
        // As the cause is anyhow::Error, we already have a backtrace for it.
323
256
        let backtrace = None;
324
256
325
256
        // Safety: passing vtable that operates on the right type.
326
256
        unsafe { Error::construct(error, vtable, backtrace) }
327
256
    }
Unexecuted instantiation: <anyhow::Error>::context::<alloc::string::String>
Unexecuted instantiation: <anyhow::Error>::context::<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind>
<anyhow::Error>::context::<&str>
Line
Count
Source
299
256
    pub fn context<C>(self, context: C) -> Self
300
256
    where
301
256
        C: Display + Send + Sync + 'static,
302
256
    {
303
256
        let error: ContextError<C, Error> = ContextError {
304
256
            context,
305
256
            error: self,
306
256
        };
307
256
308
256
        let vtable = &ErrorVTable {
309
256
            object_drop: object_drop::<ContextError<C, Error>>,
310
256
            object_ref: object_ref::<ContextError<C, Error>>,
311
256
            #[cfg(all(feature = "std", anyhow_no_ptr_addr_of))]
312
256
            object_mut: object_mut::<ContextError<C, Error>>,
313
256
            object_boxed: object_boxed::<ContextError<C, Error>>,
314
256
            object_downcast: context_chain_downcast::<C>,
315
256
            #[cfg(anyhow_no_ptr_addr_of)]
316
256
            object_downcast_mut: context_chain_downcast_mut::<C>,
317
256
            object_drop_rest: context_chain_drop_rest::<C>,
318
256
            #[cfg(all(not(backtrace), feature = "backtrace"))]
319
256
            object_backtrace: context_backtrace::<C>,
320
256
        };
321
256
322
256
        // As the cause is anyhow::Error, we already have a backtrace for it.
323
256
        let backtrace = None;
324
256
325
256
        // Safety: passing vtable that operates on the right type.
326
256
        unsafe { Error::construct(error, vtable, backtrace) }
327
256
    }
Unexecuted instantiation: <anyhow::Error>::context::<_>
328
329
    /// Get the backtrace for this Error.
330
    ///
331
    /// In order for the backtrace to be meaningful, one of the two environment
332
    /// variables `RUST_LIB_BACKTRACE=1` or `RUST_BACKTRACE=1` must be defined
333
    /// and `RUST_LIB_BACKTRACE` must not be `0`. Backtraces are somewhat
334
    /// expensive to capture in Rust, so we don't necessarily want to be
335
    /// capturing them all over the place all the time.
336
    ///
337
    /// - If you want panics and errors to both have backtraces, set
338
    ///   `RUST_BACKTRACE=1`;
339
    /// - If you want only errors to have backtraces, set
340
    ///   `RUST_LIB_BACKTRACE=1`;
341
    /// - If you want only panics to have backtraces, set `RUST_BACKTRACE=1` and
342
    ///   `RUST_LIB_BACKTRACE=0`.
343
    ///
344
    /// # Stability
345
    ///
346
    /// Standard library backtraces are only available on the nightly channel.
347
    /// Tracking issue: [rust-lang/rust#53487][tracking].
348
    ///
349
    /// On stable compilers, this function is only available if the crate's
350
    /// "backtrace" feature is enabled, and will use the `backtrace` crate as
351
    /// the underlying backtrace implementation.
352
    ///
353
    /// ```toml
354
    /// [dependencies]
355
    /// anyhow = { version = "1.0", features = ["backtrace"] }
356
    /// ```
357
    ///
358
    /// [tracking]: https://github.com/rust-lang/rust/issues/53487
359
    #[cfg(any(backtrace, feature = "backtrace"))]
360
    #[cfg_attr(doc_cfg, doc(cfg(any(nightly, feature = "backtrace"))))]
361
    pub fn backtrace(&self) -> &impl_backtrace!() {
362
        unsafe { ErrorImpl::backtrace(self.inner.by_ref()) }
363
    }
364
365
    /// An iterator of the chain of source errors contained by this Error.
366
    ///
367
    /// This iterator will visit every error in the cause chain of this error
368
    /// object, beginning with the error that this error object was created
369
    /// from.
370
    ///
371
    /// # Example
372
    ///
373
    /// ```
374
    /// use anyhow::Error;
375
    /// use std::io;
376
    ///
377
    /// pub fn underlying_io_error_kind(error: &Error) -> Option<io::ErrorKind> {
378
    ///     for cause in error.chain() {
379
    ///         if let Some(io_error) = cause.downcast_ref::<io::Error>() {
380
    ///             return Some(io_error.kind());
381
    ///         }
382
    ///     }
383
    ///     None
384
    /// }
385
    /// ```
386
    #[cfg(feature = "std")]
387
    #[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
388
    #[cold]
389
0
    pub fn chain(&self) -> Chain {
390
0
        unsafe { ErrorImpl::chain(self.inner.by_ref()) }
391
0
    }
392
393
    /// The lowest level cause of this error &mdash; this error's cause's
394
    /// cause's cause etc.
395
    ///
396
    /// The root cause is the last error in the iterator produced by
397
    /// [`chain()`][Error::chain].
398
    #[cfg(feature = "std")]
399
    #[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
400
0
    pub fn root_cause(&self) -> &(dyn StdError + 'static) {
401
0
        self.chain().last().unwrap()
402
0
    }
403
404
    /// Returns true if `E` is the type held by this error object.
405
    ///
406
    /// For errors with context, this method returns true if `E` matches the
407
    /// type of the context `C` **or** the type of the error on which the
408
    /// context has been attached. For details about the interaction between
409
    /// context and downcasting, [see here].
410
    ///
411
    /// [see here]: trait.Context.html#effect-on-downcasting
412
0
    pub fn is<E>(&self) -> bool
413
0
    where
414
0
        E: Display + Debug + Send + Sync + 'static,
415
0
    {
416
0
        self.downcast_ref::<E>().is_some()
417
0
    }
418
419
    /// Attempt to downcast the error object to a concrete type.
420
0
    pub fn downcast<E>(mut self) -> Result<E, Self>
421
0
    where
422
0
        E: Display + Debug + Send + Sync + 'static,
423
0
    {
424
0
        let target = TypeId::of::<E>();
425
0
        let inner = self.inner.by_mut();
426
        unsafe {
427
            // Use vtable to find NonNull<()> which points to a value of type E
428
            // somewhere inside the data structure.
429
            #[cfg(not(anyhow_no_ptr_addr_of))]
430
0
            let addr = match (vtable(inner.ptr).object_downcast)(inner.by_ref(), target) {
431
0
                Some(addr) => addr.by_mut().extend(),
432
0
                None => return Err(self),
433
            };
434
            #[cfg(anyhow_no_ptr_addr_of)]
435
            let addr = match (vtable(inner.ptr).object_downcast_mut)(inner, target) {
436
                Some(addr) => addr.extend(),
437
                None => return Err(self),
438
            };
439
440
            // Prepare to read E out of the data structure. We'll drop the rest
441
            // of the data structure separately so that E is not dropped.
442
0
            let outer = ManuallyDrop::new(self);
443
0
444
0
            // Read E from where the vtable found it.
445
0
            let error = addr.cast::<E>().read();
446
0
447
0
            // Drop rest of the data structure outside of E.
448
0
            (vtable(outer.inner.ptr).object_drop_rest)(outer.inner, target);
449
0
450
0
            Ok(error)
451
        }
452
0
    }
453
454
    /// Downcast this error object by reference.
455
    ///
456
    /// # Example
457
    ///
458
    /// ```
459
    /// # use anyhow::anyhow;
460
    /// # use std::fmt::{self, Display};
461
    /// # use std::task::Poll;
462
    /// #
463
    /// # #[derive(Debug)]
464
    /// # enum DataStoreError {
465
    /// #     Censored(()),
466
    /// # }
467
    /// #
468
    /// # impl Display for DataStoreError {
469
    /// #     fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
470
    /// #         unimplemented!()
471
    /// #     }
472
    /// # }
473
    /// #
474
    /// # impl std::error::Error for DataStoreError {}
475
    /// #
476
    /// # const REDACTED_CONTENT: () = ();
477
    /// #
478
    /// # let error = anyhow!("...");
479
    /// # let root_cause = &error;
480
    /// #
481
    /// # let ret =
482
    /// // If the error was caused by redaction, then return a tombstone instead
483
    /// // of the content.
484
    /// match root_cause.downcast_ref::<DataStoreError>() {
485
    ///     Some(DataStoreError::Censored(_)) => Ok(Poll::Ready(REDACTED_CONTENT)),
486
    ///     None => Err(error),
487
    /// }
488
    /// # ;
489
    /// ```
490
0
    pub fn downcast_ref<E>(&self) -> Option<&E>
491
0
    where
492
0
        E: Display + Debug + Send + Sync + 'static,
493
0
    {
494
0
        let target = TypeId::of::<E>();
495
        unsafe {
496
            // Use vtable to find NonNull<()> which points to a value of type E
497
            // somewhere inside the data structure.
498
0
            let addr = (vtable(self.inner.ptr).object_downcast)(self.inner.by_ref(), target)?;
499
0
            Some(addr.cast::<E>().deref())
500
        }
501
0
    }
Unexecuted instantiation: <anyhow::Error>::downcast_ref::<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind>
Unexecuted instantiation: <anyhow::Error>::downcast_ref::<_>
502
503
    /// Downcast this error object by mutable reference.
504
0
    pub fn downcast_mut<E>(&mut self) -> Option<&mut E>
505
0
    where
506
0
        E: Display + Debug + Send + Sync + 'static,
507
0
    {
508
0
        let target = TypeId::of::<E>();
509
        unsafe {
510
            // Use vtable to find NonNull<()> which points to a value of type E
511
            // somewhere inside the data structure.
512
513
            #[cfg(not(anyhow_no_ptr_addr_of))]
514
0
            let addr =
515
0
                (vtable(self.inner.ptr).object_downcast)(self.inner.by_ref(), target)?.by_mut();
516
0
517
0
            #[cfg(anyhow_no_ptr_addr_of)]
518
0
            let addr = (vtable(self.inner.ptr).object_downcast_mut)(self.inner.by_mut(), target)?;
519
0
520
0
            Some(addr.cast::<E>().deref_mut())
521
        }
522
0
    }
523
}
524
525
#[cfg(feature = "std")]
526
#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
527
impl<E> From<E> for Error
528
where
529
    E: StdError + Send + Sync + 'static,
530
{
531
    #[cold]
532
0
    fn from(error: E) -> Self {
533
0
        let backtrace = backtrace_if_absent!(error);
534
0
        Error::from_std(error, backtrace)
535
0
    }
Unexecuted instantiation: <anyhow::Error as core::convert::From<ciborium::de::error::Error<std::io::error::Error>>>::from
Unexecuted instantiation: <anyhow::Error as core::convert::From<ciborium::ser::error::Error<std::io::error::Error>>>::from
Unexecuted instantiation: <anyhow::Error as core::convert::From<vhost::Error>>::from
Unexecuted instantiation: <anyhow::Error as core::convert::From<vmm_vhost::Error>>::from
Unexecuted instantiation: <anyhow::Error as core::convert::From<devices::serial_device::Error>>::from
Unexecuted instantiation: <anyhow::Error as core::convert::From<cros_async::io_ext::AsyncError>>::from
Unexecuted instantiation: <anyhow::Error as core::convert::From<base::tube::Error>>::from
Unexecuted instantiation: <anyhow::Error as core::convert::From<devices::pci::pci_device::Error>>::from
Unexecuted instantiation: <anyhow::Error as core::convert::From<devices::pci::msix::MsixError>>::from
Unexecuted instantiation: <anyhow::Error as core::convert::From<devices::virtio::vhost::Error>>::from
Unexecuted instantiation: <anyhow::Error as core::convert::From<devices::irqchip::ioapic::IoapicError>>::from
Unexecuted instantiation: <anyhow::Error as core::convert::From<devices::virtio::vhost_user_frontend::error::Error>>::from
Unexecuted instantiation: <anyhow::Error as core::convert::From<minijail::Error>>::from
Unexecuted instantiation: <anyhow::Error as core::convert::From<base::errno::Error>>::from
Unexecuted instantiation: <anyhow::Error as core::convert::From<ciborium::value::error::Error>>::from
Unexecuted instantiation: <anyhow::Error as core::convert::From<base::mmap::Error>>::from
Unexecuted instantiation: <anyhow::Error as core::convert::From<base::errno::Error>>::from
Unexecuted instantiation: <anyhow::Error as core::convert::From<std::io::error::Error>>::from
Unexecuted instantiation: <anyhow::Error as core::convert::From<_>>::from
536
}
537
538
#[cfg(feature = "std")]
539
#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
540
impl Deref for Error {
541
    type Target = dyn StdError + Send + Sync + 'static;
542
543
0
    fn deref(&self) -> &Self::Target {
544
0
        unsafe { ErrorImpl::error(self.inner.by_ref()) }
545
0
    }
546
}
547
548
#[cfg(feature = "std")]
549
#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
550
impl DerefMut for Error {
551
0
    fn deref_mut(&mut self) -> &mut Self::Target {
552
0
        unsafe { ErrorImpl::error_mut(self.inner.by_mut()) }
553
0
    }
554
}
555
556
impl Display for Error {
557
0
    fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
558
0
        unsafe { ErrorImpl::display(self.inner.by_ref(), formatter) }
559
0
    }
560
}
561
562
impl Debug for Error {
563
0
    fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
564
0
        unsafe { ErrorImpl::debug(self.inner.by_ref(), formatter) }
565
0
    }
566
}
567
568
impl Drop for Error {
569
632
    fn drop(&mut self) {
570
632
        unsafe {
571
632
            // Invoke the vtable's drop behavior.
572
632
            (vtable(self.inner.ptr).object_drop)(self.inner);
573
632
        }
574
632
    }
575
}
576
577
struct ErrorVTable {
578
    object_drop: unsafe fn(Own<ErrorImpl>),
579
    object_ref: unsafe fn(Ref<ErrorImpl>) -> Ref<dyn StdError + Send + Sync + 'static>,
580
    #[cfg(all(feature = "std", anyhow_no_ptr_addr_of))]
581
    object_mut: unsafe fn(Mut<ErrorImpl>) -> &mut (dyn StdError + Send + Sync + 'static),
582
    object_boxed: unsafe fn(Own<ErrorImpl>) -> Box<dyn StdError + Send + Sync + 'static>,
583
    object_downcast: unsafe fn(Ref<ErrorImpl>, TypeId) -> Option<Ref<()>>,
584
    #[cfg(anyhow_no_ptr_addr_of)]
585
    object_downcast_mut: unsafe fn(Mut<ErrorImpl>, TypeId) -> Option<Mut<()>>,
586
    object_drop_rest: unsafe fn(Own<ErrorImpl>, TypeId),
587
    #[cfg(all(not(backtrace), feature = "backtrace"))]
588
    object_backtrace: unsafe fn(Ref<ErrorImpl>) -> Option<&Backtrace>,
589
}
590
591
// Safety: requires layout of *e to match ErrorImpl<E>.
592
632
unsafe fn object_drop<E>(e: Own<ErrorImpl>) {
593
632
    // Cast back to ErrorImpl<E> so that the allocator receives the correct
594
632
    // Layout to deallocate the Box's memory.
595
632
    let unerased = e.cast::<ErrorImpl<E>>().boxed();
596
632
    drop(unerased);
597
632
}
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<alloc::string::String, vm_memory::guest_memory::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<alloc::string::String, base::tube::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<alloc::string::String, base::errno::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<devices::pci::coiommu::Error, vm_memory::guest_memory::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<devices::pci::coiommu::Error, base::errno::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, ciborium::de::error::Error<std::io::error::Error>>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, ciborium::ser::error::Error<std::io::error::Error>>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, std::sync::mpsc::SendError<devices::virtio::console::worker::WorkerRequest>>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, vhost::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, resources::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, vmm_vhost::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, disk::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, devices::pit::PitError>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, devices::vfio::VfioError>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, vm_memory::guest_memory::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, cros_async::io_ext::AsyncError>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, vm_control::api::ApiClientError>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, std::time::SystemTimeError>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, base::mmap::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, devices::pci::pci_device::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, devices::virtio::iommu::IommuError>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, devices::irqchip::ioapic::IoapicError>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, devices::irqchip::userspace::TimerWorkerError>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, std::sync::mpsc::RecvError>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, devices::virtio::vhost_user_frontend::error::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, devices::virtio::block::asynchronous::ControlError>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, devices::virtio::block::asynchronous::ExecuteError>>
Unexecuted instantiation: anyhow::error::object_drop::<ciborium::de::error::Error<std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<ciborium::ser::error::Error<std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<vhost::Error>
Unexecuted instantiation: anyhow::error::object_drop::<vmm_vhost::Error>
Unexecuted instantiation: anyhow::error::object_drop::<devices::serial_device::Error>
Unexecuted instantiation: anyhow::error::object_drop::<cros_async::io_ext::AsyncError>
Unexecuted instantiation: anyhow::error::object_drop::<base::tube::Error>
Unexecuted instantiation: anyhow::error::object_drop::<devices::pci::pci_device::Error>
Unexecuted instantiation: anyhow::error::object_drop::<devices::pci::msix::MsixError>
Unexecuted instantiation: anyhow::error::object_drop::<devices::virtio::vhost::Error>
Unexecuted instantiation: anyhow::error::object_drop::<devices::irqchip::ioapic::IoapicError>
Unexecuted instantiation: anyhow::error::object_drop::<devices::virtio::vhost_user_frontend::error::Error>
Unexecuted instantiation: anyhow::error::object_drop::<devices::virtio::vhost::user::device::handler::Error>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<alloc::string::String, minijail::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, minijail::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::wrapper::DisplayError<alloc::string::String>>
Unexecuted instantiation: anyhow::error::object_drop::<minijail::Error>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<alloc::string::String, anyhow::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<alloc::string::String, rutabaga_gfx::rutabaga_utils::RutabagaError>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, base::tube::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<base::errno::Error>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<alloc::string::String, serde_json::error::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<alloc::string::String, std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind, anyhow::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind, std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::wrapper::DisplayError<&str>>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::wrapper::MessageError<alloc::ffi::c_str::NulError>>
Unexecuted instantiation: anyhow::error::object_drop::<core::num::error::TryFromIntError>
Unexecuted instantiation: anyhow::error::object_drop::<core::str::error::Utf8Error>
Unexecuted instantiation: anyhow::error::object_drop::<std::io::error::Error>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, base::errno::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<ciborium::value::error::Error>
Unexecuted instantiation: anyhow::error::object_drop::<base::mmap::Error>
Unexecuted instantiation: anyhow::error::object_drop::<base::errno::Error>
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<alloc::string::String, std::io::error::Error>>
anyhow::error::object_drop::<anyhow::error::ContextError<&str, anyhow::Error>>
Line
Count
Source
592
256
unsafe fn object_drop<E>(e: Own<ErrorImpl>) {
593
256
    // Cast back to ErrorImpl<E> so that the allocator receives the correct
594
256
    // Layout to deallocate the Box's memory.
595
256
    let unerased = e.cast::<ErrorImpl<E>>().boxed();
596
256
    drop(unerased);
597
256
}
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::error::ContextError<&str, std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_drop::<std::io::error::Error>
anyhow::error::object_drop::<anyhow::wrapper::MessageError<alloc::string::String>>
Line
Count
Source
592
339
unsafe fn object_drop<E>(e: Own<ErrorImpl>) {
593
339
    // Cast back to ErrorImpl<E> so that the allocator receives the correct
594
339
    // Layout to deallocate the Box's memory.
595
339
    let unerased = e.cast::<ErrorImpl<E>>().boxed();
596
339
    drop(unerased);
597
339
}
anyhow::error::object_drop::<anyhow::wrapper::MessageError<&str>>
Line
Count
Source
592
37
unsafe fn object_drop<E>(e: Own<ErrorImpl>) {
593
37
    // Cast back to ErrorImpl<E> so that the allocator receives the correct
594
37
    // Layout to deallocate the Box's memory.
595
37
    let unerased = e.cast::<ErrorImpl<E>>().boxed();
596
37
    drop(unerased);
597
37
}
Unexecuted instantiation: anyhow::error::object_drop::<anyhow::wrapper::BoxedError>
598
599
// Safety: requires layout of *e to match ErrorImpl<E>.
600
0
unsafe fn object_drop_front<E>(e: Own<ErrorImpl>, target: TypeId) {
601
0
    // Drop the fields of ErrorImpl other than E as well as the Box allocation,
602
0
    // without dropping E itself. This is used by downcast after doing a
603
0
    // ptr::read to take ownership of the E.
604
0
    let _ = target;
605
0
    let unerased = e.cast::<ErrorImpl<ManuallyDrop<E>>>().boxed();
606
0
    drop(unerased);
607
0
}
Unexecuted instantiation: anyhow::error::object_drop_front::<ciborium::de::error::Error<std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_drop_front::<ciborium::ser::error::Error<std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_drop_front::<vhost::Error>
Unexecuted instantiation: anyhow::error::object_drop_front::<vmm_vhost::Error>
Unexecuted instantiation: anyhow::error::object_drop_front::<devices::serial_device::Error>
Unexecuted instantiation: anyhow::error::object_drop_front::<cros_async::io_ext::AsyncError>
Unexecuted instantiation: anyhow::error::object_drop_front::<base::tube::Error>
Unexecuted instantiation: anyhow::error::object_drop_front::<devices::pci::pci_device::Error>
Unexecuted instantiation: anyhow::error::object_drop_front::<devices::pci::msix::MsixError>
Unexecuted instantiation: anyhow::error::object_drop_front::<devices::virtio::vhost::Error>
Unexecuted instantiation: anyhow::error::object_drop_front::<devices::irqchip::ioapic::IoapicError>
Unexecuted instantiation: anyhow::error::object_drop_front::<devices::virtio::vhost_user_frontend::error::Error>
Unexecuted instantiation: anyhow::error::object_drop_front::<devices::virtio::vhost::user::device::handler::Error>
Unexecuted instantiation: anyhow::error::object_drop_front::<minijail::Error>
Unexecuted instantiation: anyhow::error::object_drop_front::<base::errno::Error>
Unexecuted instantiation: anyhow::error::object_drop_front::<alloc::ffi::c_str::NulError>
Unexecuted instantiation: anyhow::error::object_drop_front::<core::num::error::TryFromIntError>
Unexecuted instantiation: anyhow::error::object_drop_front::<core::str::error::Utf8Error>
Unexecuted instantiation: anyhow::error::object_drop_front::<std::io::error::Error>
Unexecuted instantiation: anyhow::error::object_drop_front::<ciborium::value::error::Error>
Unexecuted instantiation: anyhow::error::object_drop_front::<base::mmap::Error>
Unexecuted instantiation: anyhow::error::object_drop_front::<base::errno::Error>
Unexecuted instantiation: anyhow::error::object_drop_front::<std::io::error::Error>
Unexecuted instantiation: anyhow::error::object_drop_front::<alloc::boxed::Box<dyn core::error::Error + core::marker::Sync + core::marker::Send>>
Unexecuted instantiation: anyhow::error::object_drop_front::<alloc::string::String>
Unexecuted instantiation: anyhow::error::object_drop_front::<&str>
608
609
// Safety: requires layout of *e to match ErrorImpl<E>.
610
0
unsafe fn object_ref<E>(e: Ref<ErrorImpl>) -> Ref<dyn StdError + Send + Sync + 'static>
611
0
where
612
0
    E: StdError + Send + Sync + 'static,
613
0
{
614
0
    // Attach E's native StdError vtable onto a pointer to self._object.
615
0
616
0
    let unerased = e.cast::<ErrorImpl<E>>();
617
0
618
0
    #[cfg(not(anyhow_no_ptr_addr_of))]
619
0
    return Ref::from_raw(NonNull::new_unchecked(
620
0
        ptr::addr_of!((*unerased.as_ptr())._object) as *mut E,
621
0
    ));
622
0
623
0
    #[cfg(anyhow_no_ptr_addr_of)]
624
0
    return Ref::new(&unerased.deref()._object);
625
0
}
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<alloc::string::String, vm_memory::guest_memory::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<alloc::string::String, base::tube::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<alloc::string::String, base::errno::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<devices::pci::coiommu::Error, vm_memory::guest_memory::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<devices::pci::coiommu::Error, base::errno::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, ciborium::de::error::Error<std::io::error::Error>>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, ciborium::ser::error::Error<std::io::error::Error>>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, std::sync::mpsc::SendError<devices::virtio::console::worker::WorkerRequest>>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, vhost::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, resources::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, vmm_vhost::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, disk::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, devices::pit::PitError>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, devices::vfio::VfioError>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, vm_memory::guest_memory::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, cros_async::io_ext::AsyncError>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, vm_control::api::ApiClientError>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, std::time::SystemTimeError>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, base::mmap::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, devices::pci::pci_device::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, devices::virtio::iommu::IommuError>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, devices::irqchip::ioapic::IoapicError>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, devices::irqchip::userspace::TimerWorkerError>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, std::sync::mpsc::RecvError>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, devices::virtio::vhost_user_frontend::error::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, devices::virtio::block::asynchronous::ControlError>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, devices::virtio::block::asynchronous::ExecuteError>>
Unexecuted instantiation: anyhow::error::object_ref::<ciborium::de::error::Error<std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<ciborium::ser::error::Error<std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<vhost::Error>
Unexecuted instantiation: anyhow::error::object_ref::<vmm_vhost::Error>
Unexecuted instantiation: anyhow::error::object_ref::<devices::serial_device::Error>
Unexecuted instantiation: anyhow::error::object_ref::<cros_async::io_ext::AsyncError>
Unexecuted instantiation: anyhow::error::object_ref::<base::tube::Error>
Unexecuted instantiation: anyhow::error::object_ref::<devices::pci::pci_device::Error>
Unexecuted instantiation: anyhow::error::object_ref::<devices::pci::msix::MsixError>
Unexecuted instantiation: anyhow::error::object_ref::<devices::virtio::vhost::Error>
Unexecuted instantiation: anyhow::error::object_ref::<devices::irqchip::ioapic::IoapicError>
Unexecuted instantiation: anyhow::error::object_ref::<devices::virtio::vhost_user_frontend::error::Error>
Unexecuted instantiation: anyhow::error::object_ref::<devices::virtio::vhost::user::device::handler::Error>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<alloc::string::String, minijail::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, minijail::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::wrapper::DisplayError<alloc::string::String>>
Unexecuted instantiation: anyhow::error::object_ref::<minijail::Error>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<alloc::string::String, anyhow::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<alloc::string::String, rutabaga_gfx::rutabaga_utils::RutabagaError>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, base::tube::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<base::errno::Error>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<alloc::string::String, serde_json::error::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<alloc::string::String, std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind, anyhow::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind, std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::wrapper::DisplayError<&str>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::wrapper::MessageError<alloc::ffi::c_str::NulError>>
Unexecuted instantiation: anyhow::error::object_ref::<core::num::error::TryFromIntError>
Unexecuted instantiation: anyhow::error::object_ref::<core::str::error::Utf8Error>
Unexecuted instantiation: anyhow::error::object_ref::<std::io::error::Error>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, base::errno::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<ciborium::value::error::Error>
Unexecuted instantiation: anyhow::error::object_ref::<base::mmap::Error>
Unexecuted instantiation: anyhow::error::object_ref::<base::errno::Error>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<alloc::string::String, std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, anyhow::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::error::ContextError<&str, std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_ref::<std::io::error::Error>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::wrapper::MessageError<alloc::string::String>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::wrapper::MessageError<&str>>
Unexecuted instantiation: anyhow::error::object_ref::<anyhow::wrapper::BoxedError>
626
627
// Safety: requires layout of *e to match ErrorImpl<E>, and for `e` to be derived
628
// from a `&mut`
629
#[cfg(all(feature = "std", anyhow_no_ptr_addr_of))]
630
unsafe fn object_mut<E>(e: Mut<ErrorImpl>) -> &mut (dyn StdError + Send + Sync + 'static)
631
where
632
    E: StdError + Send + Sync + 'static,
633
{
634
    // Attach E's native StdError vtable onto a pointer to self._object.
635
    &mut e.cast::<ErrorImpl<E>>().deref_mut()._object
636
}
637
638
// Safety: requires layout of *e to match ErrorImpl<E>.
639
0
unsafe fn object_boxed<E>(e: Own<ErrorImpl>) -> Box<dyn StdError + Send + Sync + 'static>
640
0
where
641
0
    E: StdError + Send + Sync + 'static,
642
0
{
643
0
    // Attach ErrorImpl<E>'s native StdError vtable. The StdError impl is below.
644
0
    e.cast::<ErrorImpl<E>>().boxed()
645
0
}
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<alloc::string::String, vm_memory::guest_memory::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<alloc::string::String, base::tube::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<alloc::string::String, base::errno::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<devices::pci::coiommu::Error, vm_memory::guest_memory::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<devices::pci::coiommu::Error, base::errno::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, ciborium::de::error::Error<std::io::error::Error>>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, ciborium::ser::error::Error<std::io::error::Error>>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, std::sync::mpsc::SendError<devices::virtio::console::worker::WorkerRequest>>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, vhost::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, resources::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, vmm_vhost::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, disk::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, devices::pit::PitError>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, devices::vfio::VfioError>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, vm_memory::guest_memory::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, cros_async::io_ext::AsyncError>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, vm_control::api::ApiClientError>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, std::time::SystemTimeError>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, base::mmap::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, devices::pci::pci_device::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, devices::virtio::iommu::IommuError>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, devices::irqchip::ioapic::IoapicError>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, devices::irqchip::userspace::TimerWorkerError>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, std::sync::mpsc::RecvError>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, devices::virtio::vhost_user_frontend::error::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, devices::virtio::block::asynchronous::ControlError>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, devices::virtio::block::asynchronous::ExecuteError>>
Unexecuted instantiation: anyhow::error::object_boxed::<ciborium::de::error::Error<std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<ciborium::ser::error::Error<std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<vhost::Error>
Unexecuted instantiation: anyhow::error::object_boxed::<vmm_vhost::Error>
Unexecuted instantiation: anyhow::error::object_boxed::<devices::serial_device::Error>
Unexecuted instantiation: anyhow::error::object_boxed::<cros_async::io_ext::AsyncError>
Unexecuted instantiation: anyhow::error::object_boxed::<base::tube::Error>
Unexecuted instantiation: anyhow::error::object_boxed::<devices::pci::pci_device::Error>
Unexecuted instantiation: anyhow::error::object_boxed::<devices::pci::msix::MsixError>
Unexecuted instantiation: anyhow::error::object_boxed::<devices::virtio::vhost::Error>
Unexecuted instantiation: anyhow::error::object_boxed::<devices::irqchip::ioapic::IoapicError>
Unexecuted instantiation: anyhow::error::object_boxed::<devices::virtio::vhost_user_frontend::error::Error>
Unexecuted instantiation: anyhow::error::object_boxed::<devices::virtio::vhost::user::device::handler::Error>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<alloc::string::String, minijail::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, minijail::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::wrapper::DisplayError<alloc::string::String>>
Unexecuted instantiation: anyhow::error::object_boxed::<minijail::Error>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<alloc::string::String, anyhow::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<alloc::string::String, rutabaga_gfx::rutabaga_utils::RutabagaError>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, base::tube::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<base::errno::Error>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<alloc::string::String, serde_json::error::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<alloc::string::String, std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind, anyhow::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind, std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::wrapper::DisplayError<&str>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::wrapper::MessageError<alloc::ffi::c_str::NulError>>
Unexecuted instantiation: anyhow::error::object_boxed::<core::num::error::TryFromIntError>
Unexecuted instantiation: anyhow::error::object_boxed::<core::str::error::Utf8Error>
Unexecuted instantiation: anyhow::error::object_boxed::<std::io::error::Error>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, base::errno::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<ciborium::value::error::Error>
Unexecuted instantiation: anyhow::error::object_boxed::<base::mmap::Error>
Unexecuted instantiation: anyhow::error::object_boxed::<base::errno::Error>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<alloc::string::String, std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, anyhow::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::error::ContextError<&str, std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_boxed::<std::io::error::Error>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::wrapper::MessageError<alloc::string::String>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::wrapper::MessageError<&str>>
Unexecuted instantiation: anyhow::error::object_boxed::<anyhow::wrapper::BoxedError>
646
647
// Safety: requires layout of *e to match ErrorImpl<E>.
648
0
unsafe fn object_downcast<E>(e: Ref<ErrorImpl>, target: TypeId) -> Option<Ref<()>>
649
0
where
650
0
    E: 'static,
651
0
{
652
0
    if TypeId::of::<E>() == target {
653
        // Caller is looking for an E pointer and e is ErrorImpl<E>, take a
654
        // pointer to its E field.
655
656
0
        let unerased = e.cast::<ErrorImpl<E>>();
657
0
658
0
        #[cfg(not(anyhow_no_ptr_addr_of))]
659
0
        return Some(
660
0
            Ref::from_raw(NonNull::new_unchecked(
661
0
                ptr::addr_of!((*unerased.as_ptr())._object) as *mut E,
662
0
            ))
663
0
            .cast::<()>(),
664
0
        );
665
666
        #[cfg(anyhow_no_ptr_addr_of)]
667
        return Some(Ref::new(&unerased.deref()._object).cast::<()>());
668
    } else {
669
0
        None
670
    }
671
0
}
Unexecuted instantiation: anyhow::error::object_downcast::<ciborium::de::error::Error<std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_downcast::<ciborium::ser::error::Error<std::io::error::Error>>
Unexecuted instantiation: anyhow::error::object_downcast::<vhost::Error>
Unexecuted instantiation: anyhow::error::object_downcast::<vmm_vhost::Error>
Unexecuted instantiation: anyhow::error::object_downcast::<devices::serial_device::Error>
Unexecuted instantiation: anyhow::error::object_downcast::<cros_async::io_ext::AsyncError>
Unexecuted instantiation: anyhow::error::object_downcast::<base::tube::Error>
Unexecuted instantiation: anyhow::error::object_downcast::<devices::pci::pci_device::Error>
Unexecuted instantiation: anyhow::error::object_downcast::<devices::pci::msix::MsixError>
Unexecuted instantiation: anyhow::error::object_downcast::<devices::virtio::vhost::Error>
Unexecuted instantiation: anyhow::error::object_downcast::<devices::irqchip::ioapic::IoapicError>
Unexecuted instantiation: anyhow::error::object_downcast::<devices::virtio::vhost_user_frontend::error::Error>
Unexecuted instantiation: anyhow::error::object_downcast::<devices::virtio::vhost::user::device::handler::Error>
Unexecuted instantiation: anyhow::error::object_downcast::<minijail::Error>
Unexecuted instantiation: anyhow::error::object_downcast::<base::errno::Error>
Unexecuted instantiation: anyhow::error::object_downcast::<alloc::ffi::c_str::NulError>
Unexecuted instantiation: anyhow::error::object_downcast::<core::num::error::TryFromIntError>
Unexecuted instantiation: anyhow::error::object_downcast::<core::str::error::Utf8Error>
Unexecuted instantiation: anyhow::error::object_downcast::<std::io::error::Error>
Unexecuted instantiation: anyhow::error::object_downcast::<ciborium::value::error::Error>
Unexecuted instantiation: anyhow::error::object_downcast::<base::mmap::Error>
Unexecuted instantiation: anyhow::error::object_downcast::<base::errno::Error>
Unexecuted instantiation: anyhow::error::object_downcast::<std::io::error::Error>
Unexecuted instantiation: anyhow::error::object_downcast::<alloc::boxed::Box<dyn core::error::Error + core::marker::Sync + core::marker::Send>>
Unexecuted instantiation: anyhow::error::object_downcast::<alloc::string::String>
Unexecuted instantiation: anyhow::error::object_downcast::<&str>
672
673
// Safety: requires layout of *e to match ErrorImpl<E>.
674
#[cfg(anyhow_no_ptr_addr_of)]
675
unsafe fn object_downcast_mut<E>(e: Mut<ErrorImpl>, target: TypeId) -> Option<Mut<()>>
676
where
677
    E: 'static,
678
{
679
    if TypeId::of::<E>() == target {
680
        // Caller is looking for an E pointer and e is ErrorImpl<E>, take a
681
        // pointer to its E field.
682
        let unerased = e.cast::<ErrorImpl<E>>().deref_mut();
683
        Some(Mut::new(&mut unerased._object).cast::<()>())
684
    } else {
685
        None
686
    }
687
}
688
689
#[cfg(all(not(backtrace), feature = "backtrace"))]
690
fn no_backtrace(e: Ref<ErrorImpl>) -> Option<&Backtrace> {
691
    let _ = e;
692
    None
693
}
694
695
// Safety: requires layout of *e to match ErrorImpl<ContextError<C, E>>.
696
#[cfg(feature = "std")]
697
0
unsafe fn context_downcast<C, E>(e: Ref<ErrorImpl>, target: TypeId) -> Option<Ref<()>>
698
0
where
699
0
    C: 'static,
700
0
    E: 'static,
701
0
{
702
0
    if TypeId::of::<C>() == target {
703
0
        let unerased = e.cast::<ErrorImpl<ContextError<C, E>>>().deref();
704
0
        Some(Ref::new(&unerased._object.context).cast::<()>())
705
0
    } else if TypeId::of::<E>() == target {
706
0
        let unerased = e.cast::<ErrorImpl<ContextError<C, E>>>().deref();
707
0
        Some(Ref::new(&unerased._object.error).cast::<()>())
708
    } else {
709
0
        None
710
    }
711
0
}
Unexecuted instantiation: anyhow::error::context_downcast::<alloc::string::String, vm_memory::guest_memory::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<alloc::string::String, base::tube::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<alloc::string::String, base::errno::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<devices::pci::coiommu::Error, vm_memory::guest_memory::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<devices::pci::coiommu::Error, base::errno::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, ciborium::de::error::Error<std::io::error::Error>>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, ciborium::ser::error::Error<std::io::error::Error>>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, std::sync::mpsc::SendError<devices::virtio::console::worker::WorkerRequest>>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, vhost::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, resources::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, vmm_vhost::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, disk::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, devices::pit::PitError>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, devices::vfio::VfioError>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, vm_memory::guest_memory::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, cros_async::io_ext::AsyncError>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, vm_control::api::ApiClientError>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, std::time::SystemTimeError>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, base::mmap::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, devices::pci::pci_device::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, devices::virtio::iommu::IommuError>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, devices::irqchip::ioapic::IoapicError>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, devices::irqchip::userspace::TimerWorkerError>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, std::sync::mpsc::RecvError>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, devices::virtio::vhost_user_frontend::error::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, devices::virtio::block::asynchronous::ControlError>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, devices::virtio::block::asynchronous::ExecuteError>
Unexecuted instantiation: anyhow::error::context_downcast::<alloc::string::String, minijail::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, minijail::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<alloc::string::String, rutabaga_gfx::rutabaga_utils::RutabagaError>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, base::tube::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<alloc::string::String, serde_json::error::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<alloc::string::String, std::io::error::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind, std::io::error::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, base::errno::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<alloc::string::String, std::io::error::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<&str, std::io::error::Error>
Unexecuted instantiation: anyhow::error::context_downcast::<_, _>
712
713
// Safety: requires layout of *e to match ErrorImpl<ContextError<C, E>>.
714
#[cfg(all(feature = "std", anyhow_no_ptr_addr_of))]
715
unsafe fn context_downcast_mut<C, E>(e: Mut<ErrorImpl>, target: TypeId) -> Option<Mut<()>>
716
where
717
    C: 'static,
718
    E: 'static,
719
{
720
    if TypeId::of::<C>() == target {
721
        let unerased = e.cast::<ErrorImpl<ContextError<C, E>>>().deref_mut();
722
        Some(Mut::new(&mut unerased._object.context).cast::<()>())
723
    } else if TypeId::of::<E>() == target {
724
        let unerased = e.cast::<ErrorImpl<ContextError<C, E>>>().deref_mut();
725
        Some(Mut::new(&mut unerased._object.error).cast::<()>())
726
    } else {
727
        None
728
    }
729
}
730
731
// Safety: requires layout of *e to match ErrorImpl<ContextError<C, E>>.
732
#[cfg(feature = "std")]
733
0
unsafe fn context_drop_rest<C, E>(e: Own<ErrorImpl>, target: TypeId)
734
0
where
735
0
    C: 'static,
736
0
    E: 'static,
737
0
{
738
0
    // Called after downcasting by value to either the C or the E and doing a
739
0
    // ptr::read to take ownership of that value.
740
0
    if TypeId::of::<C>() == target {
741
0
        let unerased = e
742
0
            .cast::<ErrorImpl<ContextError<ManuallyDrop<C>, E>>>()
743
0
            .boxed();
744
0
        drop(unerased);
745
0
    } else {
746
0
        let unerased = e
747
0
            .cast::<ErrorImpl<ContextError<C, ManuallyDrop<E>>>>()
748
0
            .boxed();
749
0
        drop(unerased);
750
0
    }
751
0
}
Unexecuted instantiation: anyhow::error::context_drop_rest::<alloc::string::String, vm_memory::guest_memory::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<alloc::string::String, base::tube::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<alloc::string::String, base::errno::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<devices::pci::coiommu::Error, vm_memory::guest_memory::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<devices::pci::coiommu::Error, base::errno::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, ciborium::de::error::Error<std::io::error::Error>>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, ciborium::ser::error::Error<std::io::error::Error>>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, std::sync::mpsc::SendError<devices::virtio::console::worker::WorkerRequest>>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, vhost::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, resources::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, vmm_vhost::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, disk::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, devices::pit::PitError>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, devices::vfio::VfioError>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, vm_memory::guest_memory::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, cros_async::io_ext::AsyncError>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, vm_control::api::ApiClientError>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, std::time::SystemTimeError>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, base::mmap::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, devices::pci::pci_device::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, devices::virtio::iommu::IommuError>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, devices::irqchip::ioapic::IoapicError>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, devices::irqchip::userspace::TimerWorkerError>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, std::sync::mpsc::RecvError>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, devices::virtio::vhost_user_frontend::error::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, devices::virtio::block::asynchronous::ControlError>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, devices::virtio::block::asynchronous::ExecuteError>
Unexecuted instantiation: anyhow::error::context_drop_rest::<alloc::string::String, minijail::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, minijail::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<alloc::string::String, rutabaga_gfx::rutabaga_utils::RutabagaError>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, base::tube::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<alloc::string::String, serde_json::error::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<alloc::string::String, std::io::error::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind, std::io::error::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, base::errno::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<alloc::string::String, std::io::error::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<&str, std::io::error::Error>
Unexecuted instantiation: anyhow::error::context_drop_rest::<_, _>
752
753
// Safety: requires layout of *e to match ErrorImpl<ContextError<C, Error>>.
754
0
unsafe fn context_chain_downcast<C>(e: Ref<ErrorImpl>, target: TypeId) -> Option<Ref<()>>
755
0
where
756
0
    C: 'static,
757
0
{
758
0
    let unerased = e.cast::<ErrorImpl<ContextError<C, Error>>>().deref();
759
0
    if TypeId::of::<C>() == target {
760
0
        Some(Ref::new(&unerased._object.context).cast::<()>())
761
    } else {
762
        // Recurse down the context chain per the inner error's vtable.
763
0
        let source = &unerased._object.error;
764
0
        (vtable(source.inner.ptr).object_downcast)(source.inner.by_ref(), target)
765
    }
766
0
}
Unexecuted instantiation: anyhow::error::context_chain_downcast::<alloc::string::String>
Unexecuted instantiation: anyhow::error::context_chain_downcast::<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind>
Unexecuted instantiation: anyhow::error::context_chain_downcast::<&str>
Unexecuted instantiation: anyhow::error::context_chain_downcast::<_>
767
768
// Safety: requires layout of *e to match ErrorImpl<ContextError<C, Error>>.
769
#[cfg(anyhow_no_ptr_addr_of)]
770
unsafe fn context_chain_downcast_mut<C>(e: Mut<ErrorImpl>, target: TypeId) -> Option<Mut<()>>
771
where
772
    C: 'static,
773
{
774
    let unerased = e.cast::<ErrorImpl<ContextError<C, Error>>>().deref_mut();
775
    if TypeId::of::<C>() == target {
776
        Some(Mut::new(&mut unerased._object.context).cast::<()>())
777
    } else {
778
        // Recurse down the context chain per the inner error's vtable.
779
        let source = &mut unerased._object.error;
780
        (vtable(source.inner.ptr).object_downcast_mut)(source.inner.by_mut(), target)
781
    }
782
}
783
784
// Safety: requires layout of *e to match ErrorImpl<ContextError<C, Error>>.
785
0
unsafe fn context_chain_drop_rest<C>(e: Own<ErrorImpl>, target: TypeId)
786
0
where
787
0
    C: 'static,
788
0
{
789
0
    // Called after downcasting by value to either the C or one of the causes
790
0
    // and doing a ptr::read to take ownership of that value.
791
0
    if TypeId::of::<C>() == target {
792
0
        let unerased = e
793
0
            .cast::<ErrorImpl<ContextError<ManuallyDrop<C>, Error>>>()
794
0
            .boxed();
795
0
        // Drop the entire rest of the data structure rooted in the next Error.
796
0
        drop(unerased);
797
0
    } else {
798
0
        let unerased = e
799
0
            .cast::<ErrorImpl<ContextError<C, ManuallyDrop<Error>>>>()
800
0
            .boxed();
801
0
        // Read the Own<ErrorImpl> from the next error.
802
0
        let inner = unerased._object.error.inner;
803
0
        drop(unerased);
804
0
        let vtable = vtable(inner.ptr);
805
0
        // Recursively drop the next error using the same target typeid.
806
0
        (vtable.object_drop_rest)(inner, target);
807
0
    }
808
0
}
Unexecuted instantiation: anyhow::error::context_chain_drop_rest::<alloc::string::String>
Unexecuted instantiation: anyhow::error::context_chain_drop_rest::<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind>
Unexecuted instantiation: anyhow::error::context_chain_drop_rest::<&str>
Unexecuted instantiation: anyhow::error::context_chain_drop_rest::<_>
809
810
// Safety: requires layout of *e to match ErrorImpl<ContextError<C, Error>>.
811
#[cfg(all(not(backtrace), feature = "backtrace"))]
812
#[allow(clippy::unnecessary_wraps)]
813
unsafe fn context_backtrace<C>(e: Ref<ErrorImpl>) -> Option<&Backtrace>
814
where
815
    C: 'static,
816
{
817
    let unerased = e.cast::<ErrorImpl<ContextError<C, Error>>>().deref();
818
    let backtrace = ErrorImpl::backtrace(unerased._object.error.inner.by_ref());
819
    Some(backtrace)
820
}
821
822
// NOTE: If working with `ErrorImpl<()>`, references should be avoided in favor
823
// of raw pointers and `NonNull`.
824
// repr C to ensure that E remains in the final position.
825
#[repr(C)]
826
pub(crate) struct ErrorImpl<E = ()> {
827
    vtable: &'static ErrorVTable,
828
    backtrace: Option<Backtrace>,
829
    // NOTE: Don't use directly. Use only through vtable. Erased type may have
830
    // different alignment.
831
    _object: E,
832
}
833
834
// Reads the vtable out of `p`. This is the same as `p.as_ref().vtable`, but
835
// avoids converting `p` into a reference.
836
632
unsafe fn vtable(p: NonNull<ErrorImpl>) -> &'static ErrorVTable {
837
632
    // NOTE: This assumes that `ErrorVTable` is the first field of ErrorImpl.
838
632
    *(p.as_ptr() as *const &'static ErrorVTable)
839
632
}
840
841
// repr C to ensure that ContextError<C, E> has the same layout as
842
// ContextError<ManuallyDrop<C>, E> and ContextError<C, ManuallyDrop<E>>.
843
#[repr(C)]
844
pub(crate) struct ContextError<C, E> {
845
    pub context: C,
846
    pub error: E,
847
}
848
849
impl<E> ErrorImpl<E> {
850
0
    fn erase(&self) -> Ref<ErrorImpl> {
851
0
        // Erase the concrete type of E but preserve the vtable in self.vtable
852
0
        // for manipulating the resulting thin pointer. This is analogous to an
853
0
        // unsize coercion.
854
0
        Ref::new(self).cast::<ErrorImpl>()
855
0
    }
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, vm_memory::guest_memory::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, base::tube::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, base::errno::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<devices::pci::coiommu::Error, vm_memory::guest_memory::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<devices::pci::coiommu::Error, base::errno::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, ciborium::de::error::Error<std::io::error::Error>>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, ciborium::ser::error::Error<std::io::error::Error>>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, std::sync::mpsc::SendError<devices::virtio::console::worker::WorkerRequest>>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, vhost::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, resources::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, vmm_vhost::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, disk::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::pit::PitError>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::vfio::VfioError>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, vm_memory::guest_memory::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, cros_async::io_ext::AsyncError>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, vm_control::api::ApiClientError>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, std::time::SystemTimeError>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, base::mmap::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::pci::pci_device::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::virtio::iommu::IommuError>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::irqchip::ioapic::IoapicError>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::irqchip::userspace::TimerWorkerError>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, std::sync::mpsc::RecvError>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::virtio::vhost_user_frontend::error::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::virtio::block::asynchronous::ControlError>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::virtio::block::asynchronous::ExecuteError>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<ciborium::de::error::Error<std::io::error::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<ciborium::ser::error::Error<std::io::error::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<vhost::Error>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<vmm_vhost::Error>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::serial_device::Error>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<cros_async::io_ext::AsyncError>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<base::tube::Error>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::pci::pci_device::Error>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::pci::msix::MsixError>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::virtio::vhost::Error>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::irqchip::ioapic::IoapicError>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::virtio::vhost_user_frontend::error::Error>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::virtio::vhost::user::device::handler::Error>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, minijail::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, minijail::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::DisplayError<alloc::string::String>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<minijail::Error>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, anyhow::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, rutabaga_gfx::rutabaga_utils::RutabagaError>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, base::tube::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<base::errno::Error>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, serde_json::error::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, std::io::error::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind, anyhow::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind, std::io::error::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::DisplayError<&str>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::ffi::c_str::NulError>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<core::num::error::TryFromIntError>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<core::str::error::Utf8Error>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<std::io::error::Error>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, base::errno::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<ciborium::value::error::Error>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<base::mmap::Error>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<base::errno::Error>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, std::io::error::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, anyhow::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, std::io::error::Error>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<std::io::error::Error>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::string::String>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<&str>>>::erase
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::BoxedError>>::erase
856
}
857
858
impl ErrorImpl {
859
0
    pub(crate) unsafe fn error(this: Ref<Self>) -> &(dyn StdError + Send + Sync + 'static) {
860
0
        // Use vtable to attach E's native StdError vtable for the right
861
0
        // original type E.
862
0
        (vtable(this.ptr).object_ref)(this).deref()
863
0
    }
864
865
    #[cfg(feature = "std")]
866
0
    pub(crate) unsafe fn error_mut(this: Mut<Self>) -> &mut (dyn StdError + Send + Sync + 'static) {
867
0
        // Use vtable to attach E's native StdError vtable for the right
868
0
        // original type E.
869
0
870
0
        #[cfg(not(anyhow_no_ptr_addr_of))]
871
0
        return (vtable(this.ptr).object_ref)(this.by_ref())
872
0
            .by_mut()
873
0
            .deref_mut();
874
0
875
0
        #[cfg(anyhow_no_ptr_addr_of)]
876
0
        return (vtable(this.ptr).object_mut)(this);
877
0
    }
878
879
    #[cfg(any(backtrace, feature = "backtrace"))]
880
    pub(crate) unsafe fn backtrace(this: Ref<Self>) -> &Backtrace {
881
        // This unwrap can only panic if the underlying error's backtrace method
882
        // is nondeterministic, which would only happen in maliciously
883
        // constructed code.
884
        this.deref()
885
            .backtrace
886
            .as_ref()
887
            .or_else(|| {
888
                #[cfg(backtrace)]
889
                return Self::error(this).backtrace();
890
                #[cfg(all(not(backtrace), feature = "backtrace"))]
891
                return (vtable(this.ptr).object_backtrace)(this);
892
            })
893
            .expect("backtrace capture failed")
894
    }
895
896
    #[cold]
897
0
    pub(crate) unsafe fn chain(this: Ref<Self>) -> Chain {
898
0
        Chain::new(Self::error(this))
899
0
    }
900
}
901
902
impl<E> StdError for ErrorImpl<E>
903
where
904
    E: StdError,
905
{
906
    #[cfg(backtrace)]
907
    fn backtrace(&self) -> Option<&Backtrace> {
908
        Some(unsafe { ErrorImpl::backtrace(self.erase()) })
909
    }
910
911
0
    fn source(&self) -> Option<&(dyn StdError + 'static)> {
912
0
        unsafe { ErrorImpl::error(self.erase()).source() }
913
0
    }
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, vm_memory::guest_memory::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, base::tube::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, base::errno::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<devices::pci::coiommu::Error, vm_memory::guest_memory::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<devices::pci::coiommu::Error, base::errno::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, ciborium::de::error::Error<std::io::error::Error>>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, ciborium::ser::error::Error<std::io::error::Error>>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, std::sync::mpsc::SendError<devices::virtio::console::worker::WorkerRequest>>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, vhost::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, resources::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, vmm_vhost::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, disk::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::pit::PitError>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::vfio::VfioError>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, vm_memory::guest_memory::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, cros_async::io_ext::AsyncError>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, vm_control::api::ApiClientError>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, std::time::SystemTimeError>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, base::mmap::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::pci::pci_device::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::virtio::iommu::IommuError>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::irqchip::ioapic::IoapicError>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::irqchip::userspace::TimerWorkerError>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, std::sync::mpsc::RecvError>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::virtio::vhost_user_frontend::error::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::virtio::block::asynchronous::ControlError>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::virtio::block::asynchronous::ExecuteError>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<ciborium::de::error::Error<std::io::error::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<ciborium::ser::error::Error<std::io::error::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<vhost::Error> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<vmm_vhost::Error> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::serial_device::Error> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<cros_async::io_ext::AsyncError> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<base::tube::Error> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::pci::pci_device::Error> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::pci::msix::MsixError> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::virtio::vhost::Error> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::irqchip::ioapic::IoapicError> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::virtio::vhost_user_frontend::error::Error> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::virtio::vhost::user::device::handler::Error> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, minijail::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, minijail::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::DisplayError<alloc::string::String>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<minijail::Error> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, anyhow::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, rutabaga_gfx::rutabaga_utils::RutabagaError>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, base::tube::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<base::errno::Error> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, serde_json::error::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, std::io::error::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind, anyhow::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind, std::io::error::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::DisplayError<&str>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::ffi::c_str::NulError>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<core::num::error::TryFromIntError> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<core::str::error::Utf8Error> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<std::io::error::Error> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, base::errno::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<ciborium::value::error::Error> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<base::mmap::Error> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<base::errno::Error> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, std::io::error::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, anyhow::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, std::io::error::Error>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<std::io::error::Error> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::string::String>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<&str>> as core::error::Error>::source
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::BoxedError> as core::error::Error>::source
914
}
915
916
impl<E> Debug for ErrorImpl<E>
917
where
918
    E: Debug,
919
{
920
0
    fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
921
0
        unsafe { ErrorImpl::debug(self.erase(), formatter) }
922
0
    }
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, vm_memory::guest_memory::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, base::tube::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, base::errno::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<devices::pci::coiommu::Error, vm_memory::guest_memory::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<devices::pci::coiommu::Error, base::errno::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, ciborium::de::error::Error<std::io::error::Error>>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, ciborium::ser::error::Error<std::io::error::Error>>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, std::sync::mpsc::SendError<devices::virtio::console::worker::WorkerRequest>>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, vhost::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, resources::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, vmm_vhost::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, disk::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::pit::PitError>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::vfio::VfioError>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, vm_memory::guest_memory::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, cros_async::io_ext::AsyncError>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, vm_control::api::ApiClientError>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, std::time::SystemTimeError>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, base::mmap::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::pci::pci_device::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::virtio::iommu::IommuError>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::irqchip::ioapic::IoapicError>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::irqchip::userspace::TimerWorkerError>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, std::sync::mpsc::RecvError>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::virtio::vhost_user_frontend::error::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::virtio::block::asynchronous::ControlError>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::virtio::block::asynchronous::ExecuteError>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<ciborium::de::error::Error<std::io::error::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<ciborium::ser::error::Error<std::io::error::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<vhost::Error> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<vmm_vhost::Error> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::serial_device::Error> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<cros_async::io_ext::AsyncError> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<base::tube::Error> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::pci::pci_device::Error> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::pci::msix::MsixError> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::virtio::vhost::Error> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::irqchip::ioapic::IoapicError> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::virtio::vhost_user_frontend::error::Error> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::virtio::vhost::user::device::handler::Error> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, minijail::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, minijail::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::DisplayError<alloc::string::String>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<minijail::Error> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, anyhow::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, rutabaga_gfx::rutabaga_utils::RutabagaError>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, base::tube::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<base::errno::Error> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, serde_json::error::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, std::io::error::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind, anyhow::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind, std::io::error::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::DisplayError<&str>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::ffi::c_str::NulError>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<core::num::error::TryFromIntError> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<core::str::error::Utf8Error> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<std::io::error::Error> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, base::errno::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<ciborium::value::error::Error> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<base::mmap::Error> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<base::errno::Error> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, std::io::error::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, anyhow::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, std::io::error::Error>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<std::io::error::Error> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::string::String>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<&str>> as core::fmt::Debug>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::BoxedError> as core::fmt::Debug>::fmt
923
}
924
925
impl<E> Display for ErrorImpl<E>
926
where
927
    E: Display,
928
{
929
0
    fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
930
0
        unsafe { Display::fmt(ErrorImpl::error(self.erase()), formatter) }
931
0
    }
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, vm_memory::guest_memory::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, base::tube::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, base::errno::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<devices::pci::coiommu::Error, vm_memory::guest_memory::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<devices::pci::coiommu::Error, base::errno::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, ciborium::de::error::Error<std::io::error::Error>>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, ciborium::ser::error::Error<std::io::error::Error>>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, std::sync::mpsc::SendError<devices::virtio::console::worker::WorkerRequest>>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, vhost::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, resources::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, vmm_vhost::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, disk::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::pit::PitError>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::vfio::VfioError>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, vm_memory::guest_memory::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, cros_async::io_ext::AsyncError>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, vm_control::api::ApiClientError>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, std::time::SystemTimeError>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, base::mmap::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::pci::pci_device::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::virtio::iommu::IommuError>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::irqchip::ioapic::IoapicError>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::irqchip::userspace::TimerWorkerError>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, std::sync::mpsc::RecvError>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::virtio::vhost_user_frontend::error::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::virtio::block::asynchronous::ControlError>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, devices::virtio::block::asynchronous::ExecuteError>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<ciborium::de::error::Error<std::io::error::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<ciborium::ser::error::Error<std::io::error::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<vhost::Error> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<vmm_vhost::Error> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::serial_device::Error> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<cros_async::io_ext::AsyncError> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<base::tube::Error> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::pci::pci_device::Error> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::pci::msix::MsixError> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::virtio::vhost::Error> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::irqchip::ioapic::IoapicError> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::virtio::vhost_user_frontend::error::Error> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<devices::virtio::vhost::user::device::handler::Error> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, minijail::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, minijail::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::DisplayError<alloc::string::String>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<minijail::Error> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, anyhow::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, rutabaga_gfx::rutabaga_utils::RutabagaError>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, base::tube::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<base::errno::Error> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, serde_json::error::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, std::io::error::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind, anyhow::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<rutabaga_gfx::rutabaga_utils::RutabagaErrorKind, std::io::error::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::DisplayError<&str>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::ffi::c_str::NulError>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<core::num::error::TryFromIntError> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<core::str::error::Utf8Error> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<std::io::error::Error> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, base::errno::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<ciborium::value::error::Error> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<base::mmap::Error> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<base::errno::Error> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<alloc::string::String, std::io::error::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, anyhow::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::error::ContextError<&str, std::io::error::Error>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<std::io::error::Error> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<alloc::string::String>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::MessageError<&str>> as core::fmt::Display>::fmt
Unexecuted instantiation: <anyhow::error::ErrorImpl<anyhow::wrapper::BoxedError> as core::fmt::Display>::fmt
932
}
933
934
impl From<Error> for Box<dyn StdError + Send + Sync + 'static> {
935
    #[cold]
936
0
    fn from(error: Error) -> Self {
937
0
        let outer = ManuallyDrop::new(error);
938
0
        unsafe {
939
0
            // Use vtable to attach ErrorImpl<E>'s native StdError vtable for
940
0
            // the right original type E.
941
0
            (vtable(outer.inner.ptr).object_boxed)(outer.inner)
942
0
        }
943
0
    }
944
}
945
946
impl From<Error> for Box<dyn StdError + Send + 'static> {
947
0
    fn from(error: Error) -> Self {
948
0
        Box::<dyn StdError + Send + Sync>::from(error)
949
0
    }
950
}
951
952
impl From<Error> for Box<dyn StdError + 'static> {
953
0
    fn from(error: Error) -> Self {
954
0
        Box::<dyn StdError + Send + Sync>::from(error)
955
0
    }
956
}
957
958
#[cfg(feature = "std")]
959
impl AsRef<dyn StdError + Send + Sync> for Error {
960
0
    fn as_ref(&self) -> &(dyn StdError + Send + Sync + 'static) {
961
0
        &**self
962
0
    }
963
}
964
965
#[cfg(feature = "std")]
966
impl AsRef<dyn StdError> for Error {
967
0
    fn as_ref(&self) -> &(dyn StdError + 'static) {
968
0
        &**self
969
0
    }
970
}