]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/infinite-impl-trait-issue-38064.rs
Remove licenses
[rust.git] / src / test / ui / impl-trait / infinite-impl-trait-issue-38064.rs
1 // Test that attempts to construct infinite types via impl trait fail
2 // in a graceful way.
3 //
4 // Regression test for #38064.
5
6 // error-pattern:overflow evaluating the requirement `impl Quux`
7
8 trait Quux {}
9
10 fn foo() -> impl Quux {
11     struct Foo<T>(T);
12     impl<T> Quux for Foo<T> {}
13     Foo(bar())
14 }
15
16 fn bar() -> impl Quux {
17     struct Bar<T>(T);
18     impl<T> Quux for Bar<T> {}
19     Bar(foo())
20 }
21
22 // effectively:
23 //     struct Foo(Bar);
24 //     struct Bar(Foo);
25 // should produce an error about infinite size
26
27 fn main() { foo(); }