about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2019-07-23 12:51:13 -0400
committerGitHub <noreply@github.com>2019-07-23 12:51:13 -0400
commit8afc53c195413c3bc785d134db79751434efd707 (patch)
tree4613eb97c1fb6d891d7b84ba4b73a3786273ba6b
parent24a8065c30e15138a26be957f93c7bc8ad13b291 (diff)
parente75ae15fb912afe56f07425abbba9e3412d0c01d (diff)
downloadrust-8afc53c195413c3bc785d134db79751434efd707.tar.gz
rust-8afc53c195413c3bc785d134db79751434efd707.zip
Rollup merge of #62842 - JohnTitor:test-for-58887, r=alexreg
Add tests for issue-58887

Closes #58887
-rw-r--r--src/test/ui/existential-type/issue-58887.rs23
-rw-r--r--src/test/ui/existential-type/issue-58887.stderr30
2 files changed, 53 insertions, 0 deletions
diff --git a/src/test/ui/existential-type/issue-58887.rs b/src/test/ui/existential-type/issue-58887.rs
new file mode 100644
index 00000000000..f038648ec21
--- /dev/null
+++ b/src/test/ui/existential-type/issue-58887.rs
@@ -0,0 +1,23 @@
+#![feature(existential_type)]
+
+trait UnwrapItemsExt {
+    type Iter;
+    fn unwrap_items(self) -> Self::Iter;
+}
+
+impl<I, T, E> UnwrapItemsExt for I
+where
+    I: Iterator<Item = Result<T, E>>,
+    E: std::fmt::Debug,
+{
+    existential type Iter: Iterator<Item = T>;
+    //~^ ERROR: could not find defining uses
+
+    fn unwrap_items(self) -> Self::Iter {
+    //~^ ERROR: type parameter `T` is part of concrete type
+    //~| ERROR: type parameter `E` is part of concrete type
+        self.map(|x| x.unwrap())
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/existential-type/issue-58887.stderr b/src/test/ui/existential-type/issue-58887.stderr
new file mode 100644
index 00000000000..800f4b7e059
--- /dev/null
+++ b/src/test/ui/existential-type/issue-58887.stderr
@@ -0,0 +1,30 @@
+error: type parameter `T` is part of concrete type but not used in parameter list for existential type
+  --> $DIR/issue-58887.rs:16:41
+   |
+LL |       fn unwrap_items(self) -> Self::Iter {
+   |  _________________________________________^
+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:41
+   |
+LL |       fn unwrap_items(self) -> Self::Iter {
+   |  _________________________________________^
+LL | |
+LL | |
+LL | |         self.map(|x| x.unwrap())
+LL | |     }
+   | |_____^
+
+error: could not find defining uses
+  --> $DIR/issue-58887.rs:13:5
+   |
+LL |     existential type Iter: Iterator<Item = T>;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+