about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAnthonyMikh <anthony.mikh@yandex.ru>2019-10-05 03:08:05 +0300
committerGitHub <noreply@github.com>2019-10-05 03:08:05 +0300
commit4414068cc49803b0dacba133b7788b8b95b0b473 (patch)
tree42d4d1c880dfa537c60bbd1bcf494c2d3752a439
parent2e7244807a7878f6eca3eb7d97ae9b413aa49014 (diff)
downloadrust-4414068cc49803b0dacba133b7788b8b95b0b473.tar.gz
rust-4414068cc49803b0dacba133b7788b8b95b0b473.zip
Correctly estimate required space for string
`.len()` returns length in bytes so it overestimates the required space
-rw-r--r--src/librustc_errors/styled_buffer.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc_errors/styled_buffer.rs b/src/librustc_errors/styled_buffer.rs
index 6e03618d2b0..b12ab9e4576 100644
--- a/src/librustc_errors/styled_buffer.rs
+++ b/src/librustc_errors/styled_buffer.rs
@@ -111,7 +111,7 @@ impl StyledBuffer {
 
     pub fn prepend(&mut self, line: usize, string: &str, style: Style) {
         self.ensure_lines(line);
-        let string_len = string.len();
+        let string_len = string.chars().count();
 
         // Push the old content over to make room for new content
         for _ in 0..string_len {