TOXJRHV7ZUPHWXCA4TAG3YRBTIPUZQ5BNX34D3VD2JAIYLRN6XSAC
UPPVYBGC7MQBUCAAB6KW3R5KWHGASFTTXVUHEWRNP27SK3CI7UHQC
CZP5PD5NYLDULLW43VOL6V75CH6DDEJO7H6JSGQSIV2WNSQF4A6QC
ZKAEZKAMMQWPQIV6X2CFQUUOG7RBJOE3MNXLBH4J3ZASUYTCZJAQC
LX7EZ6TKJCQI3K7SV56WMTPFY672WN5UOBGXKKXQI7S73GMWNNXAC
CITEDKPB6MKVZUEYEDE5ZKTNVY35HCOAXKDPYG7YLLEOVFNMSRXQC
UV757IN647TV4DBKTK2QYSGVFPM7W7M6MBU3CDDGIOICNNWK33GQC
KCOCFOS6KMCTVS6K3WE6KOQSWC3QNWN2E36ASHQPP3Z3H4BHR3NQC
GZZOJ7ZUSBPI3HXIV5UCFNMCDAMZPPLISY2UDV73FDN74HZ3AWJAC
NPOFDGQF4CE72IZBT5Y7KPIBHWPPNOEPBYD5RTUHSVUJ2W4XFRVQC
Z4YYQXEE4OQPF22I4LD7RVQIBKK67AHCYR6C35MANUCIC4P3EPYQC
RIKD63GT7RFV3UAV4BYD57GFXKXALWUP6J7AAHB3M6JVAZ3WFTXAC
F5MLEQJFOB443KKN22TYYJN2TR52653MD4VXSEYZQBNWWJYES5VQC
EXRAFG37562NH775A4LDPP5FNKXLPLIZSJ3FCOBINUDKRFBJHCXAC
T64LKJ2RTUDFYSJQI7KF4WHZYXZHNEGNOS7ZMMCRIQZ4YN5LOOMAC
let type_id = TypeId::of::<E>();
let vtable = &ErrorVTable {
object_drop: object_drop::<E>,
object_drop_front: object_drop_front::<E>,
object_ref: object_ref::<E>,
object_mut: object_mut::<E>,
object_boxed: object_boxed::<E>,
object_is: object_is::<E>,
};
let type_id = TypeId::of::<M>();
let vtable = &ErrorVTable {
object_drop: object_drop::<MessageError<M>>,
object_drop_front: object_drop_front::<MessageError<M>>,
object_ref: object_ref::<MessageError<M>>,
object_mut: object_mut::<MessageError<M>>,
object_boxed: object_boxed::<MessageError<M>>,
object_is: object_is::<M>,
};
// Safety: MessageError is repr(transparent) so MessageError<M> has the
// same layout as the typeid specifies.
unsafe { Error::construct(error, type_id, backtrace) }
// Safety: MessageError is repr(transparent) so it is okay for the
// vtable to allow casting the MessageError<M> to M.
unsafe { Error::construct(error, vtable, backtrace) }
let type_id = TypeId::of::<M>();
let vtable = &ErrorVTable {
object_drop: object_drop::<DisplayError<M>>,
object_drop_front: object_drop_front::<DisplayError<M>>,
object_ref: object_ref::<DisplayError<M>>,
object_mut: object_mut::<DisplayError<M>>,
object_boxed: object_boxed::<DisplayError<M>>,
object_is: object_is::<M>,
};
// Safety: DisplayError is repr(transparent) so DisplayError<M> has the
// same layout as the typeid specifies.
unsafe { Error::construct(error, type_id, backtrace) }
// Safety: DisplayError is repr(transparent) so it is okay for the
// vtable to allow casting the DisplayError<M> to M.
unsafe { Error::construct(error, vtable, backtrace) }
// Unsafe because the type represented by type_id must have the same layout
// as E or else we allow invalid downcasts.
unsafe fn construct<E>(error: E, type_id: TypeId, backtrace: Option<Backtrace>) -> Self
// Unsafe because the given vtable must have sensible behavior on the error
// value of type E.
unsafe fn construct<E>(
error: E,
vtable: &'static ErrorVTable,
backtrace: Option<Backtrace>,
) -> Self
let vtable = &ErrorVTable {
object_drop: object_drop::<E>,
object_drop_front: object_drop_front::<E>,
object_ref: object_ref::<E>,
object_mut: object_mut::<E>,
object_boxed: object_boxed::<E>,
};