1 // build-pass (FIXME(62277): could be check-pass?)
3 // compile-flags: --crate-type lib
5 #![feature(async_await)]
13 fn non_sync() -> impl Debug { RefCell::new(()) }
15 fn non_send() -> impl Debug { Rc::new(()) }
17 fn take_ref<T>(_: &T) {}
21 async fn fut_arg<T>(_: T) {}
23 async fn still_send() {
25 println!("{:?} {:?}", non_send(), non_sync());
30 fut_arg(non_sync()).await;
32 // Note: all temporaries in `if let` and `match` scrutinee
33 // are dropped at the *end* of the blocks, so using `non_send()`
34 // in either of those positions with an await in the middle will
35 // cause a `!Send` future. It might be nice in the future to allow
36 // this for `Copy` types, since they can be "dropped" early without
37 // affecting the end user.
38 if let Some(_) = Some(non_sync()) {
41 match Some(non_sync()) {
42 Some(_) => fut().await,
55 fn assert_send(_: impl Send) {}
57 pub fn pass_assert() {
58 assert_send(still_send());