From 3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:43 +0200 Subject: Merging upstream version 1.69.0+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/infinite/auxiliary/alias.rs | 2 ++ tests/ui/infinite/infinite-alias.rs | 9 +++++++++ tests/ui/infinite/infinite-alias.stderr | 14 ++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 tests/ui/infinite/auxiliary/alias.rs create mode 100644 tests/ui/infinite/infinite-alias.rs create mode 100644 tests/ui/infinite/infinite-alias.stderr (limited to 'tests/ui/infinite') 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); +pub type Wrapper = W; 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); //~ 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); + | ^^^^^^^^^^ ------------ recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | struct Rec(Box>); + | ++++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`. -- cgit v1.2.3