Skip to content

Commit 21ac561

Browse files
authored
Rollup merge of #72718 - estebank:impl-trait-obligation-failure, r=matthewjasper
Add regression test for #72554 Fix #72554.
2 parents 6279571 + eb8d900 commit 21ac561

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

src/test/ui/issues/issue-72554.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
use std::collections::BTreeSet;
2+
3+
#[derive(Hash)]
4+
pub enum ElemDerived { //~ ERROR recursive type `ElemDerived` has infinite size
5+
A(ElemDerived)
6+
}
7+
8+
pub enum Elem {
9+
Derived(ElemDerived)
10+
}
11+
12+
pub struct Set(BTreeSet<Elem>);
13+
14+
impl Set {
15+
pub fn into_iter(self) -> impl Iterator<Item = Elem> {
16+
self.0.into_iter()
17+
}
18+
}
19+
20+
fn main() {}

src/test/ui/issues/issue-72554.stderr

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0072]: recursive type `ElemDerived` has infinite size
2+
--> $DIR/issue-72554.rs:4:1
3+
|
4+
LL | pub enum ElemDerived {
5+
| ^^^^^^^^^^^^^^^^^^^^ recursive type has infinite size
6+
LL | A(ElemDerived)
7+
| ----------- recursive without indirection
8+
|
9+
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `ElemDerived` representable
10+
11+
error: aborting due to previous error
12+
13+
For more information about this error, try `rustc --explain E0072`.

0 commit comments

Comments
 (0)