about summary refs log tree commit diff
path: root/src/test/ui/missing/missing-items
diff options
context:
space:
mode:
authorDavid Wood <david@davidtw.co>2018-08-08 14:50:16 +0200
committerDavid Wood <david@davidtw.co>2018-08-14 11:12:09 +0200
commit3fc7ab237314a4ce85e612b4ce590c27f1425291 (patch)
treec775f852e05e1272032cb053ee347315c973c7b5 /src/test/ui/missing/missing-items
parent3e0a4079884eab5b54489c92f7428cda2797ea5c (diff)
downloadrust-3fc7ab237314a4ce85e612b4ce590c27f1425291.tar.gz
rust-3fc7ab237314a4ce85e612b4ce590c27f1425291.zip
Merged migrated compile-fail tests and ui tests. Fixes #46841.
Diffstat (limited to 'src/test/ui/missing/missing-items')
-rw-r--r--src/test/ui/missing/missing-items/auxiliary/m1.rs16
-rw-r--r--src/test/ui/missing/missing-items/issue-40221.rs26
-rw-r--r--src/test/ui/missing/missing-items/issue-40221.stderr9
-rw-r--r--src/test/ui/missing/missing-items/m2.rs22
-rw-r--r--src/test/ui/missing/missing-items/m2.stderr13
-rw-r--r--src/test/ui/missing/missing-items/missing-type-parameter.rs15
-rw-r--r--src/test/ui/missing/missing-items/missing-type-parameter.stderr9
7 files changed, 110 insertions, 0 deletions
diff --git a/src/test/ui/missing/missing-items/auxiliary/m1.rs b/src/test/ui/missing/missing-items/auxiliary/m1.rs
new file mode 100644
index 00000000000..49fc586d6b5
--- /dev/null
+++ b/src/test/ui/missing/missing-items/auxiliary/m1.rs
@@ -0,0 +1,16 @@
+// Copyright 2014 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.
+
+
+pub trait X {
+    const CONSTANT: u32;
+    type Type;
+    fn method(&self, s: String) -> Self::Type;
+}
diff --git a/src/test/ui/missing/missing-items/issue-40221.rs b/src/test/ui/missing/missing-items/issue-40221.rs
new file mode 100644
index 00000000000..526fc3a8658
--- /dev/null
+++ b/src/test/ui/missing/missing-items/issue-40221.rs
@@ -0,0 +1,26 @@
+// Copyright 2017 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.
+
+enum P {
+    C(PC),
+}
+
+enum PC {
+    Q,
+    QA,
+}
+
+fn test(proto: P) {
+    match proto { //~ ERROR non-exhaustive patterns
+        P::C(PC::Q) => (),
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/missing/missing-items/issue-40221.stderr b/src/test/ui/missing/missing-items/issue-40221.stderr
new file mode 100644
index 00000000000..81c9f40f6cf
--- /dev/null
+++ b/src/test/ui/missing/missing-items/issue-40221.stderr
@@ -0,0 +1,9 @@
+error[E0004]: non-exhaustive patterns: `C(QA)` not covered
+  --> $DIR/issue-40221.rs:21:11
+   |
+LL |     match proto { //~ ERROR non-exhaustive patterns
+   |           ^^^^^ pattern `C(QA)` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/src/test/ui/missing/missing-items/m2.rs b/src/test/ui/missing/missing-items/m2.rs
new file mode 100644
index 00000000000..f655047f6f5
--- /dev/null
+++ b/src/test/ui/missing/missing-items/m2.rs
@@ -0,0 +1,22 @@
+// Copyright 2014 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.
+
+// aux-build:m1.rs
+
+
+extern crate m1;
+
+struct X {
+}
+
+impl m1::X for X { //~ ERROR not all trait items implemented
+}
+
+fn main() {}
diff --git a/src/test/ui/missing/missing-items/m2.stderr b/src/test/ui/missing/missing-items/m2.stderr
new file mode 100644
index 00000000000..3f7a4039eb7
--- /dev/null
+++ b/src/test/ui/missing/missing-items/m2.stderr
@@ -0,0 +1,13 @@
+error[E0046]: not all trait items implemented, missing: `CONSTANT`, `Type`, `method`
+  --> $DIR/m2.rs:19:1
+   |
+LL | impl m1::X for X { //~ ERROR not all trait items implemented
+   | ^^^^^^^^^^^^^^^^ missing `CONSTANT`, `Type`, `method` in implementation
+   |
+   = note: `CONSTANT` from trait: `const CONSTANT: u32;`
+   = note: `Type` from trait: `type Type;`
+   = note: `method` from trait: `fn(&Self, std::string::String) -> <Self as m1::X>::Type`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0046`.
diff --git a/src/test/ui/missing/missing-items/missing-type-parameter.rs b/src/test/ui/missing/missing-items/missing-type-parameter.rs
new file mode 100644
index 00000000000..f2d5359fb16
--- /dev/null
+++ b/src/test/ui/missing/missing-items/missing-type-parameter.rs
@@ -0,0 +1,15 @@
+// Copyright 2017 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.
+
+fn foo<X>() { }
+
+fn main() {
+    foo(); //~ ERROR type annotations needed
+}
diff --git a/src/test/ui/missing/missing-items/missing-type-parameter.stderr b/src/test/ui/missing/missing-items/missing-type-parameter.stderr
new file mode 100644
index 00000000000..a27e8aac28f
--- /dev/null
+++ b/src/test/ui/missing/missing-items/missing-type-parameter.stderr
@@ -0,0 +1,9 @@
+error[E0282]: type annotations needed
+  --> $DIR/missing-type-parameter.rs:14:5
+   |
+LL |     foo(); //~ ERROR type annotations needed
+   |     ^^^ cannot infer type for `X`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.