2019-10-06 21:58:32 +08:00
|
|
|
//@ edition:2018
|
|
|
|
//@ run-rustfix
|
|
|
|
|
2020-04-07 23:57:26 +02:00
|
|
|
fn test_boxed() -> Box<impl std::future::Future<Output = u32>> {
|
2019-10-06 21:58:32 +08:00
|
|
|
let x = 0u32;
|
|
|
|
Box::new(async move { x } )
|
|
|
|
//~^ ERROR E0373
|
|
|
|
}
|
|
|
|
|
2020-04-07 23:57:26 +02:00
|
|
|
fn test_ref(x: &u32) -> impl std::future::Future<Output = u32> + '_ {
|
|
|
|
async move { *x }
|
|
|
|
//~^ ERROR E0373
|
|
|
|
}
|
|
|
|
|
2019-10-06 21:58:32 +08:00
|
|
|
fn main() {
|
2020-04-07 23:57:26 +02:00
|
|
|
let _ = test_boxed();
|
|
|
|
let _ = test_ref(&0u32);
|
2019-10-06 21:58:32 +08:00
|
|
|
}
|