diff options
| author | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2017-11-06 09:58:53 +0100 |
|---|---|---|
| committer | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2017-11-06 09:58:53 +0100 |
| commit | dfe218ac970f93aa93dc566156c2a54693110208 (patch) | |
| tree | 94b88170a84fd69b5be5ef68cb042d37758c90c6 /src/librustc_errors | |
| parent | 443332afaffbd0220452002567a2b61fd0e3fd9d (diff) | |
| download | rust-dfe218ac970f93aa93dc566156c2a54693110208.tar.gz rust-dfe218ac970f93aa93dc566156c2a54693110208.zip | |
Do not highlight surrounding whitespace
Diffstat (limited to 'src/librustc_errors')
| -rw-r--r-- | src/librustc_errors/emitter.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 63e13c9beea..161ceb03f02 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -1105,10 +1105,10 @@ impl EmitterWriter { buffer.append(0, &level.to_string(), Style::Level(level.clone())); buffer.append(0, ": ", Style::HeaderMsg); self.msg_to_buffer(&mut buffer, - &[(suggestion.msg.to_owned(), Style::NoStyle)], - max_line_num_len, - "suggestion", - Some(Style::HeaderMsg)); + &[(suggestion.msg.to_owned(), Style::NoStyle)], + max_line_num_len, + "suggestion", + Some(Style::HeaderMsg)); // Render the replacements for each suggestion let suggestions = suggestion.splice_lines(cm.borrow()); @@ -1145,8 +1145,9 @@ impl EmitterWriter { // entirety of the code being shown and the displayed code is not multiline. if show_underline { draw_col_separator(&mut buffer, row_num, max_line_num_len + 1); - let sub_len = parts[0].snippet.len(); - let underline_start = span_start_pos.col.0; + let start = parts[0].snippet.len() - parts[0].snippet.trim_left().len(); + let sub_len = parts[0].snippet.trim().len(); + let underline_start = span_start_pos.col.0 + start; let underline_end = span_start_pos.col.0 + sub_len; for p in underline_start..underline_end { buffer.putc(row_num, |
