Skip to content
Myr

Add miri to CI

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Thom Chiovoloni · committed by Thom Chiovoloni · parent 87fdd9e · Browse files · 2 files+16 added−12 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+16 added−12 removed

  • other:+16 added−12 removed

2 files+16 added−12 removed

modified:.github/workflows/ci.yml+10 added
modified:src/error.rs+6 added-12 removed
384 unmodified lines
385386 // Read E from where the vtable found it.387 let error = ptr::read(addr.cast::<E>().as_ptr());388389 // Read Bib<ErrorImpl<()>> from self. Can't move it out because390 // Error has a Drop impl which we want to not run.391 let inner = outer.inner;392389 // Drop rest of the data structure outside of E.394 (vtable(inner).object_drop_rest)(outer.inner, target);390 (vtable(outer.inner).object_drop_rest)(outer.inner, target);391392 Ok(error)393 }394 }
186 unmodified lines
581 None582 }583}584589// Safety: requires layout of *e to match ErrorImpl<E> and for deriving a &mut590// from `e` not to violate provenance585// Safety: requires layout of *e to match ErrorImpl<E>.586unsafe fn object_downcast_mut<E>(e: NonNull<ErrorImpl<()>>, target: TypeId) -> Option<NonNull<()>>587where588 E: 'static,589{
144 unmodified lines
734 // different alignment.735 _object: E,736}737743// Read the vtable out of `p`. This is the same as `p.as_ref().vtable`, but738// Reads the vtable out of `p`. This is the same as `p.as_ref().vtable`, but739// avoids converting `p` into a reference.740#[inline]741unsafe fn vtable<E>(p: NonNull<ErrorImpl<E>>) -> &'static ErrorVTable {742 // NOTE: This assumes that `ErrorVTable` is the first field of ErrorImpl.
27 unmodified lines
770 }771772 #[cfg(backtrace)]773 pub(crate) unsafe fn backtrace<'a>(this: NonNull<Self>) -> &'a Backtrace {779 // Ideally we would use a raw ref to access `backtrace`, but I780 // don't think this matters given how we use781 let backtrace = (*this.as_ptr()).backtrace.as_ref();774 // This unwrap can only panic if the underlying error's backtrace method775 // is nondeterministic, which would only happen in maliciously776 // constructed code.777 (*this.as_ptr())785 backtrace778 .backtrace779 .as_ref()780 .or_else(|| Self::error(this).backtrace())781 .expect("backtrace capture failed")782 }783
82 unmodified lines