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 {}
|
|
|
|
|
2020-04-19 18:52:15 -05:00
|
|
|
fn foo() -> impl Quux { //~ ERROR cannot resolve opaque type
|
2018-01-17 16:19:23 -06:00
|
|
|
struct Foo<T>(T);
|
|
|
|
impl<T> Quux for Foo<T> {}
|
|
|
|
Foo(bar())
|
|
|
|
}
|
|
|
|
|
2020-04-19 18:52:15 -05:00
|
|
|
fn bar() -> impl Quux { //~ ERROR cannot resolve opaque 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(); }
|