summaryrefslogtreecommitdiffstats
path: root/tests/ui/structs-enums
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /tests/ui/structs-enums
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/structs-enums')
-rw-r--r--tests/ui/structs-enums/enum-rec/issue-17431-6.rs8
-rw-r--r--tests/ui/structs-enums/enum-rec/issue-17431-6.stderr14
-rw-r--r--tests/ui/structs-enums/enum-rec/issue-17431-7.rs6
-rw-r--r--tests/ui/structs-enums/enum-rec/issue-17431-7.stderr14
-rw-r--r--tests/ui/structs-enums/rec-align-u32.rs2
-rw-r--r--tests/ui/structs-enums/rec-align-u64.rs3
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-1.rs6
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-1.stderr14
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-2.rs8
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-2.stderr20
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-3.rs8
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-3.stderr14
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-4.rs8
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-4.stderr14
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-5.rs11
-rw-r--r--tests/ui/structs-enums/struct-rec/issue-17431-5.stderr14
16 files changed, 162 insertions, 2 deletions
diff --git a/tests/ui/structs-enums/enum-rec/issue-17431-6.rs b/tests/ui/structs-enums/enum-rec/issue-17431-6.rs
new file mode 100644
index 000000000..b7e49873d
--- /dev/null
+++ b/tests/ui/structs-enums/enum-rec/issue-17431-6.rs
@@ -0,0 +1,8 @@
+use std::sync::Mutex;
+
+enum Foo { X(Mutex<Option<Foo>>) }
+//~^ ERROR recursive type `Foo` has infinite size
+
+impl Foo { fn bar(self) {} }
+
+fn main() {}
diff --git a/tests/ui/structs-enums/enum-rec/issue-17431-6.stderr b/tests/ui/structs-enums/enum-rec/issue-17431-6.stderr
new file mode 100644
index 000000000..e0a822550
--- /dev/null
+++ b/tests/ui/structs-enums/enum-rec/issue-17431-6.stderr
@@ -0,0 +1,14 @@
+error[E0072]: recursive type `Foo` has infinite size
+ --> $DIR/issue-17431-6.rs:3:1
+ |
+LL | enum Foo { X(Mutex<Option<Foo>>) }
+ | ^^^^^^^^ --- recursive without indirection
+ |
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
+ |
+LL | enum Foo { X(Mutex<Option<Box<Foo>>>) }
+ | ++++ +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
diff --git a/tests/ui/structs-enums/enum-rec/issue-17431-7.rs b/tests/ui/structs-enums/enum-rec/issue-17431-7.rs
new file mode 100644
index 000000000..4fd786278
--- /dev/null
+++ b/tests/ui/structs-enums/enum-rec/issue-17431-7.rs
@@ -0,0 +1,6 @@
+enum Foo { Voo(Option<Option<Foo>>) }
+//~^ ERROR recursive type `Foo` has infinite size
+
+impl Foo { fn bar(&self) {} }
+
+fn main() { }
diff --git a/tests/ui/structs-enums/enum-rec/issue-17431-7.stderr b/tests/ui/structs-enums/enum-rec/issue-17431-7.stderr
new file mode 100644
index 000000000..ecf072b8e
--- /dev/null
+++ b/tests/ui/structs-enums/enum-rec/issue-17431-7.stderr
@@ -0,0 +1,14 @@
+error[E0072]: recursive type `Foo` has infinite size
+ --> $DIR/issue-17431-7.rs:1:1
+ |
+LL | enum Foo { Voo(Option<Option<Foo>>) }
+ | ^^^^^^^^ --- recursive without indirection
+ |
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
+ |
+LL | enum Foo { Voo(Option<Option<Box<Foo>>>) }
+ | ++++ +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
diff --git a/tests/ui/structs-enums/rec-align-u32.rs b/tests/ui/structs-enums/rec-align-u32.rs
index ee704198d..b3c323d2a 100644
--- a/tests/ui/structs-enums/rec-align-u32.rs
+++ b/tests/ui/structs-enums/rec-align-u32.rs
@@ -3,7 +3,7 @@
#![allow(unused_unsafe)]
// Issue #2303
-#![feature(intrinsics)]
+#![feature(intrinsics, rustc_attrs)]
use std::mem;
diff --git a/tests/ui/structs-enums/rec-align-u64.rs b/tests/ui/structs-enums/rec-align-u64.rs
index f21c9b2c8..de008bcc0 100644
--- a/tests/ui/structs-enums/rec-align-u64.rs
+++ b/tests/ui/structs-enums/rec-align-u64.rs
@@ -5,7 +5,7 @@
// Issue #2303
-#![feature(intrinsics)]
+#![feature(intrinsics, rustc_attrs)]
use std::mem;
@@ -37,6 +37,7 @@ struct Outer {
target_os = "emscripten",
target_os = "freebsd",
target_os = "fuchsia",
+ target_os = "hurd",
target_os = "illumos",
target_os = "linux",
target_os = "macos",
diff --git a/tests/ui/structs-enums/struct-rec/issue-17431-1.rs b/tests/ui/structs-enums/struct-rec/issue-17431-1.rs
new file mode 100644
index 000000000..3b692cc0e
--- /dev/null
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-1.rs
@@ -0,0 +1,6 @@
+struct Foo { foo: Option<Option<Foo>> }
+//~^ ERROR recursive type `Foo` has infinite size
+
+impl Foo { fn bar(&self) {} }
+
+fn main() {}
diff --git a/tests/ui/structs-enums/struct-rec/issue-17431-1.stderr b/tests/ui/structs-enums/struct-rec/issue-17431-1.stderr
new file mode 100644
index 000000000..e3af8976c
--- /dev/null
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-1.stderr
@@ -0,0 +1,14 @@
+error[E0072]: recursive type `Foo` has infinite size
+ --> $DIR/issue-17431-1.rs:1:1
+ |
+LL | struct Foo { foo: Option<Option<Foo>> }
+ | ^^^^^^^^^^ --- recursive without indirection
+ |
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
+ |
+LL | struct Foo { foo: Option<Option<Box<Foo>>> }
+ | ++++ +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
diff --git a/tests/ui/structs-enums/struct-rec/issue-17431-2.rs b/tests/ui/structs-enums/struct-rec/issue-17431-2.rs
new file mode 100644
index 000000000..f7b9c6a55
--- /dev/null
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-2.rs
@@ -0,0 +1,8 @@
+struct Baz { q: Option<Foo> }
+//~^ ERROR recursive types `Baz` and `Foo` have infinite size
+
+struct Foo { q: Option<Baz> }
+
+impl Foo { fn bar(&self) {} }
+
+fn main() {}
diff --git a/tests/ui/structs-enums/struct-rec/issue-17431-2.stderr b/tests/ui/structs-enums/struct-rec/issue-17431-2.stderr
new file mode 100644
index 000000000..39a99ec1e
--- /dev/null
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-2.stderr
@@ -0,0 +1,20 @@
+error[E0072]: recursive types `Baz` and `Foo` have infinite size
+ --> $DIR/issue-17431-2.rs:1:1
+ |
+LL | struct Baz { q: Option<Foo> }
+ | ^^^^^^^^^^ --- recursive without indirection
+...
+LL | struct Foo { q: Option<Baz> }
+ | ^^^^^^^^^^ --- recursive without indirection
+ |
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
+ |
+LL ~ struct Baz { q: Option<Box<Foo>> }
+LL |
+LL |
+LL ~ struct Foo { q: Option<Box<Baz>> }
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
diff --git a/tests/ui/structs-enums/struct-rec/issue-17431-3.rs b/tests/ui/structs-enums/struct-rec/issue-17431-3.rs
new file mode 100644
index 000000000..83a63a88b
--- /dev/null
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-3.rs
@@ -0,0 +1,8 @@
+use std::sync::Mutex;
+
+struct Foo { foo: Mutex<Option<Foo>> }
+//~^ ERROR recursive type `Foo` has infinite size
+
+impl Foo { fn bar(&self) {} }
+
+fn main() {}
diff --git a/tests/ui/structs-enums/struct-rec/issue-17431-3.stderr b/tests/ui/structs-enums/struct-rec/issue-17431-3.stderr
new file mode 100644
index 000000000..394134c78
--- /dev/null
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-3.stderr
@@ -0,0 +1,14 @@
+error[E0072]: recursive type `Foo` has infinite size
+ --> $DIR/issue-17431-3.rs:3:1
+ |
+LL | struct Foo { foo: Mutex<Option<Foo>> }
+ | ^^^^^^^^^^ --- recursive without indirection
+ |
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
+ |
+LL | struct Foo { foo: Mutex<Option<Box<Foo>>> }
+ | ++++ +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
diff --git a/tests/ui/structs-enums/struct-rec/issue-17431-4.rs b/tests/ui/structs-enums/struct-rec/issue-17431-4.rs
new file mode 100644
index 000000000..48f0dba2a
--- /dev/null
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-4.rs
@@ -0,0 +1,8 @@
+use std::marker;
+
+struct Foo<T> { foo: Option<Option<Foo<T>>>, marker: marker::PhantomData<T> }
+//~^ ERROR recursive type `Foo` has infinite size
+
+impl<T> Foo<T> { fn bar(&self) {} }
+
+fn main() {}
diff --git a/tests/ui/structs-enums/struct-rec/issue-17431-4.stderr b/tests/ui/structs-enums/struct-rec/issue-17431-4.stderr
new file mode 100644
index 000000000..3d141e44b
--- /dev/null
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-4.stderr
@@ -0,0 +1,14 @@
+error[E0072]: recursive type `Foo` has infinite size
+ --> $DIR/issue-17431-4.rs:3:1
+ |
+LL | struct Foo<T> { foo: Option<Option<Foo<T>>>, marker: marker::PhantomData<T> }
+ | ^^^^^^^^^^^^^ ------ recursive without indirection
+ |
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
+ |
+LL | struct Foo<T> { foo: Option<Option<Box<Foo<T>>>>, marker: marker::PhantomData<T> }
+ | ++++ +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
diff --git a/tests/ui/structs-enums/struct-rec/issue-17431-5.rs b/tests/ui/structs-enums/struct-rec/issue-17431-5.rs
new file mode 100644
index 000000000..0fd6ee611
--- /dev/null
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-5.rs
@@ -0,0 +1,11 @@
+use std::marker;
+
+struct Foo { foo: Bar<Foo> }
+
+struct Bar<T> { x: Bar<Foo> , marker: marker::PhantomData<T> }
+//~^ ERROR recursive type `Bar` has infinite size
+
+impl Foo { fn foo(&self) {} }
+
+fn main() {
+}
diff --git a/tests/ui/structs-enums/struct-rec/issue-17431-5.stderr b/tests/ui/structs-enums/struct-rec/issue-17431-5.stderr
new file mode 100644
index 000000000..44a90a6fe
--- /dev/null
+++ b/tests/ui/structs-enums/struct-rec/issue-17431-5.stderr
@@ -0,0 +1,14 @@
+error[E0072]: recursive type `Bar` has infinite size
+ --> $DIR/issue-17431-5.rs:5:1
+ |
+LL | struct Bar<T> { x: Bar<Foo> , marker: marker::PhantomData<T> }
+ | ^^^^^^^^^^^^^ -------- recursive without indirection
+ |
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
+ |
+LL | struct Bar<T> { x: Box<Bar<Foo>> , marker: marker::PhantomData<T> }
+ | ++++ +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.