diff options
| author | Michael Goulet <michael@errs.io> | 2025-04-25 17:57:59 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-04-25 18:14:39 +0000 |
| commit | 31c8d10342bfa437d23eb4aa3f9c807a67f14272 (patch) | |
| tree | 9d756d5a1c61c6c838fee5660108145caeb1e056 /tests | |
| parent | 8f43b85954d2f3d8fc00a7504c603e5ca9eb0695 (diff) | |
| download | rust-31c8d10342bfa437d23eb4aa3f9c807a67f14272.tar.gz rust-31c8d10342bfa437d23eb4aa3f9c807a67f14272.zip | |
Track per-obligation recursion depth only if there is inference
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/traits/next-solver/coerce-depth.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/traits/next-solver/coerce-depth.rs b/tests/ui/traits/next-solver/coerce-depth.rs new file mode 100644 index 00000000000..c8fc3fcab59 --- /dev/null +++ b/tests/ui/traits/next-solver/coerce-depth.rs @@ -0,0 +1,31 @@ +//@ check-pass +//@ compile-flags: -Znext-solver + +// Ensure that a stack of coerce predicates doesn't end up overflowing when they get procesed +// in *reverse* order, which may require O(N) iterations of the fulfillment loop. + +#![recursion_limit = "16"] + +fn main() { + match 0 { + 0 => None, + 1 => None, + 2 => None, + 3 => None, + 4 => None, + 5 => None, + 6 => None, + 7 => None, + 8 => None, + 9 => None, + 10 => None, + 11 => None, + 12 => None, + 13 => None, + 14 => None, + 15 => None, + 16 => None, + 17 => None, + _ => Some(1u32), + }; +} |
