diff options
| author | AnthonyMikh <anthony.mikh@yandex.ru> | 2019-10-05 03:08:05 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-05 03:08:05 +0300 |
| commit | 4414068cc49803b0dacba133b7788b8b95b0b473 (patch) | |
| tree | 42d4d1c880dfa537c60bbd1bcf494c2d3752a439 | |
| parent | 2e7244807a7878f6eca3eb7d97ae9b413aa49014 (diff) | |
| download | rust-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.rs | 2 |
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 { |
