Skip to content

Commit cb82b79

Browse files
committed
Fix rustdoc test
1 parent f1c751b commit cb82b79

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

compiler/rustc_errors/src/styled_buffer.rs

+3
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ impl StyledBuffer {
9393
if start == end {
9494
return;
9595
}
96+
if start > self.lines[line].len() || end > self.lines[line].len() {
97+
return;
98+
}
9699
let _ = self.lines[line].drain(start..(end - string.chars().count()));
97100
for (i, c) in string.chars().enumerate() {
98101
self.lines[line][start + i] = StyledChar::new(c, Style::LineNumber);

tests/rustdoc-ui/diagnostic-width.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ LL | ... a http://link.com
88
note: the lint level is defined here
99
--> $DIR/diagnostic-width.rs:2:9
1010
|
11-
LL | ...ny(rustdoc::bare_url...
12-
| ^^^^^^^^^^^^^^^^^^
11+
LL | ...ny(ru...are_urls)]
12+
| ^^...^^^^^^^^
1313
help: use an automatic link instead
1414
|
1515
LL | /// This is a long line that contains a <http://link.com>

0 commit comments

Comments
 (0)