]> git.lizzy.rs Git - rust.git/blob - src/test/ui/resolve/token-error-correct-3.rs
Rollup merge of #57418 - lqd:collector_query, r=michaelwoerister
[rust.git] / src / test / ui / resolve / token-error-correct-3.rs
1 // ignore-cloudabi no std::fs support
2
3 // Test that we do some basic error correction in the tokeniser (and don't spew
4 // too many bogus errors).
5
6 pub mod raw {
7     use std::{io, fs};
8     use std::path::Path;
9
10     pub fn ensure_dir_exists<P: AsRef<Path>, F: FnOnce(&Path)>(path: P,
11                                                                callback: F)
12                                                                -> io::Result<bool> {
13         if !is_directory(path.as_ref()) { //~ ERROR: cannot find function `is_directory`
14             callback(path.as_ref(); //~ ERROR expected one of
15             fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types
16             //~^ expected (), found enum `std::result::Result`
17             //~| expected type `()`
18             //~| found type `std::result::Result<bool, std::io::Error>`
19             //~| expected one of
20         } else { //~ ERROR: incorrect close delimiter: `}`
21             //~^ ERROR: expected one of
22             //~| unexpected token
23             Ok(false);
24         }
25
26         panic!();
27     }
28 }
29
30 fn main() {}