| 1882 | } |
| 1883 | |
| 1884 | pub(crate) fn as_dyn_core_error(&self) -> &(dyn core::error::Error + Send + Sync + 'static) { |
| 1885 | match self.unpack() { |
| 1886 | OomOrDynErrorRef::DynError(e) => { |
| 1887 | // Safety: invariant of this type. |
| 1888 | let vtable = unsafe { e.as_ref().vtable }; |
| 1889 | // Safety: using the vtable associated with this pointer's |
| 1890 | // concrete type and the pointer is valid. |
| 1891 | unsafe { (vtable.as_dyn_core_error)(e) } |
| 1892 | } |
| 1893 | OomOrDynErrorRef::Oom(oom) => oom as _, |
| 1894 | } |
| 1895 | } |
| 1896 | |
| 1897 | #[cfg(feature = "backtrace")] |
| 1898 | fn backtrace(&self) -> &Backtrace { |