summaryrefslogtreecommitdiffstats
path: root/src/test/ui/unsafe/issue-87414-query-cycle.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/unsafe/issue-87414-query-cycle.rs')
-rw-r--r--src/test/ui/unsafe/issue-87414-query-cycle.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/ui/unsafe/issue-87414-query-cycle.rs b/src/test/ui/unsafe/issue-87414-query-cycle.rs
new file mode 100644
index 000000000..99e40ba4b
--- /dev/null
+++ b/src/test/ui/unsafe/issue-87414-query-cycle.rs
@@ -0,0 +1,15 @@
+// Regression test for #87414.
+
+// check-pass
+// compile-flags: -Zthir-unsafeck
+
+fn bad<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> { todo!() }
+
+fn foo() -> [(); { |x: u32| { x }; 4 }] { todo!() }
+fn bar() { let _: [(); { |x: u32| { x }; 4 }]; }
+
+// This one should not cause any errors either:
+unsafe fn unsf() {}
+fn bad2<T>() -> Box<dyn Iterator<Item = [(); { unsafe { || { unsf() } }; 4 }]>> { todo!() }
+
+fn main() {}