]> git.lizzy.rs Git - rust.git/blob - tests/ui/macros/format-args-temporaries-async.rs
Rollup merge of #107127 - uweigand:s390x-sanitizer, r=Mark-Simulacrum
[rust.git] / tests / ui / macros / format-args-temporaries-async.rs
1 // check-pass
2 // edition:2021
3
4 use std::fmt::{self, Display};
5 use std::future::Future;
6 use std::io;
7 use std::pin::Pin;
8 use std::task::{Context, Poll};
9
10 struct AsyncStdout;
11
12 impl AsyncStdout {
13     fn write_fmt<'a>(&'a mut self, _args: fmt::Arguments) -> WriteFmtFuture<'a, Self>
14     where
15         Self: Unpin,
16     {
17         WriteFmtFuture(self)
18     }
19 }
20
21 struct WriteFmtFuture<'a, T>(&'a mut T);
22
23 impl<'a, T> Future for WriteFmtFuture<'a, T> {
24     type Output = io::Result<()>;
25     fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
26         unimplemented!()
27     }
28 }
29
30 async fn async_main() {
31     let _write = write!(&mut AsyncStdout, "...").await;
32     let _writeln = writeln!(&mut AsyncStdout, "...").await;
33 }
34
35 fn main() {
36     let _ = async_main;
37 }