Rollup merge of #72718 - estebank:impl-trait-obligation-failure, r=matthewjasper

Add regression test for #72554

Fix #72554.
This commit is contained in:
Dylan DPC 2020-06-04 12:12:40 +02:00 committed by GitHub
commit 21ac561ab7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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`.