Skip to content

[CI] miri test fails due to rkyvlib #1042

@mablr

Description

@mablr

Abstract

Therkyv's lib ArchivedVec::as_slice()method triggers a Stacked Borrows violation when running tests under miri.

Reproduction

Test location:

#[test]
fn rkyv_roundtrip() {
let bytes = Bytes::from_static(&[1, 35, 69, 103, 137, 171, 205, 239]);
let ser = rkyv::to_bytes::<rancor::BoxedError>(&bytes).unwrap();
let archived = rkyv::access::<Archived<Bytes>, rancor::BoxedError>(&ser).unwrap();
assert_eq!(bytes.as_ref(), archived.as_slice());
let des = rkyv::deserialize::<Bytes, rancor::BoxedError>(archived).unwrap();
assert_eq!(bytes, des);
}

Command:

cargo +nightly miri test --all-features

Error:

  error: Undefined Behavior: trying to retag from <...> for SharedReadOnly permission,
  but that tag does not exist in the borrow stack for this location

Environment:

  • rkyv 0.8.12
  • nightly Rust with miri

Fix ?

Is it acceptable to mark rkyv_roundtrip test as #[cfg(not(miri))] ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions