Improve the error message when source file cannot be read

Contribution from @look!
This commit is contained in:
Ryan Levick 2015-01-18 00:49:50 +01:00
parent f4f10dba29
commit b6b8880f0e

View File

@ -253,9 +253,10 @@ pub fn file_to_filemap(sess: &ParseSess, path: &Path, spanopt: Option<Span>)
let bytes = match File::open(path).read_to_end() {
Ok(bytes) => bytes,
Err(e) => {
err(&format!("couldn't read {:?}: {:?}",
let error_msg = e.desc;
err(&format!("couldn't read {:?}: {}",
path.display(),
e)[]);
error_msg)[]);
unreachable!()
}
};