Skip to content

Commit 9355a91

Browse files
committed
assert we get at least two rendered lines back
1 parent db8a9a9 commit 9355a91

File tree

1 file changed

+5
-2
lines changed
  • src/libsyntax/errors/snippet

1 file changed

+5
-2
lines changed

src/libsyntax/errors/snippet/mod.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ pub struct FileInfo {
3838
lines: Vec<Line>,
3939
}
4040

41-
#[derive(Clone)]
41+
#[derive(Clone, Debug)]
4242
struct Line {
4343
line_index: usize,
4444
annotations: Vec<Annotation>,
4545
}
4646

47-
#[derive(Clone, PartialOrd, Ord, PartialEq, Eq)]
47+
#[derive(Clone, Debug, PartialOrd, Ord, PartialEq, Eq)]
4848
struct Annotation {
4949
/// Start column, 0-based indexing -- counting *characters*, not
5050
/// utf-8 bytes. Note that it is important that this field goes
@@ -492,6 +492,9 @@ impl FileInfo {
492492
let gap_amount =
493493
rendered_lines[0].text[0].text.len() +
494494
rendered_lines[0].text[1].text.len();
495+
assert!(rendered_lines.len() >= 2,
496+
"no annotations resulted from: {:?}",
497+
line);
495498
for i in 1..rendered_lines.len() {
496499
rendered_lines[i].text.insert(0, StyledString {
497500
text: vec![" "; gap_amount].join(""),

0 commit comments

Comments
 (0)