Skip to content

Commit 4414068

Browse files
authored
Correctly estimate required space for string
`.len()` returns length in bytes so it overestimates the required space
1 parent 2e72448 commit 4414068

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/librustc_errors/styled_buffer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl StyledBuffer {
111111

112112
pub fn prepend(&mut self, line: usize, string: &str, style: Style) {
113113
self.ensure_lines(line);
114-
let string_len = string.len();
114+
let string_len = string.chars().count();
115115

116116
// Push the old content over to make room for new content
117117
for _ in 0..string_len {

0 commit comments

Comments
 (0)