about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2019-07-21 14:18:20 +0900
committerYuki Okushi <huyuumi.dev@gmail.com>2019-07-21 15:27:23 +0900
commit18dceabc9546050a2c30c525f58aaf9cbc582a6b (patch)
tree44ac0421a2539f4af8e3aaf1451482a484e5b8a3
parent95b1fe560d2bd8472f250fb8cfd2168520a58405 (diff)
downloadrust-18dceabc9546050a2c30c525f58aaf9cbc582a6b.tar.gz
rust-18dceabc9546050a2c30c525f58aaf9cbc582a6b.zip
Add tests for issue-58887
-rw-r--r--src/test/ui/issues/issue-58887.rs21
-rw-r--r--src/test/ui/issues/issue-58887.stderr35
2 files changed, 56 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-58887.rs b/src/test/ui/issues/issue-58887.rs
new file mode 100644
index 00000000000..ca2374af7bd
--- /dev/null
+++ b/src/test/ui/issues/issue-58887.rs
@@ -0,0 +1,21 @@
+#![feature(existential_type)]
+
+trait UnwrapItemsExt {
+    type II;
+    fn unwrap_items(self) -> Self::II;
+}
+
+impl<I, T, E> UnwrapItemsExt for I
+where
+    I: Iterator<Item = Result<T, E>>,
+    E: std::fmt::Debug,
+{
+    existential type II: Iterator<Item = T>;
+    //~^ ERROR: could not find defining uses
+
+    fn unwrap_items(self) -> Self::II {
+    //~^ ERROR: type parameter `T` is part of concrete type
+    //~| ERROR: type parameter `E` is part of concrete type
+        self.map(|x| x.unwrap())
+    }
+}
diff --git a/src/test/ui/issues/issue-58887.stderr b/src/test/ui/issues/issue-58887.stderr
new file mode 100644
index 00000000000..8cb25d84f54
--- /dev/null
+++ b/src/test/ui/issues/issue-58887.stderr
@@ -0,0 +1,35 @@
+error[E0601]: `main` function not found in crate `issue_58887`
+   |
+   = note: consider adding a `main` function to `$DIR/issue-58887.rs`
+
+error: type parameter `T` is part of concrete type but not used in parameter list for existential type
+  --> $DIR/issue-58887.rs:16:39
+   |
+LL |       fn unwrap_items(self) -> Self::II {
+   |  _______________________________________^
+LL | |
+LL | |
+LL | |         self.map(|x| x.unwrap())
+LL | |     }
+   | |_____^
+
+error: type parameter `E` is part of concrete type but not used in parameter list for existential type
+  --> $DIR/issue-58887.rs:16:39
+   |
+LL |       fn unwrap_items(self) -> Self::II {
+   |  _______________________________________^
+LL | |
+LL | |
+LL | |         self.map(|x| x.unwrap())
+LL | |     }
+   | |_____^
+
+error: could not find defining uses
+  --> $DIR/issue-58887.rs:13:5
+   |
+LL |     existential type II: Iterator<Item = T>;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0601`.