summaryrefslogtreecommitdiffstats
path: root/src/test/ui/structs-enums
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/structs-enums')
-rw-r--r--src/test/ui/structs-enums/issue-2718-a.rs12
-rw-r--r--src/test/ui/structs-enums/issue-2718-a.stderr14
-rw-r--r--src/test/ui/structs-enums/rec-align-u32.rs1
-rw-r--r--src/test/ui/structs-enums/rec-align-u64.rs1
-rw-r--r--src/test/ui/structs-enums/struct-rec/issue-74224.stderr4
-rw-r--r--src/test/ui/structs-enums/struct-rec/issue-84611.stderr4
-rw-r--r--src/test/ui/structs-enums/struct-rec/mutual-struct-recursion.rs6
-rw-r--r--src/test/ui/structs-enums/struct-rec/mutual-struct-recursion.stderr62
8 files changed, 60 insertions, 44 deletions
diff --git a/src/test/ui/structs-enums/issue-2718-a.rs b/src/test/ui/structs-enums/issue-2718-a.rs
new file mode 100644
index 000000000..6c4915845
--- /dev/null
+++ b/src/test/ui/structs-enums/issue-2718-a.rs
@@ -0,0 +1,12 @@
+pub struct SendPacket<T> {
+ p: T
+}
+
+mod pingpong {
+ use SendPacket;
+ pub type Ping = SendPacket<Pong>;
+ pub struct Pong(SendPacket<Ping>);
+ //~^ ERROR recursive type `Pong` has infinite size
+}
+
+fn main() {}
diff --git a/src/test/ui/structs-enums/issue-2718-a.stderr b/src/test/ui/structs-enums/issue-2718-a.stderr
new file mode 100644
index 000000000..7ea620f38
--- /dev/null
+++ b/src/test/ui/structs-enums/issue-2718-a.stderr
@@ -0,0 +1,14 @@
+error[E0072]: recursive type `Pong` has infinite size
+ --> $DIR/issue-2718-a.rs:8:5
+ |
+LL | pub struct Pong(SendPacket<Ping>);
+ | ^^^^^^^^^^^^^^^ ---------------- recursive without indirection
+ |
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
+ |
+LL | pub struct Pong(Box<SendPacket<Ping>>);
+ | ++++ +
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
diff --git a/src/test/ui/structs-enums/rec-align-u32.rs b/src/test/ui/structs-enums/rec-align-u32.rs
index 889294daa..ee704198d 100644
--- a/src/test/ui/structs-enums/rec-align-u32.rs
+++ b/src/test/ui/structs-enums/rec-align-u32.rs
@@ -10,6 +10,7 @@ use std::mem;
mod rusti {
extern "rust-intrinsic" {
pub fn pref_align_of<T>() -> usize;
+ #[rustc_safe_intrinsic]
pub fn min_align_of<T>() -> usize;
}
}
diff --git a/src/test/ui/structs-enums/rec-align-u64.rs b/src/test/ui/structs-enums/rec-align-u64.rs
index 3bc2d16cf..40ede9705 100644
--- a/src/test/ui/structs-enums/rec-align-u64.rs
+++ b/src/test/ui/structs-enums/rec-align-u64.rs
@@ -12,6 +12,7 @@ use std::mem;
mod rusti {
extern "rust-intrinsic" {
pub fn pref_align_of<T>() -> usize;
+ #[rustc_safe_intrinsic]
pub fn min_align_of<T>() -> usize;
}
}
diff --git a/src/test/ui/structs-enums/struct-rec/issue-74224.stderr b/src/test/ui/structs-enums/struct-rec/issue-74224.stderr
index 619917846..f1d50bc8a 100644
--- a/src/test/ui/structs-enums/struct-rec/issue-74224.stderr
+++ b/src/test/ui/structs-enums/struct-rec/issue-74224.stderr
@@ -2,12 +2,12 @@ error[E0072]: recursive type `A` has infinite size
--> $DIR/issue-74224.rs:1:1
|
LL | struct A<T> {
- | ^^^^^^^^^^^ recursive type has infinite size
+ | ^^^^^^^^^^^
...
LL | y: A<A<T>>,
| ------- recursive without indirection
|
-help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `A` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
|
LL | y: Box<A<A<T>>>,
| ++++ +
diff --git a/src/test/ui/structs-enums/struct-rec/issue-84611.stderr b/src/test/ui/structs-enums/struct-rec/issue-84611.stderr
index 2e99435e0..536f54e3e 100644
--- a/src/test/ui/structs-enums/struct-rec/issue-84611.stderr
+++ b/src/test/ui/structs-enums/struct-rec/issue-84611.stderr
@@ -2,12 +2,12 @@ error[E0072]: recursive type `Foo` has infinite size
--> $DIR/issue-84611.rs:1:1
|
LL | struct Foo<T> {
- | ^^^^^^^^^^^^^ recursive type has infinite size
+ | ^^^^^^^^^^^^^
LL |
LL | x: Foo<[T; 1]>,
| ----------- recursive without indirection
|
-help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
|
LL | x: Box<Foo<[T; 1]>>,
| ++++ +
diff --git a/src/test/ui/structs-enums/struct-rec/mutual-struct-recursion.rs b/src/test/ui/structs-enums/struct-rec/mutual-struct-recursion.rs
index cca97f43e..3bfce8b4f 100644
--- a/src/test/ui/structs-enums/struct-rec/mutual-struct-recursion.rs
+++ b/src/test/ui/structs-enums/struct-rec/mutual-struct-recursion.rs
@@ -1,22 +1,20 @@
struct A<T> {
-//~^ ERROR recursive type `A` has infinite size
+//~^ ERROR recursive types `A` and `B` have infinite size
x: T,
y: B<T>,
}
struct B<T> {
-//~^ ERROR recursive type `B` has infinite size
z: A<T>
}
struct C<T> {
-//~^ ERROR recursive type `C` has infinite size
+//~^ ERROR recursive types `C` and `D` have infinite size
x: T,
y: Option<Option<D<T>>>,
}
struct D<T> {
-//~^ ERROR recursive type `D` has infinite size
z: Option<Option<C<T>>>,
}
diff --git a/src/test/ui/structs-enums/struct-rec/mutual-struct-recursion.stderr b/src/test/ui/structs-enums/struct-rec/mutual-struct-recursion.stderr
index 80a494f3f..881bc2819 100644
--- a/src/test/ui/structs-enums/struct-rec/mutual-struct-recursion.stderr
+++ b/src/test/ui/structs-enums/struct-rec/mutual-struct-recursion.stderr
@@ -1,59 +1,49 @@
-error[E0072]: recursive type `A` has infinite size
+error[E0072]: recursive types `A` and `B` have infinite size
--> $DIR/mutual-struct-recursion.rs:1:1
|
LL | struct A<T> {
- | ^^^^^^^^^^^ recursive type has infinite size
+ | ^^^^^^^^^^^
...
LL | y: B<T>,
| ---- recursive without indirection
- |
-help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `A` representable
- |
-LL | y: Box<B<T>>,
- | ++++ +
-
-error[E0072]: recursive type `B` has infinite size
- --> $DIR/mutual-struct-recursion.rs:7:1
- |
+...
LL | struct B<T> {
- | ^^^^^^^^^^^ recursive type has infinite size
-LL |
+ | ^^^^^^^^^^^
LL | z: A<T>
| ---- recursive without indirection
|
-help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `B` representable
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
+ |
+LL ~ y: Box<B<T>>,
+LL | }
+LL |
+LL | struct B<T> {
+LL ~ z: Box<A<T>>
|
-LL | z: Box<A<T>>
- | ++++ +
-error[E0072]: recursive type `C` has infinite size
- --> $DIR/mutual-struct-recursion.rs:12:1
+error[E0072]: recursive types `C` and `D` have infinite size
+ --> $DIR/mutual-struct-recursion.rs:11:1
|
LL | struct C<T> {
- | ^^^^^^^^^^^ recursive type has infinite size
+ | ^^^^^^^^^^^
...
LL | y: Option<Option<D<T>>>,
- | -------------------- recursive without indirection
- |
-help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `C` representable
- |
-LL | y: Option<Box<Option<D<T>>>>,
- | ++++ +
-
-error[E0072]: recursive type `D` has infinite size
- --> $DIR/mutual-struct-recursion.rs:18:1
- |
+ | ---- recursive without indirection
+...
LL | struct D<T> {
- | ^^^^^^^^^^^ recursive type has infinite size
-LL |
+ | ^^^^^^^^^^^
LL | z: Option<Option<C<T>>>,
- | -------------------- recursive without indirection
+ | ---- recursive without indirection
+ |
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
|
-help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `D` representable
+LL ~ y: Option<Option<Box<D<T>>>>,
+LL | }
+LL |
+LL | struct D<T> {
+LL ~ z: Option<Option<Box<C<T>>>>,
|
-LL | z: Option<Box<Option<C<T>>>>,
- | ++++ +
-error: aborting due to 4 previous errors
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0072`.