-
Notifications
You must be signed in to change notification settings - Fork 645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
futures-channel fails under Miri #2669
Comments
Preliminary debugging results:
This |
The error occurs even without #![feature(pin_macro)]
use futures::{channel::mpsc, sink::SinkExt, stream::StreamExt};
use std::future::Future;
use std::pin::pin;
use std::sync::Arc;
use std::task::*;
async fn send_sequence(n: u32, mut sender: mpsc::Sender<u32>) {
for x in 0..n {
sender.send(n - x).await.unwrap();
}
}
fn main() {
let (tx, rx) = mpsc::channel(1);
let mut sender = pin!(send_sequence(20, tx));
let mut receiver = pin!(rx.collect::<Vec<_>>());
struct MyWaker;
impl Wake for MyWaker {
fn wake(self: Arc<Self>) {}
}
let waker = Waker::from(Arc::new(MyWaker));
let mut context = Context::from_waker(&waker);
let _ = sender.as_mut().poll(&mut context);
let _ = receiver.as_mut().poll(&mut context);
let _ = sender.as_mut().poll(&mut context);
} |
So this is what happens:
So... well we could go back to Miri not doing 'fake' accesses on Either way, this is not a bug in futures-rs. |
The one thing I am still struggling to do is reproduce this without futures-rs. For some reason this one does not fail. Cc @saethlin -- an interesting Stacked Borrows issue |
All right, I think I dug (mostly) to the bottom of this. See rust-lang/unsafe-code-guidelines#381 for details. |
Addressed by rust-lang/miri#2713. |
Discovered while discussing rust-lang/unsafe-code-guidelines#380, probably related to rust-lang/unsafe-code-guidelines#148.
This code (playground):
fails under Miri.
The text was updated successfully, but these errors were encountered: