More precisely Checked<Fut: Future>
|
struct Checked<F> { |
|
id: ThreadId, |
|
inner: ManuallyDrop<F>, |
|
} |
Playground
async fn yield_now() {
let mut yielded = false;
let yield_now = poll_fn(|cx| {
if yielded {
return Poll::Ready(());
}
yielded = true;
cx.waker().wake_by_ref();
Poll::Pending
});
yield_now.await;
println!("Done");
}
Miri complain:
Compiling playground v0.0.1 (/playground)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.60s
Running `/playground/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo-miri runner target/miri/x86_64-unknown-linux-gnu/debug/playground`
error: Undefined Behavior: attempting a read access using <2044> at alloc247[0x10], but that tag does not exist in the borrow stack for this location
--> src/main.rs:19:12
|
19 | if yielded {
| ^^^^^^^ this error occurs as part of an access at alloc247[0x10..0x11]
|
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
help: <2044> was created by a Unique retag at offsets [0x10..0x11]
--> src/main.rs:26:5
|
26 | yield_now.await;
| ^^^^^^^^^^^^^^^
help: <2044> was later invalidated at offsets [0x0..0x18] by a Unique retag
--> src/main.rs:11:16
|
11 | future.await;
More precisely
Checked<Fut: Future>async-task/src/runnable.rs
Lines 449 to 452 in b4486cd
Playground
Miri complain: