about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-05-10 22:11:19 +0100
committervarkor <github@varkor.com>2019-05-10 22:11:19 +0100
commitaa9369c7a4f463ea9e2d1f5ceecccbeb026baa41 (patch)
tree0e3a6a7cf9f16b87f00bcbed0ce71cb7b349abf8 /src
parent26afc4fb91827a174b044ab210cbb2fef1792b5b (diff)
downloadrust-aa9369c7a4f463ea9e2d1f5ceecccbeb026baa41.tar.gz
rust-aa9369c7a4f463ea9e2d1f5ceecccbeb026baa41.zip
Add test
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/existential-type/issue-60371.rs15
-rw-r--r--src/test/ui/existential-type/issue-60371.stderr29
2 files changed, 44 insertions, 0 deletions
diff --git a/src/test/ui/existential-type/issue-60371.rs b/src/test/ui/existential-type/issue-60371.rs
new file mode 100644
index 00000000000..f9def11d193
--- /dev/null
+++ b/src/test/ui/existential-type/issue-60371.rs
@@ -0,0 +1,15 @@
+trait Bug {
+    type Item: Bug;
+
+    const FUN: fn() -> Self::Item;
+}
+
+impl Bug for &() {
+    existential type Item: Bug; //~ ERROR existential types are unstable
+    //~^ ERROR the trait bound `(): Bug` is not satisfied
+    //~^^ ERROR could not find defining uses
+
+    const FUN: fn() -> Self::Item = || ();
+}
+
+fn main() {}
diff --git a/src/test/ui/existential-type/issue-60371.stderr b/src/test/ui/existential-type/issue-60371.stderr
new file mode 100644
index 00000000000..2560e01047a
--- /dev/null
+++ b/src/test/ui/existential-type/issue-60371.stderr
@@ -0,0 +1,29 @@
+error[E0658]: existential types are unstable
+  --> $DIR/issue-60371.rs:8:5
+   |
+LL |     existential type Item: Bug;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/34511
+   = help: add #![feature(existential_type)] to the crate attributes to enable
+
+error[E0277]: the trait bound `(): Bug` is not satisfied
+  --> $DIR/issue-60371.rs:8:5
+   |
+LL |     existential type Item: Bug;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bug` is not implemented for `()`
+   |
+   = help: the following implementations were found:
+             <&() as Bug>
+   = note: the return type of a function must have a statically known size
+
+error: could not find defining uses
+  --> $DIR/issue-60371.rs:8:5
+   |
+LL |     existential type Item: Bug;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0277, E0658.
+For more information about an error, try `rustc --explain E0277`.