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
object_mut: object_mut::<E>,
object_boxed: object_boxed::<E>,
object_downcast: object_downcast::<E>,
object_drop_rest: object_drop_front::<E>,
object_mut: object_mut::<E, C>,
object_boxed: object_boxed::<E, C>,
object_downcast: object_downcast::<E, C>,
object_drop_rest: object_drop_front::<E, C>,
object_mut: object_mut::<MessageError<M>>,
object_boxed: object_boxed::<MessageError<M>>,
object_downcast: object_downcast::<M>,
object_drop_rest: object_drop_front::<M>,
object_mut: object_mut::<MessageError<M>, C>,
object_boxed: object_boxed::<MessageError<M>, C>,
object_downcast: object_downcast::<M, C>,
object_drop_rest: object_drop_front::<M, C>,
object_mut: object_mut::<DisplayError<M>>,
object_boxed: object_boxed::<DisplayError<M>>,
object_downcast: object_downcast::<M>,
object_drop_rest: object_drop_front::<M>,
object_mut: object_mut::<DisplayError<M>, C>,
object_boxed: object_boxed::<DisplayError<M>, C>,
object_downcast: object_downcast::<M, C>,
object_drop_rest: object_drop_front::<M, C>,
object_mut: object_mut::<ContextError<C, E>>,
object_boxed: object_boxed::<ContextError<C, E>>,
object_downcast: context_downcast::<C, E>,
object_drop_rest: context_drop_rest::<C, E>,
object_mut: object_mut::<ContextError<D, E>, C>,
object_boxed: object_boxed::<ContextError<D, E>, C>,
object_downcast: context_downcast::<D, E, C>,
object_drop_rest: context_drop_rest::<D, E, C>,
object_mut: object_mut::<BoxedError>,
object_boxed: object_boxed::<BoxedError>,
object_downcast: object_downcast::<Box<dyn StdError + Send + Sync>>,
object_drop_rest: object_drop_front::<Box<dyn StdError + Send + Sync>>,
object_mut: object_mut::<BoxedError, C>,
object_boxed: object_boxed::<BoxedError, C>,
object_downcast: object_downcast::<Box<dyn StdError + Send + Sync>, C>,
object_drop_rest: object_drop_front::<Box<dyn StdError + Send + Sync>, C>,
object_mut: object_mut::<ContextError<C, ErrReport>>,
object_boxed: object_boxed::<ContextError<C, ErrReport>>,
object_downcast: context_chain_downcast::<C>,
object_drop_rest: context_chain_drop_rest::<C>,
object_mut: object_mut::<ContextError<D, ErrReport<C>>, C>,
object_boxed: object_boxed::<ContextError<D, ErrReport<C>>, C>,
object_downcast: context_chain_downcast::<D, C>,
object_drop_rest: context_chain_drop_rest::<D, C>,
struct ErrorVTable {
object_drop: unsafe fn(Box<ErrorImpl<()>>),
object_ref: unsafe fn(&ErrorImpl<()>) -> &(dyn StdError + Send + Sync + 'static),
struct ErrorVTable<C>
where
C: EyreContext,
{
object_drop: unsafe fn(Box<ErrorImpl<(), C>>),
object_ref: unsafe fn(&ErrorImpl<(), C>) -> &(dyn StdError + Send + Sync + 'static),
object_mut: unsafe fn(&mut ErrorImpl<()>) -> &mut (dyn StdError + Send + Sync + 'static),
object_boxed: unsafe fn(Box<ErrorImpl<()>>) -> Box<dyn StdError + Send + Sync + 'static>,
object_downcast: unsafe fn(&ErrorImpl<()>, TypeId) -> Option<NonNull<()>>,
object_drop_rest: unsafe fn(Box<ErrorImpl<()>>, TypeId),
object_mut: unsafe fn(&mut ErrorImpl<(), C>) -> &mut (dyn StdError + Send + Sync + 'static),
object_boxed: unsafe fn(Box<ErrorImpl<(), C>>) -> Box<dyn StdError + Send + Sync + 'static>,
object_downcast: unsafe fn(&ErrorImpl<(), C>, TypeId) -> Option<NonNull<()>>,
object_drop_rest: unsafe fn(Box<ErrorImpl<(), C>>, TypeId),
if TypeId::of::<C>() == target {
let unerased = e as *const ErrorImpl<()> as *const ErrorImpl<ContextError<C, E>>;
let addr = &(*unerased)._object.context as *const C as *mut ();
if TypeId::of::<D>() == target {
let unerased = e as *const ErrorImpl<(), C> as *const ErrorImpl<ContextError<D, E>, C>;
let addr = &(*unerased)._object.msg as *const D as *mut ();
// Safety: requires layout of *e to match ErrorImpl<ContextError<C, ErrReport>>.
unsafe fn context_chain_downcast<C>(e: &ErrorImpl<()>, target: TypeId) -> Option<NonNull<()>>
// Safety: requires layout of *e to match ErrorImpl<ContextError<D, ErrReport>>.
unsafe fn context_chain_downcast<D, C>(e: &ErrorImpl<(), C>, target: TypeId) -> Option<NonNull<()>>
if TypeId::of::<C>() == target {
let unerased = e as *const ErrorImpl<()> as *const ErrorImpl<ContextError<C, ErrReport>>;
let addr = &(*unerased)._object.context as *const C as *mut ();
if TypeId::of::<D>() == target {
let unerased = e as *const ErrorImpl<(), C> as *const ErrorImpl<ContextError<D, ErrReport<C>>, C>;
let addr = &(*unerased)._object.msg as *const D as *mut ();
// Safety: requires layout of *e to match ErrorImpl<ContextError<C, ErrReport>>.
unsafe fn context_chain_drop_rest<C>(e: Box<ErrorImpl<()>>, target: TypeId)
// Safety: requires layout of *e to match ErrorImpl<ContextError<D, ErrReport>>.
unsafe fn context_chain_drop_rest<D, C>(e: Box<ErrorImpl<(), C>>, target: TypeId)
pub(crate) struct ErrorImpl<E> {
vtable: &'static ErrorVTable,
backtrace: Option<Backtrace>,
pub(crate) struct ErrorImpl<E, C>
where
C: EyreContext,
{
vtable: &'static ErrorVTable<C>,
context: C,
// repr C to ensure that ContextError<C, E> has the same layout as
// ContextError<ManuallyDrop<C>, E> and ContextError<C, ManuallyDrop<E>>.
// repr C to ensure that ContextError<D, E> has the same layout as
// ContextError<ManuallyDrop<D>, E> and ContextError<D, ManuallyDrop<E>>.
pub fn new(self, error: Box<dyn StdError + Send + Sync>) -> ErrReport {
let backtrace = backtrace_if_absent!(error);
ErrReport::from_boxed(error, backtrace)
pub fn new<C: EyreContext>(self, error: Box<dyn StdError + Send + Sync>) -> ErrReport<C> {
ErrReport::from_boxed(error)
pub struct ErrReport {
inner: ManuallyDrop<Box<ErrorImpl<()>>>,
pub struct ErrReport<C = DefaultContext>
where
C: EyreContext,
{
inner: ManuallyDrop<Box<ErrorImpl<(), C>>>,
}
pub trait EyreContext: Sized + Send + Sync + 'static {
fn default(err: &(dyn std::error::Error + 'static)) -> Self;
fn context_raw(&self, typeid: TypeId) -> Option<&dyn Any>;
}
pub struct DefaultContext {
backtrace: Option<Backtrace>,
}
impl EyreContext for DefaultContext {
fn default(error: &(dyn std::error::Error + 'static)) -> Self {
let backtrace = backtrace_if_absent!(error);
Self {
backtrace
}
}
fn context_raw(&self, typid: TypeId) -> Option<&dyn Any> {
match typid {
t if t == TypeId::of::<Backtrace>() => self.backtrace.as_ref().map(|b| b as &dyn Any),
_ => None,
}
}