diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2016-05-02 13:05:14 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2016-05-02 13:05:14 -0400 |
| commit | 9355a91224a6f715b94342c074e5bac1f9e820f3 (patch) | |
| tree | 4e73427ec0a32ccc668dca5fea7256e9b6718c67 /src/libsyntax/errors | |
| parent | db8a9a92b3dafcd5a8d7207096c8cbb90db0b013 (diff) | |
| download | rust-9355a91224a6f715b94342c074e5bac1f9e820f3.tar.gz rust-9355a91224a6f715b94342c074e5bac1f9e820f3.zip | |
assert we get at least two rendered lines back
Diffstat (limited to 'src/libsyntax/errors')
| -rw-r--r-- | src/libsyntax/errors/snippet/mod.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libsyntax/errors/snippet/mod.rs b/src/libsyntax/errors/snippet/mod.rs index 1ec4a015742..e213f623ab8 100644 --- a/src/libsyntax/errors/snippet/mod.rs +++ b/src/libsyntax/errors/snippet/mod.rs @@ -38,13 +38,13 @@ pub struct FileInfo { lines: Vec<Line>, } -#[derive(Clone)] +#[derive(Clone, Debug)] struct Line { line_index: usize, annotations: Vec<Annotation>, } -#[derive(Clone, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Clone, Debug, PartialOrd, Ord, PartialEq, Eq)] struct Annotation { /// Start column, 0-based indexing -- counting *characters*, not /// utf-8 bytes. Note that it is important that this field goes @@ -492,6 +492,9 @@ impl FileInfo { let gap_amount = rendered_lines[0].text[0].text.len() + rendered_lines[0].text[1].text.len(); + assert!(rendered_lines.len() >= 2, + "no annotations resulted from: {:?}", + line); for i in 1..rendered_lines.len() { rendered_lines[i].text.insert(0, StyledString { text: vec![" "; gap_amount].join(""), |
