Skip to content

Commit 2a243da

Browse files
committed
Merge pull request #21336 from rylev/better-nofile-error
Improve the error message when source file cannot be read Reviewed-by: brson
2 parents a3f3bb7 + b6b8880 commit 2a243da

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: src/libsyntax/parse/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,10 @@ pub fn file_to_filemap(sess: &ParseSess, path: &Path, spanopt: Option<Span>)
253253
let bytes = match File::open(path).read_to_end() {
254254
Ok(bytes) => bytes,
255255
Err(e) => {
256-
err(&format!("couldn't read {:?}: {:?}",
256+
let error_msg = e.desc;
257+
err(&format!("couldn't read {:?}: {}",
257258
path.display(),
258-
e)[]);
259+
error_msg)[]);
259260
unreachable!()
260261
}
261262
};

0 commit comments

Comments
 (0)