]> git.proxmox.com Git - rustc.git/blame - src/test/ui/async-await/issue-72442.rs
New upstream version 1.65.0+dfsg1
[rustc.git] / src / test / ui / async-await / issue-72442.rs
CommitLineData
f9f354fc 1// edition:2018
c295e0f8 2// incremental
f9f354fc
XL
3
4use std::fs::File;
5use std::future::Future;
6use std::io::prelude::*;
7
8fn main() -> Result<(), Box<dyn std::error::Error>> {
9 block_on(async {
10 {
11 let path = std::path::Path::new(".");
12 let mut f = File::open(path.to_str())?;
13 //~^ ERROR the trait bound
14 let mut src = String::new();
15 f.read_to_string(&mut src)?;
16 Ok(())
17 }
18 })
19}
20
21fn block_on<F>(f: F) -> F::Output
22where
23 F: Future<Output = Result<(), Box<dyn std::error::Error>>>,
24{
25 Ok(())
26}