about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-12-07 03:50:35 +0000
committerMichael Goulet <michael@errs.io>2022-12-27 17:56:57 +0000
commitfa2f31b97178c3a66d6e5f91fa597711f585fd3b (patch)
tree25c74b14a621e207a3a5e57a14b385aef0734ccd /src/test/ui
parent9f59ab55e6e5e8825cfc36bd90ed4d5b387ecd70 (diff)
downloadrust-fa2f31b97178c3a66d6e5f91fa597711f585fd3b.tar.gz
rust-fa2f31b97178c3a66d6e5f91fa597711f585fd3b.zip
More tests
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/closures/supertrait-hint-cycle-2.rs18
-rw-r--r--src/test/ui/closures/supertrait-hint-cycle-3.rs16
2 files changed, 34 insertions, 0 deletions
diff --git a/src/test/ui/closures/supertrait-hint-cycle-2.rs b/src/test/ui/closures/supertrait-hint-cycle-2.rs
new file mode 100644
index 00000000000..fda81b18d1e
--- /dev/null
+++ b/src/test/ui/closures/supertrait-hint-cycle-2.rs
@@ -0,0 +1,18 @@
+// check-pass
+
+trait Foo<'a> {
+    type Input;
+}
+
+impl<F: Fn(u32)> Foo<'_> for F {
+    type Input = u32;
+}
+
+trait SuperFn: for<'a> Foo<'a> + for<'a> Fn(<Self as Foo<'a>>::Input) {}
+impl<T> SuperFn for T where T: for<'a> Fn(<Self as Foo<'a>>::Input) + for<'a> Foo<'a> {}
+
+fn needs_super(_: impl SuperFn) {}
+
+fn main() {
+    needs_super(|_: u32| {});
+}
diff --git a/src/test/ui/closures/supertrait-hint-cycle-3.rs b/src/test/ui/closures/supertrait-hint-cycle-3.rs
new file mode 100644
index 00000000000..8149474df19
--- /dev/null
+++ b/src/test/ui/closures/supertrait-hint-cycle-3.rs
@@ -0,0 +1,16 @@
+// check-pass
+
+
+trait Foo<'a> {
+    type Input;
+}
+
+impl<F: Fn(u32)> Foo<'_> for F {
+    type Input = u32;
+}
+
+fn needs_super<F: for<'a> Fn(<F as Foo<'a>>::Input) + for<'a> Foo<'a>>(_: F) {}
+
+fn main() {
+    needs_super(|_: u32| {});
+}