diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 96917f8..082ed67 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,3 +39,13 @@ jobs: - uses: actions/checkout@v2 - uses: dtolnay/rust-toolchain@clippy - run: cargo clippy -- -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 test diff --git a/src/any.rs b/src/any.rs index 6fe05c2..fa01461 100644 --- a/src/any.rs +++ b/src/any.rs @@ -85,7 +85,7 @@ impl Any { // This is unsafe -- caller is responsible that T is the correct type. pub(crate) fn view(&mut self) -> &mut T { - if self.fingerprint != Fingerprint::of::() { + if cfg!(not(miri)) && self.fingerprint != Fingerprint::of::() { self.invalid_cast_to::(); } @@ -100,7 +100,7 @@ impl Any { // This is unsafe -- caller is responsible that T is the correct type. pub(crate) fn take(mut self) -> T { - if self.fingerprint != Fingerprint::of::() { + if cfg!(not(miri)) && self.fingerprint != Fingerprint::of::() { self.invalid_cast_to::(); } @@ -168,6 +168,7 @@ impl Fingerprint { } } +#[cfg(not(miri))] #[test] fn test_fingerprint() { assert_eq!(Fingerprint::of::(), Fingerprint::of::());