2018-01-17 16:19:23 -06:00
|
|
|
// Test that attempts to construct infinite types via impl trait fail
|
|
|
|
// in a graceful way.
|
|
|
|
//
|
|
|
|
// Regression test for #38064.
|
|
|
|
|
|
|
|
trait Quux {}
|
|
|
|
|
2018-11-18 12:33:44 -06:00
|
|
|
fn foo() -> impl Quux { //~ opaque type expands to a recursive type
|
2018-01-17 16:19:23 -06:00
|
|
|
struct Foo<T>(T);
|
|
|
|
impl<T> Quux for Foo<T> {}
|
|
|
|
Foo(bar())
|
|
|
|
}
|
|
|
|
|
2018-11-18 12:33:44 -06:00
|
|
|
fn bar() -> impl Quux { //~ opaque type expands to a recursive type
|
2018-01-17 16:19:23 -06:00
|
|
|
struct Bar<T>(T);
|
|
|
|
impl<T> Quux for Bar<T> {}
|
|
|
|
Bar(foo())
|
|
|
|
}
|
|
|
|
|
|
|
|
// effectively:
|
|
|
|
// struct Foo(Bar);
|
|
|
|
// struct Bar(Foo);
|
|
|
|
// should produce an error about infinite size
|
|
|
|
|
|
|
|
fn main() { foo(); }
|