about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorRyan Levick <ryan@6wunderkinder.com>2015-01-18 00:49:50 +0100
committerRyan Levick <ryan@6wunderkinder.com>2015-01-18 00:49:50 +0100
commitb6b8880f0ec3f057dc56320f6886be173a8f0d8e (patch)
treeb70e6dfd79a2f2e4c038ca8f0a0e06749fb61d0f /src/libsyntax/parse
parentf4f10dba2975b51c2d2c92157018db3ac13d4d4a (diff)
downloadrust-b6b8880f0ec3f057dc56320f6886be173a8f0d8e.tar.gz
rust-b6b8880f0ec3f057dc56320f6886be173a8f0d8e.zip
Improve the error message when source file cannot be read
Contribution from @look!
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/mod.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index f1f547ba0c7..10fb0a73cec 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -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!()
         }
     };