]> git.lizzy.rs Git - rust.git/commitdiff
Test aller things
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Fri, 25 Jan 2019 19:37:10 +0000 (20:37 +0100)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Fri, 1 Feb 2019 15:38:46 +0000 (16:38 +0100)
src/test/ui/existential_types/generic_duplicate_param_use5.rs [new file with mode: 0644]
src/test/ui/existential_types/generic_duplicate_param_use5.stderr [new file with mode: 0644]

diff --git a/src/test/ui/existential_types/generic_duplicate_param_use5.rs b/src/test/ui/existential_types/generic_duplicate_param_use5.rs
new file mode 100644 (file)
index 0000000..f9d336d
--- /dev/null
@@ -0,0 +1,15 @@
+#![feature(existential_type)]
+
+fn main() {}
+
+// test that unused generic parameters are ok
+existential type Two<T, U>: 'static;
+
+fn one<T: 'static>(t: T) -> Two<T, T> {
+    t
+}
+
+fn two<T: 'static, U: 'static>(t: T, _: U) -> Two<U, T> {
+//~^ ERROR defining existential type use differs from previous
+    t
+}
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use5.stderr b/src/test/ui/existential_types/generic_duplicate_param_use5.stderr
new file mode 100644 (file)
index 0000000..e2bf4a9
--- /dev/null
@@ -0,0 +1,19 @@
+error: defining existential type use differs from previous
+  --> $DIR/generic_duplicate_param_use5.rs:12:1
+   |
+LL | / fn two<T: 'static, U: 'static>(t: T, _: U) -> Two<U, T> {
+LL | | //~^ ERROR defining existential type use differs from previous
+LL | |     t
+LL | | }
+   | |_^
+   |
+note: previous use here
+  --> $DIR/generic_duplicate_param_use5.rs:8:1
+   |
+LL | / fn one<T: 'static>(t: T) -> Two<T, T> {
+LL | |     t
+LL | | }
+   | |_^
+
+error: aborting due to previous error
+