about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBastian Kauschke <bastian_kauschke@hotmail.de>2020-04-26 11:50:58 +0200
committerBastian Kauschke <bastian_kauschke@hotmail.de>2020-04-26 11:52:12 +0200
commit7d6aef65d80581b4fe726db7fcc592e87072a33d (patch)
treef3b5335889515bfeba1ca9c000c198932795dc64
parent019ab732ce63a117cbb446db1488916c5c0bd2a7 (diff)
downloadrust-7d6aef65d80581b4fe726db7fcc592e87072a33d.tar.gz
rust-7d6aef65d80581b4fe726db7fcc592e87072a33d.zip
test iterator chain type length blowup
-rw-r--r--src/test/ui/iterators/issue-58952-filter-type-length.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/iterators/issue-58952-filter-type-length.rs b/src/test/ui/iterators/issue-58952-filter-type-length.rs
new file mode 100644
index 00000000000..046e3784084
--- /dev/null
+++ b/src/test/ui/iterators/issue-58952-filter-type-length.rs
@@ -0,0 +1,31 @@
+// run-pass
+//! This snippet causes the type length to blowup exponentially,
+//! so check that we don't accidentially exceed the type length limit.
+// FIXME: Once the size of iterator adaptors is further reduced,
+// increase the complexity of this test.
+
+fn main() {
+    let c = 2;
+    let bv = vec![2];
+    let b = bv
+        .iter()
+        .filter(|a| **a == c);
+
+    let _a = vec![1, 2, 3]
+        .into_iter()
+        .filter(|a| b.clone().any(|b| *b == *a))
+        .filter(|a| b.clone().any(|b| *b == *a))
+        .filter(|a| b.clone().any(|b| *b == *a))
+        .filter(|a| b.clone().any(|b| *b == *a))
+        .filter(|a| b.clone().any(|b| *b == *a))
+        .filter(|a| b.clone().any(|b| *b == *a))
+        .filter(|a| b.clone().any(|b| *b == *a))
+        .filter(|a| b.clone().any(|b| *b == *a))
+        .filter(|a| b.clone().any(|b| *b == *a))
+        .filter(|a| b.clone().any(|b| *b == *a))
+        .filter(|a| b.clone().any(|b| *b == *a))
+        .filter(|a| b.clone().any(|b| *b == *a))
+        .filter(|a| b.clone().any(|b| *b == *a))
+        .filter(|a| b.clone().any(|b| *b == *a))
+        .collect::<Vec<_>>();
+}