]> git.proxmox.com Git - rustc.git/blame - src/test/ui/async-await/issue-76547.rs
New upstream version 1.65.0+dfsg1
[rustc.git] / src / test / ui / async-await / issue-76547.rs
CommitLineData
29967ef6
XL
1// Test for diagnostic improvement issue #76547
2// edition:2018
3
4use std::{
5 future::Future,
6 task::{Context, Poll}
7};
8use std::pin::Pin;
9
10pub struct ListFut<'a>(&'a mut [&'a mut [u8]]);
11impl<'a> Future for ListFut<'a> {
12 type Output = ();
13
14 fn poll(self: Pin<&mut Self>, _cx: &mut Context) -> Poll<Self::Output> {
15 unimplemented!()
16 }
17}
18
19async fn fut(bufs: &mut [&mut [u8]]) {
20 ListFut(bufs).await
923072b8 21 //~^ ERROR lifetime may not live long enough
29967ef6
XL
22}
23
24pub struct ListFut2<'a>(&'a mut [&'a mut [u8]]);
25impl<'a> Future for ListFut2<'a> {
26 type Output = i32;
27
28 fn poll(self: Pin<&mut Self>, _cx: &mut Context) -> Poll<Self::Output> {
29 unimplemented!()
30 }
31}
32
33async fn fut2(bufs: &mut [&mut [u8]]) -> i32 {
34 ListFut2(bufs).await
923072b8 35 //~^ ERROR lifetime may not live long enough
29967ef6
XL
36}
37
38fn main() {}