]>
Commit | Line | Data |
---|---|---|
f9f354fc | 1 | // edition:2018 |
c295e0f8 | 2 | // incremental |
f9f354fc XL |
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 | } |