1
Fork 0

Fix #[derive] for empty tuple structs/variants

This commit is contained in:
Vadim Petrochenkov 2016-08-15 21:28:17 +03:00
parent 7ac11cad3f
commit 28ed8b1592
5 changed files with 32 additions and 10 deletions

View file

@ -844,7 +844,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
}
fn pat_enum(&self, span: Span, path: ast::Path, subpats: Vec<P<ast::Pat>>) -> P<ast::Pat> {
let pat = if subpats.is_empty() {
PatKind::Path(None, path)
PatKind::Struct(path, Vec::new(), false)
} else {
PatKind::TupleStruct(path, subpats, None)
};