Add test for #72554.

This commit is contained in:
Esteban Küber 2020-05-28 18:20:37 -07:00
parent d3cba254e4
commit eb8d9002fa
2 changed files with 33 additions and 0 deletions

View File

@ -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<Elem>);
impl Set {
pub fn into_iter(self) -> impl Iterator<Item = Elem> {
self.0.into_iter()
}
}
fn main() {}

View File

@ -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`.