Skip to content

Commit 6672907

Browse files
committed
add test for lifetime inside generator witness
1 parent 3f0f10a commit 6672907

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// edition: 2018
2+
3+
async fn use_async<T>(_val: T) {}
4+
5+
struct MyStruct<'a, T: 'a> {
6+
val: &'a T
7+
}
8+
9+
unsafe impl<'a, T: 'a> Send for MyStruct<'a, T> {}
10+
11+
async fn use_my_struct(val: MyStruct<'static, &'static u8>) {
12+
use_async(val).await;
13+
}
14+
15+
fn main() {
16+
let first_struct: MyStruct<'static, &'static u8> = MyStruct { val: &&26 };
17+
needs_send(use_my_struct(second_struct));
18+
}

0 commit comments

Comments
 (0)