about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-04-29 19:39:30 +0200
committerGitHub <noreply@github.com>2020-04-29 19:39:30 +0200
commit843ffb8e8a37b4ddd134d97eb456556469d041a9 (patch)
tree827a3a646b83fa376d1554b1351b9e5e630d8e26 /src/test
parentd9761daa575a202c3d119eb3a74632412bef37f7 (diff)
parent7d6aef65d80581b4fe726db7fcc592e87072a33d (diff)
downloadrust-843ffb8e8a37b4ddd134d97eb456556469d041a9.tar.gz
rust-843ffb8e8a37b4ddd134d97eb456556469d041a9.zip
Rollup merge of #71572 - lcnr:type_length, r=Dylan-DPC
test iterator chain type length blowup

Adds a regression test. closes #58952

r? @Dylan-DPC
Diffstat (limited to 'src/test')
-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<_>>();
+}