diff options
| author | Yuki OKUSHI <huyuumi.dev@gmail.com> | 2019-04-30 20:43:03 +0900 |
|---|---|---|
| committer | Yuki OKUSHI <huyuumi.dev@gmail.com> | 2019-04-30 20:43:03 +0900 |
| commit | da46eeac88ea24c8c7b5d78c5ac4e0fe681ef13e (patch) | |
| tree | 26c9faf8a7d158d7149d5702dfaf61a9ad18d977 | |
| parent | 03122e1bac482b150844ef9664b1ad2438b43072 (diff) | |
| download | rust-da46eeac88ea24c8c7b5d78c5ac4e0fe681ef13e.tar.gz rust-da46eeac88ea24c8c7b5d78c5ac4e0fe681ef13e.zip | |
Add error for existential types
| -rw-r--r-- | src/librustc_passes/ast_validation.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs index 9dd8a7050fd..a482f60897b 100644 --- a/src/librustc_passes/ast_validation.rs +++ b/src/librustc_passes/ast_validation.rs @@ -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"); + } + } _ => {} } |
