summary refs log tree commit diff
path: root/src/librustc_errors
diff options
context:
space:
mode:
authorInokentiy Babushkin <twk@twki.de>2017-06-11 10:19:46 +0200
committerInokentiy Babushkin <twk@twki.de>2017-06-11 11:47:00 +0200
commitc04aa4ed0ce61d257ab10b4dbdaa64fa5cad37b1 (patch)
treef354bf43f9c4a8fd86cdbe29e9b847f22424a768 /src/librustc_errors
parentc2c31b2db33e0d0b5356a0c9e032269034cdc70a (diff)
downloadrust-c04aa4ed0ce61d257ab10b4dbdaa64fa5cad37b1.tar.gz
rust-c04aa4ed0ce61d257ab10b4dbdaa64fa5cad37b1.zip
Improved lazy external source loading and inserted calls.
Diffstat (limited to 'src/librustc_errors')
-rw-r--r--src/librustc_errors/emitter.rs5
-rw-r--r--src/librustc_errors/lib.rs2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index f820ea4c5e1..fc4d39ac482 100644
--- a/src/librustc_errors/emitter.rs
+++ b/src/librustc_errors/emitter.rs
@@ -131,7 +131,7 @@ impl EmitterWriter {
         }
     }
 
-    fn preprocess_annotations(&self, msp: &MultiSpan) -> Vec<FileWithAnnotatedLines> {
+    fn preprocess_annotations(&mut self, msp: &MultiSpan) -> Vec<FileWithAnnotatedLines> {
         fn add_annotation_to_file(file_vec: &mut Vec<FileWithAnnotatedLines>,
                                   file: Rc<FileMap>,
                                   line_index: usize,
@@ -175,6 +175,9 @@ impl EmitterWriter {
                 if span_label.span == DUMMY_SP {
                     continue;
                 }
+
+                cm.load_source_for_filemap(cm.span_to_filename(span_label.span));
+
                 let lo = cm.lookup_char_pos(span_label.span.lo);
                 let mut hi = cm.lookup_char_pos(span_label.span.hi);
 
diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs
index 545a485732e..a2a20424d6b 100644
--- a/src/librustc_errors/lib.rs
+++ b/src/librustc_errors/lib.rs
@@ -103,7 +103,7 @@ pub trait CodeMapper {
     fn span_to_filename(&self, sp: Span) -> FileName;
     fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span>;
     fn call_span_if_macro(&self, sp: Span) -> Span;
-    fn load_source_for_filemap(&mut self, file: FileName) -> bool;
+    fn load_source_for_filemap(&self, file: FileName) -> bool;
 }
 
 impl CodeSuggestion {