From c04aa4ed0ce61d257ab10b4dbdaa64fa5cad37b1 Mon Sep 17 00:00:00 2001 From: Inokentiy Babushkin Date: Sun, 11 Jun 2017 10:19:46 +0200 Subject: Improved lazy external source loading and inserted calls. --- src/librustc_errors/emitter.rs | 5 ++++- src/librustc_errors/lib.rs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/librustc_errors') 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 { + fn preprocess_annotations(&mut self, msp: &MultiSpan) -> Vec { fn add_annotation_to_file(file_vec: &mut Vec, file: Rc, 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; 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 { -- cgit 1.4.1-3-g733a5