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