about summary refs log tree commit diff
path: root/src/test/ui/codemap_tests
diff options
context:
space:
mode:
authorJonathan Turner <jturner@mozilla.com>2016-07-13 17:53:42 -0400
committerJonathan Turner <jturner@mozilla.com>2016-07-14 07:57:46 -0400
commit1fd014a9654e11ae1bc7c0793c6b01b157d825cd (patch)
tree4216ec70bb7a69c2400685a209cde15ce7bcdd24 /src/test/ui/codemap_tests
parent2e8e73cb951e2095e444c5cc91403f7e9c5f1065 (diff)
downloadrust-1fd014a9654e11ae1bc7c0793c6b01b157d825cd.tar.gz
rust-1fd014a9654e11ae1bc7c0793c6b01b157d825cd.zip
Add fix for tabs. Move error unit tests->ui tests
Diffstat (limited to 'src/test/ui/codemap_tests')
-rw-r--r--src/test/ui/codemap_tests/empty_span.rs19
-rw-r--r--src/test/ui/codemap_tests/empty_span.stderr8
-rw-r--r--src/test/ui/codemap_tests/huge_multispan_highlight.rs104
-rw-r--r--src/test/ui/codemap_tests/huge_multispan_highlight.stderr11
-rw-r--r--src/test/ui/codemap_tests/issue-11715.rs104
-rw-r--r--src/test/ui/codemap_tests/issue-11715.stderr12
-rw-r--r--src/test/ui/codemap_tests/one_line.rs16
-rw-r--r--src/test/ui/codemap_tests/one_line.stderr11
-rw-r--r--src/test/ui/codemap_tests/overlapping_spans.rs24
-rw-r--r--src/test/ui/codemap_tests/overlapping_spans.stderr11
-rw-r--r--src/test/ui/codemap_tests/tab.rs16
-rw-r--r--src/test/ui/codemap_tests/tab.stderr8
-rw-r--r--src/test/ui/codemap_tests/two_files.rs18
-rw-r--r--src/test/ui/codemap_tests/two_files.stderr13
-rw-r--r--src/test/ui/codemap_tests/two_files_data.rs16
15 files changed, 391 insertions, 0 deletions
diff --git a/src/test/ui/codemap_tests/empty_span.rs b/src/test/ui/codemap_tests/empty_span.rs
new file mode 100644
index 00000000000..c78a5867634
--- /dev/null
+++ b/src/test/ui/codemap_tests/empty_span.rs
@@ -0,0 +1,19 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// rustc-env:RUST_NEW_ERROR_FORMAT
+#![feature(optin_builtin_traits)]
+fn main() {
+    struct Foo;
+
+    impl !Sync for Foo {}
+
+    unsafe impl Send for &'static Foo { }
+}
diff --git a/src/test/ui/codemap_tests/empty_span.stderr b/src/test/ui/codemap_tests/empty_span.stderr
new file mode 100644
index 00000000000..f3e04ef0240
--- /dev/null
+++ b/src/test/ui/codemap_tests/empty_span.stderr
@@ -0,0 +1,8 @@
+error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `&'static main::Foo`
+  --> $DIR/empty_span.rs:18:5
+   |
+18 |     unsafe impl Send for &'static Foo { }
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/codemap_tests/huge_multispan_highlight.rs b/src/test/ui/codemap_tests/huge_multispan_highlight.rs
new file mode 100644
index 00000000000..b06832c7628
--- /dev/null
+++ b/src/test/ui/codemap_tests/huge_multispan_highlight.rs
@@ -0,0 +1,104 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// rustc-env:RUST_NEW_ERROR_FORMAT
+
+fn main() {
+    let x = "foo";
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    let y = &mut x;
+}
+
+
+
diff --git a/src/test/ui/codemap_tests/huge_multispan_highlight.stderr b/src/test/ui/codemap_tests/huge_multispan_highlight.stderr
new file mode 100644
index 00000000000..6a898a43477
--- /dev/null
+++ b/src/test/ui/codemap_tests/huge_multispan_highlight.stderr
@@ -0,0 +1,11 @@
+error: cannot borrow immutable local variable `x` as mutable
+   --> $DIR/huge_multispan_highlight.rs:100:18
+    |
+14  |     let x = "foo";
+    |         - use `mut x` here to make mutable
+...
+100 |     let y = &mut x;
+    |                  ^ cannot borrow mutably
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/codemap_tests/issue-11715.rs b/src/test/ui/codemap_tests/issue-11715.rs
new file mode 100644
index 00000000000..7ea497a25c8
--- /dev/null
+++ b/src/test/ui/codemap_tests/issue-11715.rs
@@ -0,0 +1,104 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// rustc-env:RUST_NEW_ERROR_FORMAT
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+fn main() {
+    let mut x = "foo";
+    let y = &mut x;
+    let z = &mut x;
+}
+
+
+
diff --git a/src/test/ui/codemap_tests/issue-11715.stderr b/src/test/ui/codemap_tests/issue-11715.stderr
new file mode 100644
index 00000000000..4947cbedd20
--- /dev/null
+++ b/src/test/ui/codemap_tests/issue-11715.stderr
@@ -0,0 +1,12 @@
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+   --> $DIR/issue-11715.rs:100:18
+    |
+99  |     let y = &mut x;
+    |                  - first mutable borrow occurs here
+100 |     let z = &mut x;
+    |                  ^ second mutable borrow occurs here
+101 | }
+    | - first borrow ends here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/codemap_tests/one_line.rs b/src/test/ui/codemap_tests/one_line.rs
new file mode 100644
index 00000000000..2a5ee6f8711
--- /dev/null
+++ b/src/test/ui/codemap_tests/one_line.rs
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// rustc-env:RUST_NEW_ERROR_FORMAT
+
+fn main() {
+    let mut v = vec![Some("foo"), Some("bar")];
+    v.push(v.pop().unwrap());
+}
diff --git a/src/test/ui/codemap_tests/one_line.stderr b/src/test/ui/codemap_tests/one_line.stderr
new file mode 100644
index 00000000000..8f80489ea1a
--- /dev/null
+++ b/src/test/ui/codemap_tests/one_line.stderr
@@ -0,0 +1,11 @@
+error[E0499]: cannot borrow `v` as mutable more than once at a time
+  --> $DIR/one_line.rs:15:12
+   |
+15 |     v.push(v.pop().unwrap());
+   |     -      ^               - first borrow ends here
+   |     |      |
+   |     |      second mutable borrow occurs here
+   |     first mutable borrow occurs here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/codemap_tests/overlapping_spans.rs b/src/test/ui/codemap_tests/overlapping_spans.rs
new file mode 100644
index 00000000000..5a90852392c
--- /dev/null
+++ b/src/test/ui/codemap_tests/overlapping_spans.rs
@@ -0,0 +1,24 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// rustc-env:RUST_NEW_ERROR_FORMAT
+#[derive(Debug)]
+struct Foo { }
+
+struct S {f:String}
+impl Drop for S {
+    fn drop(&mut self) { println!("{}", self.f); }
+}
+
+fn main() {
+    match (S {f:"foo".to_string()}) {
+        S {f:_s} => {}
+    }
+}
diff --git a/src/test/ui/codemap_tests/overlapping_spans.stderr b/src/test/ui/codemap_tests/overlapping_spans.stderr
new file mode 100644
index 00000000000..cbcf154eaba
--- /dev/null
+++ b/src/test/ui/codemap_tests/overlapping_spans.stderr
@@ -0,0 +1,11 @@
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+  --> $DIR/overlapping_spans.rs:22:9
+   |
+22 |         S {f:_s} => {}
+   |         ^^^^^--^
+   |         |    |
+   |         |    hint: to prevent move, use `ref _s` or `ref mut _s`
+   |         cannot move out of here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/codemap_tests/tab.rs b/src/test/ui/codemap_tests/tab.rs
new file mode 100644
index 00000000000..aaaee8c5577
--- /dev/null
+++ b/src/test/ui/codemap_tests/tab.rs
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// rustc-env:RUST_NEW_ERROR_FORMAT
+// ignore-tidy-tab
+fn main() {
+	bar;
+}
+
diff --git a/src/test/ui/codemap_tests/tab.stderr b/src/test/ui/codemap_tests/tab.stderr
new file mode 100644
index 00000000000..543c02fb701
--- /dev/null
+++ b/src/test/ui/codemap_tests/tab.stderr
@@ -0,0 +1,8 @@
+error[E0425]: unresolved name `bar`
+  --> $DIR/tab.rs:14:2
+   |
+14 | \tbar;
+   | \t^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/codemap_tests/two_files.rs b/src/test/ui/codemap_tests/two_files.rs
new file mode 100644
index 00000000000..53e240e8c47
--- /dev/null
+++ b/src/test/ui/codemap_tests/two_files.rs
@@ -0,0 +1,18 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// rustc-env:RUST_NEW_ERROR_FORMAT
+include!("two_files_data.rs");
+
+struct Baz { }
+
+impl Bar for Baz { }
+
+fn main() { }
diff --git a/src/test/ui/codemap_tests/two_files.stderr b/src/test/ui/codemap_tests/two_files.stderr
new file mode 100644
index 00000000000..6c388cd6939
--- /dev/null
+++ b/src/test/ui/codemap_tests/two_files.stderr
@@ -0,0 +1,13 @@
+error[E0404]: `Bar` is not a trait
+  --> $DIR/two_files.rs:16:6
+   |
+16 | impl Bar for Baz { }
+   |      ^^^ `Bar` is not a trait
+   | 
+  ::: $DIR/two_files_data.rs
+   |
+15 | type Bar = Foo;
+   | --------------- type aliases cannot be used for traits
+
+error: cannot continue compilation due to previous error
+
diff --git a/src/test/ui/codemap_tests/two_files_data.rs b/src/test/ui/codemap_tests/two_files_data.rs
new file mode 100644
index 00000000000..412c40f8e81
--- /dev/null
+++ b/src/test/ui/codemap_tests/two_files_data.rs
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// rustc-env:RUST_NEW_ERROR_FORMAT
+// ignore-test
+trait Foo { }
+
+type Bar = Foo;
+