about summary refs log tree commit diff
path: root/tests/ui/iterators
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-05-24 14:09:40 -0400
committerMichael Goulet <michael@errs.io>2024-07-02 15:48:48 -0400
commit0f7f3f4045a3b34678584a4148ff452f8a072904 (patch)
treedb223025493056bb77a544ffb6e92123b03d177f /tests/ui/iterators
parent9dc129ae829f8f322421dc9fb2c64d58e11eb08a (diff)
downloadrust-0f7f3f4045a3b34678584a4148ff452f8a072904.tar.gz
rust-0f7f3f4045a3b34678584a4148ff452f8a072904.zip
Re-implement a type-size based limit
Diffstat (limited to 'tests/ui/iterators')
-rw-r--r--tests/ui/iterators/issue-58952-filter-type-length.rs7
-rw-r--r--tests/ui/iterators/issue-58952-filter-type-length.stderr8
-rw-r--r--tests/ui/iterators/iter-map-fold-type-length.rs2
3 files changed, 14 insertions, 3 deletions
diff --git a/tests/ui/iterators/issue-58952-filter-type-length.rs b/tests/ui/iterators/issue-58952-filter-type-length.rs
index 9904eddb598..b2c208ae28f 100644
--- a/tests/ui/iterators/issue-58952-filter-type-length.rs
+++ b/tests/ui/iterators/issue-58952-filter-type-length.rs
@@ -1,5 +1,4 @@
-//@ run-pass
-//@ ignore-compare-mode-next-solver (hangs)
+//@ build-fail
 
 //! This snippet causes the type length to blowup exponentially,
 //! so check that we don't accidentally exceed the type length limit.
@@ -30,5 +29,9 @@ fn main() {
         .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::<VecDeque<_>>();
 }
diff --git a/tests/ui/iterators/issue-58952-filter-type-length.stderr b/tests/ui/iterators/issue-58952-filter-type-length.stderr
new file mode 100644
index 00000000000..975fcd4afff
--- /dev/null
+++ b/tests/ui/iterators/issue-58952-filter-type-length.stderr
@@ -0,0 +1,8 @@
+error: reached the type-length limit while instantiating `<std::vec::IntoIter<i32> as Iterator>::try_fold::<vec::in_place_drop::InPlaceDrop<i32>, {closure@iter::adapters::filter::filter_try_fold<'_, ..., ..., ..., ..., ...>::{closure#0}}, ...>`
+  --> $SRC_DIR/core/src/iter/adapters/filter.rs:LL:COL
+   |
+   = help: consider adding a `#![type_length_limit="21233607"]` attribute to your crate
+   = note: the full type name has been written to '$TEST_BUILD_DIR/iterators/issue-58952-filter-type-length/issue-58952-filter-type-length.long-type.txt'
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/iterators/iter-map-fold-type-length.rs b/tests/ui/iterators/iter-map-fold-type-length.rs
index 6444fb9dada..5f9567d68e8 100644
--- a/tests/ui/iterators/iter-map-fold-type-length.rs
+++ b/tests/ui/iterators/iter-map-fold-type-length.rs
@@ -3,7 +3,7 @@
 //!
 //! The normal limit is a million, and this test used to exceed 1.5 million, but
 //! now we can survive an even tighter limit. Still seems excessive though...
-#![type_length_limit = "256000"]
+#![type_length_limit = "1327047"]
 
 // Custom wrapper so Iterator methods aren't specialized.
 struct Iter<I>(I);