diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 09:25:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 09:25:56 +0000 |
commit | 018c4950b9406055dec02ef0fb52f132e2bb1e2c (patch) | |
tree | a835ebdf2088ef88fa681f8fad45f09922c1ae9a /tests/ui/traits/well-formed-recursion-limit.rs | |
parent | Adding debian version 1.75.0+dfsg1-5. (diff) | |
download | rustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.tar.xz rustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.zip |
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/traits/well-formed-recursion-limit.rs')
-rw-r--r-- | tests/ui/traits/well-formed-recursion-limit.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ui/traits/well-formed-recursion-limit.rs b/tests/ui/traits/well-formed-recursion-limit.rs new file mode 100644 index 000000000..056cf947d --- /dev/null +++ b/tests/ui/traits/well-formed-recursion-limit.rs @@ -0,0 +1,27 @@ +// Regression test for #117151, this used to hang the compiler + +pub type ISO<A: 'static, B: 'static> = (Box<dyn Fn(A) -> B>, Box<dyn Fn(B) -> A>); +pub fn iso<A: 'static, B: 'static, F1, F2>(a: F1, b: F2) -> ISO<A, B> +where + F1: 'static + Fn(A) -> B, + F2: 'static + Fn(B) -> A, +{ + (Box::new(a), Box::new(b)) +} +pub fn iso_un_option<A: 'static, B: 'static>(i: ISO<Option<A>, Option<B>>) -> ISO<A, B> { + let (ab, ba) = (i.ab, i.ba); + //~^ ERROR no field `ab` on type + //~| ERROR no field `ba` on type + let left = move |o_a| match o_a { + //~^ ERROR overflow evaluating the requirement + None => panic!("absured"), + Some(a) => a, + }; + let right = move |o_b| match o_b { + None => panic!("absurd"), + Some(b) => b, + }; + iso(left, right) +} + +fn main() {} |