about summary refs log tree commit diff
path: root/compiler/rustc_errors
diff options
context:
space:
mode:
authorEsteban Kuber <esteban@kuber.com.ar>2021-08-14 13:31:48 +0000
committerEsteban Kuber <esteban@kuber.com.ar>2021-08-23 11:58:19 +0000
commita29a624f86c07dc4bbfed2e278a49b6a7f7dff3e (patch)
tree0fb329e4ab1b387a2c213f94cd64fdc3a93a29b8 /compiler/rustc_errors
parent75fd1bf1e60dd140f2ba46a4252195ea2a9b9c89 (diff)
downloadrust-a29a624f86c07dc4bbfed2e278a49b6a7f7dff3e.tar.gz
rust-a29a624f86c07dc4bbfed2e278a49b6a7f7dff3e.zip
wip
Diffstat (limited to 'compiler/rustc_errors')
-rw-r--r--compiler/rustc_errors/src/emitter.rs30
-rw-r--r--compiler/rustc_errors/src/lib.rs3
2 files changed, 13 insertions, 20 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs
index 645b81b9540..ba6fe477202 100644
--- a/compiler/rustc_errors/src/emitter.rs
+++ b/compiler/rustc_errors/src/emitter.rs
@@ -1679,27 +1679,19 @@ impl EmitterWriter {
                 // Colorize addition/replacements with green.
                 for &SubstitutionHighlight { start, end } in highlight_parts {
                     // Account for tabs when highlighting (#87972).
-                    let start: usize = line
-                        .chars()
-                        .take(start)
-                        .map(|ch| match ch {
-                            '\t' => 4,
-                            _ => 1,
-                        })
-                        .sum();
-
-                    let end: usize = line
-                        .chars()
-                        .take(end)
-                        .map(|ch| match ch {
-                            '\t' => 4,
-                            _ => 1,
-                        })
-                        .sum();
+                    // let tabs: usize = line
+                    //     .chars()
+                    //     .take(start)
+                    //     .map(|ch| match ch {
+                    //         '\t' => 3,
+                    //         _ => 0,
+                    //     })
+                    //     .sum();
+                    let tabs = 0;
                     buffer.set_style_range(
                         row_num,
-                        max_line_num_len + 3 + start,
-                        max_line_num_len + 3 + end,
+                        max_line_num_len + 3 + start + tabs,
+                        max_line_num_len + 3 + end + tabs,
                         Style::Addition,
                         true,
                     );
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs
index cae4a6b4723..ab3f0948632 100644
--- a/compiler/rustc_errors/src/lib.rs
+++ b/compiler/rustc_errors/src/lib.rs
@@ -14,7 +14,7 @@ extern crate rustc_macros;
 
 pub use emitter::ColorConfig;
 
-use tracing::debug;
+use tracing::{debug, info};
 use Level::*;
 
 use emitter::{is_case_difference, Emitter, EmitterWriter};
@@ -349,6 +349,7 @@ impl CodeSuggestion {
                 while buf.ends_with('\n') {
                     buf.pop();
                 }
+                info!(?buf, ?highlights);
                 Some((buf, substitution.parts, highlights, only_capitalization))
             })
             .collect()