diff --git a/src/test/ui/issues/issue-72554.rs b/src/test/ui/issues/issue-72554.rs new file mode 100644 index 00000000000..47aca05d778 --- /dev/null +++ b/src/test/ui/issues/issue-72554.rs @@ -0,0 +1,20 @@ +use std::collections::BTreeSet; + +#[derive(Hash)] +pub enum ElemDerived { //~ ERROR recursive type `ElemDerived` has infinite size + A(ElemDerived) +} + +pub enum Elem { + Derived(ElemDerived) +} + +pub struct Set(BTreeSet); + +impl Set { + pub fn into_iter(self) -> impl Iterator { + self.0.into_iter() + } +} + +fn main() {} diff --git a/src/test/ui/issues/issue-72554.stderr b/src/test/ui/issues/issue-72554.stderr new file mode 100644 index 00000000000..9db65f4a2ee --- /dev/null +++ b/src/test/ui/issues/issue-72554.stderr @@ -0,0 +1,13 @@ +error[E0072]: recursive type `ElemDerived` has infinite size + --> $DIR/issue-72554.rs:4:1 + | +LL | pub enum ElemDerived { + | ^^^^^^^^^^^^^^^^^^^^ recursive type has infinite size +LL | A(ElemDerived) + | ----------- recursive without indirection + | + = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `ElemDerived` representable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0072`.