]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/issues/issue-67611-static-mut-refs.rs
Rollup merge of #71627 - ldm0:autoderefarg, r=Dylan-DPC
[rust.git] / src / test / ui / async-await / issues / issue-67611-static-mut-refs.rs
1 // build-pass
2 // edition:2018
3
4 static mut A: [i32; 5] = [1, 2, 3, 4, 5];
5
6 fn is_send_sync<T: Send + Sync>(_: T) {}
7
8 async fn fun() {
9     let u = unsafe { A[async { 1 }.await] };
10     unsafe {
11         match A {
12             i if async { true }.await => (),
13             _ => (),
14         }
15     }
16 }
17
18 fn main() {
19     let index_block = async {
20         let u = unsafe { A[async { 1 }.await] };
21     };
22     let match_block = async {
23         unsafe {
24             match A {
25                 i if async { true }.await => (),
26                 _ => (),
27             }
28         }
29     };
30     is_send_sync(index_block);
31     is_send_sync(match_block);
32     is_send_sync(fun());
33 }