Skip to content

Commit

Permalink
Add error for existential types
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Apr 30, 2019
1 parent 03122e1 commit da46eea
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/librustc_passes/ast_validation.rs
Expand Up @@ -679,6 +679,12 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
"unions cannot have zero fields");
}
}
ItemKind::Existential(ref bounds, _) => {
if !bounds.iter()
.any(|b| if let GenericBound::Trait(..) = *b { true } else { false }) {
self.err_handler().span_err(item.span, "at least one trait must be specified");
}
}
_ => {}
}

Expand Down

0 comments on commit da46eea

Please sign in to comment.