]> git.proxmox.com Git - rustc.git/blob - src/test/ui/issues/issue-76547.rs
New upstream version 1.50.0+dfsg1
[rustc.git] / src / test / ui / issues / issue-76547.rs
1 // Test for diagnostic improvement issue #76547
2 // edition:2018
3
4 use std::{
5 future::Future,
6 task::{Context, Poll}
7 };
8 use std::pin::Pin;
9
10 pub struct ListFut<'a>(&'a mut [&'a mut [u8]]);
11 impl<'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
19 async fn fut(bufs: &mut [&mut [u8]]) {
20 ListFut(bufs).await
21 //~^ ERROR lifetime mismatch
22 }
23
24 pub struct ListFut2<'a>(&'a mut [&'a mut [u8]]);
25 impl<'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
33 async fn fut2(bufs: &mut [&mut [u8]]) -> i32 {
34 ListFut2(bufs).await
35 //~^ ERROR lifetime mismatch
36 }
37
38 fn main() {}