blob: 89af3c9a583c26c830d34e02baf463744bc2bfb0 [file] [log] [blame]
//@ edition: 2021
// Regression tests for #137916 and #138274
// We now check stalled coroutine obligations eagerly at the start of `mir_borrowck`.
// So these unsatisfied bounds are caught before causing ICEs.
use std::ptr::null;
async fn a() -> Box<dyn Send> {
Box::new(async {
//~^ ERROR: future cannot be sent between threads safely
let non_send = null::<()>();
&non_send;
async {}.await
})
}
trait Trait {}
fn foo() -> Box<dyn Trait> { todo!() }
fn fetch() {
async {
let fut = async {
let _x = foo();
async {}.await;
};
let _: Box<dyn Send> = Box::new(fut);
//~^ ERROR: future cannot be sent between threads safely
};
}
fn main() {}