about summary refs log tree commit diff
path: root/tests/ui/impl-trait/method/method-resolution4.rs
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2025-09-24 10:08:00 +0200
committerlcnr <rust@lcnr.de>2025-09-26 16:33:15 +0200
commiteebf871feaca10886f80a76a36b3771e960c047e (patch)
tree46b7109fabb01dfc5d38fd73f21ce7f145b9d33c /tests/ui/impl-trait/method/method-resolution4.rs
parent148fd9ad3c434c26a952e01e37c35aa26cb8315c (diff)
downloadrust-eebf871feaca10886f80a76a36b3771e960c047e.tar.gz
rust-eebf871feaca10886f80a76a36b3771e960c047e.zip
move tests
Diffstat (limited to 'tests/ui/impl-trait/method/method-resolution4.rs')
-rw-r--r--tests/ui/impl-trait/method/method-resolution4.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/method/method-resolution4.rs b/tests/ui/impl-trait/method/method-resolution4.rs
new file mode 100644
index 00000000000..f90a9309cda
--- /dev/null
+++ b/tests/ui/impl-trait/method/method-resolution4.rs
@@ -0,0 +1,18 @@
+//! The recursive method call yields the opaque type. The
+//! `next` method call then constrains the hidden type to `&mut _`
+//! because `next` takes `&mut self`. We never resolve the inference
+//! variable, but get a type mismatch when comparing `&mut _` with
+//! `std::iter::Empty`.
+
+//@ revisions: current next
+//@[next] compile-flags: -Znext-solver
+//@ check-pass
+
+fn foo(b: bool) -> impl Iterator<Item = ()> {
+    if b {
+        foo(false).next().unwrap();
+    }
+    std::iter::empty()
+}
+
+fn main() {}