Skip to content

miri is detecting undefined behavior  #14

@joseluis

Description

@joseluis

Latest version of miri is not happy with that line in the make_fat_ptr function.

cargo +nightly miri test

test retain ... error: Undefined Behavior: constructing invalid value: encountered 0x2598e0[noalloc], but expected a vtable pointer
   --> stack_dst-rs/src/lib.rs:314:14
    |
314 |     let rv = rv.ptr;
    |              ^^^^^^ constructing invalid value: encountered 0x2598e0[noalloc], but expected a vtable pointer
    |
    
   --> stack_dst-rs/src/fifo.rs:224:23
    |
224 |                 &mut *super::make_fat_ptr(data.as_mut_ptr() as *mut (), meta)
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside `retain`
   --> tests/fifo.rs:71:5
    |
71  |     stack.retain(|v| v.as_ref().0 > 2);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> tests/fifo.rs:47:12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions