Skip to content

Miri reports "unsupported operation: unable to turn pointer into raw bytes" in futures-lite-1.12.0 #2068

Closed
rust-lang/rust
#96162
@saethlin

Description

@saethlin
failures:

---- src/stream.rs - stream::StreamExt::last (line 1325) stdout ----
Test executable failed (exit code 1).

stderr:
error: unsupported operation: unable to turn pointer into raw bytes
    --> /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:1096:9
     |
1096 |         copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
     |
     = help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
             
     = note: inside `std::ptr::read::<std::option::Option<i32>>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:1096:9
     = note: inside `std::mem::replace::<std::option::Option<i32>>` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/mem/mod.rs:904:22
     = note: inside `std::option::Option::<i32>::take` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/option.rs:1557:9
note: inside `<futures_lite::stream::LastFuture<futures_lite::stream::Empty<i32>> as futures_lite::Future>::poll` at /tmp/futures-lite-1.12.0/src/stream.rs:2735:44
    --> /tmp/futures-lite-1.12.0/src/stream.rs:2735:44
     |
2735 |                 None => return Poll::Ready(this.last.take()),
     |                                            ^^^^^^^^^^^^^^^^
note: inside closure at src/stream.rs:11:20
    --> src/stream.rs:1333:20
     |
11   | assert_eq!(s.last().await, None);
     |                    ^^^^^^
     = note: inside `<std::future::from_generator::GenFuture<[static generator@src/stream.rs:6:24: 12:2]> as futures_lite::Future>::poll` at /home/ben/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/future/mod.rs:91:19
     = note: inside `spin_on::spin_on::<std::future::from_generator::GenFuture<[static generator@src/stream.rs:6:24: 12:2]>>` at /home/ben/.cargo/registry/src/github.com-1ecc6299db9ec823/spin_on-0.1.1/src/lib.rs:78:38
note: inside `main::_doctest_main_src_stream_rs_1325_0` at src/stream.rs:6:1
    --> src/stream.rs:1328:1
     |
6    | / spin_on::spin_on(async {
7    | | let s = stream::iter(vec![1, 2, 3, 4]);
8    | | assert_eq!(s.last().await, Some(4));
9    | |
10   | | let s = stream::empty::<i32>();
11   | | assert_eq!(s.last().await, None);
12   | | });
     | |__^
note: inside `main` at src/stream.rs:13:3
    --> src/stream.rs:1335:3
     |
13   | } _doctest_main_src_stream_rs_1325_0() }
     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

error: aborting due to previous error

I'm very lost here. The only hypothesis I can come up with is that a dependency has written pointer bytes into that Option<i32>, but even if that is the case it doesn't make sense that Miri would report an unsupported operation. This should be a type validation failure, right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions