]> git.lizzy.rs Git - rust.git/blob - tests/ui/async-await/issue-72442.rs
Rollup merge of #107048 - DebugSteven:newer-x-check-cargo, r=albertlarsan68
[rust.git] / tests / ui / async-await / issue-72442.rs
1 // edition:2018
2 // incremental
3
4 use std::fs::File;
5 use std::future::Future;
6 use std::io::prelude::*;
7
8 fn 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
21 fn block_on<F>(f: F) -> F::Output
22 where
23     F: Future<Output = Result<(), Box<dyn std::error::Error>>>,
24 {
25     Ok(())
26 }