about summary refs log tree commit diff
path: root/src/librustc_errors
diff options
context:
space:
mode:
authorMatthew Russo <matthew@edapp.com>2018-12-04 15:18:03 -0500
committerMatthew Russo <matthew@edapp.com>2018-12-04 19:52:42 -0500
commitf0f8aa9e05726bfbc065fa2504daf3232f29bc03 (patch)
tree5027e1682248fb6e535546046f43dff45d6e2b50 /src/librustc_errors
parent88130f1796e98837dc6f58aea9b9a0f49b85f426 (diff)
downloadrust-f0f8aa9e05726bfbc065fa2504daf3232f29bc03.tar.gz
rust-f0f8aa9e05726bfbc065fa2504daf3232f29bc03.zip
adds DocTest filename variant, refactors doctest_offset out of source_map, fixes remaining test failures
Diffstat (limited to 'src/librustc_errors')
-rw-r--r--src/librustc_errors/emitter.rs7
-rw-r--r--src/librustc_errors/lib.rs2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index 7e69e98071d..ab2ab25c91a 100644
--- a/src/librustc_errors/emitter.rs
+++ b/src/librustc_errors/emitter.rs
@@ -1044,7 +1044,7 @@ impl EmitterWriter {
                     buffer.append(buffer_msg_line_offset,
                                   &format!("{}:{}:{}",
                                            loc.file.name,
-                                           sm.doctest_offset_line(loc.line),
+                                           sm.doctest_offset_line(&loc.file.name, loc.line),
                                            loc.col.0 + 1),
                                   Style::LineAndColumn);
                     for _ in 0..max_line_num_len {
@@ -1054,7 +1054,7 @@ impl EmitterWriter {
                     buffer.prepend(0,
                                    &format!("{}:{}:{}: ",
                                             loc.file.name,
-                                            sm.doctest_offset_line(loc.line),
+                                            sm.doctest_offset_line(&loc.file.name, loc.line),
                                             loc.col.0 + 1),
                                    Style::LineAndColumn);
                 }
@@ -1075,7 +1075,8 @@ impl EmitterWriter {
                     };
                     format!("{}:{}{}",
                             annotated_file.file.name,
-                            sm.doctest_offset_line(first_line.line_index),
+                            sm.doctest_offset_line(
+                                &annotated_file.file.name, first_line.line_index),
                             col)
                 } else {
                     annotated_file.file.name.to_string()
diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs
index 0fb77a7a3ab..b6528cbe2c8 100644
--- a/src/librustc_errors/lib.rs
+++ b/src/librustc_errors/lib.rs
@@ -130,7 +130,7 @@ pub trait SourceMapper {
     fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span>;
     fn call_span_if_macro(&self, sp: Span) -> Span;
     fn ensure_source_file_source_present(&self, source_file: Lrc<SourceFile>) -> bool;
-    fn doctest_offset_line(&self, line: usize) -> usize;
+    fn doctest_offset_line(&self, file: &FileName, line: usize) -> usize;
 }
 
 impl CodeSuggestion {