about summary refs log tree commit diff
path: root/tests/ui/impl-trait/recursive-bound-eval.rs
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-06-11 06:49:05 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-06-11 08:08:25 +0000
commitfe55c0091db4654ad0185831aa3dd110e5e6cd73 (patch)
tree3c2f31a4f568fefeef6c0e86230d8d88252760c2 /tests/ui/impl-trait/recursive-bound-eval.rs
parentaec67e238d366c4c41373b272f19dd79ff5ec0f0 (diff)
downloadrust-fe55c0091db4654ad0185831aa3dd110e5e6cd73.tar.gz
rust-fe55c0091db4654ad0185831aa3dd110e5e6cd73.zip
Add regression test
Diffstat (limited to 'tests/ui/impl-trait/recursive-bound-eval.rs')
-rw-r--r--tests/ui/impl-trait/recursive-bound-eval.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/recursive-bound-eval.rs b/tests/ui/impl-trait/recursive-bound-eval.rs
new file mode 100644
index 00000000000..f992cb3071a
--- /dev/null
+++ b/tests/ui/impl-trait/recursive-bound-eval.rs
@@ -0,0 +1,18 @@
+pub trait Parser<E> {
+    fn parse(&self) -> E;
+}
+
+impl<E, T: Fn() -> E> Parser<E> for T {
+    fn parse(&self) -> E {
+        self()
+    }
+}
+
+pub fn recursive_fn<E>() -> impl Parser<E> {
+    //~^ ERROR: cycle detected
+    move || recursive_fn().parse()
+    //~^ ERROR: type annotations needed
+    //~| ERROR: no method named `parse` found for opaque type
+}
+
+fn main() {}