From 20431706a863f92cb37dc512fef6e48d192aaf2c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:11:38 +0200 Subject: Merging upstream version 1.66.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/structs-enums/issue-2718-a.rs | 12 +++++ src/test/ui/structs-enums/issue-2718-a.stderr | 14 +++++ src/test/ui/structs-enums/rec-align-u32.rs | 1 + src/test/ui/structs-enums/rec-align-u64.rs | 1 + .../ui/structs-enums/struct-rec/issue-74224.stderr | 4 +- .../ui/structs-enums/struct-rec/issue-84611.stderr | 4 +- .../struct-rec/mutual-struct-recursion.rs | 6 +-- .../struct-rec/mutual-struct-recursion.stderr | 62 +++++++++------------- 8 files changed, 60 insertions(+), 44 deletions(-) create mode 100644 src/test/ui/structs-enums/issue-2718-a.rs create mode 100644 src/test/ui/structs-enums/issue-2718-a.stderr (limited to 'src/test/ui/structs-enums') 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 { + p: T +} + +mod pingpong { + use SendPacket; + pub type Ping = SendPacket; + pub struct Pong(SendPacket); + //~^ 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); + | ^^^^^^^^^^^^^^^ ---------------- recursive without indirection + | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle + | +LL | pub struct Pong(Box>); + | ++++ + + +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() -> usize; + #[rustc_safe_intrinsic] pub fn min_align_of() -> 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() -> usize; + #[rustc_safe_intrinsic] pub fn min_align_of() -> 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 { - | ^^^^^^^^^^^ recursive type has infinite size + | ^^^^^^^^^^^ ... LL | y: A>, | ------- 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>>, | ++++ + 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 { - | ^^^^^^^^^^^^^ 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>, | ++++ + 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 { -//~^ ERROR recursive type `A` has infinite size +//~^ ERROR recursive types `A` and `B` have infinite size x: T, y: B, } struct B { -//~^ ERROR recursive type `B` has infinite size z: A } struct C { -//~^ ERROR recursive type `C` has infinite size +//~^ ERROR recursive types `C` and `D` have infinite size x: T, y: Option>>, } struct D { -//~^ ERROR recursive type `D` has infinite size z: Option>>, } 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 { - | ^^^^^^^^^^^ recursive type has infinite size + | ^^^^^^^^^^^ ... LL | y: B, | ---- recursive without indirection - | -help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `A` representable - | -LL | y: Box>, - | ++++ + - -error[E0072]: recursive type `B` has infinite size - --> $DIR/mutual-struct-recursion.rs:7:1 - | +... LL | struct B { - | ^^^^^^^^^^^ recursive type has infinite size -LL | + | ^^^^^^^^^^^ LL | z: A | ---- 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>, +LL | } +LL | +LL | struct B { +LL ~ z: Box> | -LL | z: Box> - | ++++ + -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 { - | ^^^^^^^^^^^ recursive type has infinite size + | ^^^^^^^^^^^ ... LL | y: Option>>, - | -------------------- recursive without indirection - | -help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `C` representable - | -LL | y: Option>>>, - | ++++ + - -error[E0072]: recursive type `D` has infinite size - --> $DIR/mutual-struct-recursion.rs:18:1 - | + | ---- recursive without indirection +... LL | struct D { - | ^^^^^^^^^^^ recursive type has infinite size -LL | + | ^^^^^^^^^^^ LL | z: Option>>, - | -------------------- 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>>>, +LL | } +LL | +LL | struct D { +LL ~ z: Option>>>, | -LL | z: Option>>>, - | ++++ + -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0072`. -- cgit v1.2.3