diff options
| author | Jonathan Turner <jturner@mozilla.com> | 2016-05-24 10:42:32 -0400 |
|---|---|---|
| committer | Jonathan Turner <jturner@mozilla.com> | 2016-05-24 10:42:32 -0400 |
| commit | 00b78d0d6ad5985a29d9b1b001e81dbb1bf624b6 (patch) | |
| tree | e15634ee6226e64fdf423d529424e8e0504d9a37 /src/libsyntax/errors | |
| parent | 9cc8debeb746826604858be86e2f6e5cce29026c (diff) | |
| download | rust-00b78d0d6ad5985a29d9b1b001e81dbb1bf624b6.tar.gz rust-00b78d0d6ad5985a29d9b1b001e81dbb1bf624b6.zip | |
Back to single line between errors. Add header space to secondary files
Diffstat (limited to 'src/libsyntax/errors')
| -rw-r--r-- | src/libsyntax/errors/emitter.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/errors/snippet/mod.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/errors/snippet/test.rs | 14 |
3 files changed, 26 insertions, 1 deletions
diff --git a/src/libsyntax/errors/emitter.rs b/src/libsyntax/errors/emitter.rs index 2ba003c5eaf..6b15aa4f92c 100644 --- a/src/libsyntax/errors/emitter.rs +++ b/src/libsyntax/errors/emitter.rs @@ -238,7 +238,7 @@ impl EmitterWriter { self.first = false; } else { if !self.old_school { - write!(self.dst, "\n\n")?; + write!(self.dst, "\n")?; } } } @@ -682,6 +682,7 @@ mod test { println!("r#\"\n{}\"#", str); assert_eq!(str, &r#" --> dummy.txt:11:1 + |> 11 |> e-lä-vän |> ^ "#[1..]); @@ -746,6 +747,7 @@ mod test { let expect_start = &r#" --> dummy.txt:1:6 + |> 1 |> _____aaaaaa____bbbbbb__cccccdd_ |> ^^^^^^ ^^^^^^ ^^^^^^^ "#[1..]; @@ -818,6 +820,7 @@ mod test { let expect0 = &r#" --> dummy.txt:5:1 + |> 5 |> ccccc |> ^ ... @@ -830,6 +833,7 @@ mod test { let expect = &r#" --> dummy.txt:1:1 + |> 1 |> aaaaa |> ^ ... diff --git a/src/libsyntax/errors/snippet/mod.rs b/src/libsyntax/errors/snippet/mod.rs index 414da87b749..2a43a14ddf8 100644 --- a/src/libsyntax/errors/snippet/mod.rs +++ b/src/libsyntax/errors/snippet/mod.rs @@ -494,6 +494,13 @@ impl FileInfo { }], kind: RenderedLineKind::OtherFileName, }); + output.push(RenderedLine { + text: vec![StyledString { + text: "".to_string(), + style: Style::FileNameStyle, + }], + kind: RenderedLineKind::Annotations, + }); } } } diff --git a/src/libsyntax/errors/snippet/test.rs b/src/libsyntax/errors/snippet/test.rs index 62ce3fa9dd5..51fe4572dbc 100644 --- a/src/libsyntax/errors/snippet/test.rs +++ b/src/libsyntax/errors/snippet/test.rs @@ -98,6 +98,7 @@ fn foo() { let text = make_string(&lines); assert_eq!(&text[..], &" --> foo.rs:3:2 + |> 3 |> \tbar; |> \t^^^ "[1..]); @@ -130,6 +131,7 @@ fn foo() { println!("text=\n{}", text); assert_eq!(&text[..], &r#" ::: foo.rs + |> 3 |> vec.push(vec.pop().unwrap()); |> --- --- - previous borrow ends here |> | | @@ -199,12 +201,14 @@ fn bar() { // Note that the `|>` remain aligned across both files: assert_eq!(&text[..], &r#" --> foo.rs:3:14 + |> 3 |> vec.push(vec.pop().unwrap()); |> --- ^^^ - c |> | | |> | b |> a ::: bar.rs + |> 17 |> vec.push(); |> --- - f |> | @@ -249,6 +253,7 @@ fn foo() { println!("text=\n{}", text); assert_eq!(&text[..], &r#" ::: foo.rs + |> 3 |> let name = find_id(&data, 22).unwrap(); |> ---- immutable borrow begins here ... @@ -288,6 +293,7 @@ fn foo() { println!("text=r#\"\n{}\".trim_left()", text); assert_eq!(&text[..], &r#" ::: foo.rs + |> 3 |> vec.push(vec.pop().unwrap()); |> -------- ------ D |> || @@ -324,6 +330,7 @@ fn foo() { println!("text=r#\"\n{}\".trim_left()", text); assert_eq!(&text[..], &r#" ::: foo.rs + |> 3 |> vec.push(vec.pop().unwrap()); |> --- --- - previous borrow ends here |> | | @@ -362,6 +369,7 @@ fn foo() { println!("text=r#\"\n{}\".trim_left()", text); assert_eq!(&text[..], &r#" ::: foo.rs + |> 4 |> let mut vec2 = vec; |> --- `vec` moved here because it has type `collections::vec::Vec<i32>` ... @@ -398,6 +406,7 @@ fn foo() { println!("text=&r#\"\n{}\n\"#[1..]", text); assert_eq!(text, &r#" ::: foo.rs + |> 3 |> let mut vec = vec![0, 1, 2]; |> --- --- 4 |> let mut vec2 = vec; @@ -429,6 +438,7 @@ impl SomeTrait for () { println!("r#\"\n{}\"", text); assert_eq!(text, &r#" ::: foo.rs + |> 3 |> fn foo(x: u32) { |> - "#[1..]); @@ -458,6 +468,7 @@ fn span_overlap_label() { println!("r#\"\n{}\"", text); assert_eq!(text, &r#" ::: foo.rs + |> 2 |> fn foo(x: u32) { |> -------------- |> | | @@ -492,6 +503,7 @@ fn span_overlap_label2() { println!("r#\"\n{}\"", text); assert_eq!(text, &r#" ::: foo.rs + |> 2 |> fn foo(x: u32) { |> -------------- |> | | @@ -537,6 +549,7 @@ fn span_overlap_label3() { println!("r#\"\n{}\"", text); assert_eq!(text, &r#" ::: foo.rs + |> 3 |> let closure = || { |> - foo 4 |> inner @@ -577,6 +590,7 @@ fn main() { println!("r#\"\n{}\"", text); assert_eq!(text, &r#" --> foo.rs:11:2 + |> 11 |> } |> - "#[1..]); |
