diff options
Diffstat (limited to 'tests/ui/infinite')
-rw-r--r-- | tests/ui/infinite/auxiliary/alias.rs | 2 | ||||
-rw-r--r-- | tests/ui/infinite/infinite-alias.rs | 9 | ||||
-rw-r--r-- | tests/ui/infinite/infinite-alias.stderr | 14 |
3 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/infinite/auxiliary/alias.rs b/tests/ui/infinite/auxiliary/alias.rs new file mode 100644 index 000000000..59add7eb1 --- /dev/null +++ b/tests/ui/infinite/auxiliary/alias.rs @@ -0,0 +1,2 @@ +pub struct W<T>(T); +pub type Wrapper<T> = W<T>; diff --git a/tests/ui/infinite/infinite-alias.rs b/tests/ui/infinite/infinite-alias.rs new file mode 100644 index 000000000..45356f359 --- /dev/null +++ b/tests/ui/infinite/infinite-alias.rs @@ -0,0 +1,9 @@ +// aux-build: alias.rs +// regression test for 108160 + +extern crate alias; + +use alias::Wrapper; +struct Rec(Wrapper<Rec>); //~ ERROR recursive type `Rec` has infinite + +fn main() {} diff --git a/tests/ui/infinite/infinite-alias.stderr b/tests/ui/infinite/infinite-alias.stderr new file mode 100644 index 000000000..9d9265f8c --- /dev/null +++ b/tests/ui/infinite/infinite-alias.stderr @@ -0,0 +1,14 @@ +error[E0072]: recursive type `Rec` has infinite size + --> $DIR/infinite-alias.rs:7:1 + | +LL | struct Rec(Wrapper<Rec>); + | ^^^^^^^^^^ ------------ recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | struct Rec(Box<Wrapper<Rec>>); + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. |