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
Provenance
- Commit
9757e7f- Tree
e67f66c- Author
Thom Chiovoloni <chiovolonit@gmail.com>- Committer
Thom Chiovoloni <chiovolonit@gmail.com>- Parent
87fdd9e
2 files changed+16 added−12 removed
modified:.github/workflows/ci.yml+10 added
42 unmodified lines434445464748495051525354555642 unmodified lines steps: - uses: actions/checkout@v2 - uses: dtolnay/rust-toolchain@clippy - run: cargo clippy --tests -- -Dclippy::all -Dclippy::pedantic
miri: name: Miri runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: dtolnay/rust-toolchain@nightly with: components: miri - run: cargo miri testmodified:src/error.rs+6 added-12 removed
384 unmodified lines385 386 // Read E from where the vtable found it.387 let error = ptr::read(addr.cast::<E>().as_ptr());388 389- // 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;392-389 // 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);391 392 Ok(error)393 }394 }186 unmodified lines581 None582 }583 }584 589-// 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>.586 unsafe fn object_downcast_mut<E>(e: NonNull<ErrorImpl<()>>, target: TypeId) -> Option<NonNull<()>>587 where588 E: 'static,589 {144 unmodified lines734 // different alignment.735 _object: E,736 }737 743-// 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]741 unsafe fn vtable<E>(p: NonNull<ErrorImpl<E>>) -> &'static ErrorVTable {742 // NOTE: This assumes that `ErrorVTable` is the first field of ErrorImpl.27 unmodified lines770 }771 772 #[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