Improve error message

This commit is contained in:
Vadim Petrochenkov 2015-11-09 22:16:30 +03:00
parent e6b14aab05
commit 2a01e263bc
2 changed files with 4 additions and 0 deletions

View File

@ -867,6 +867,8 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
self.context.span_handler.span_err(span, "empty tuple structs and enum variants \
are not allowed, use unit structs and \
enum variants instead");
self.context.span_handler.span_help(span, "remove trailing () to make a unit \
struct or unit enum varian");
}
}
visit::walk_struct_def(self, s)

View File

@ -14,7 +14,9 @@
enum Foo {
Bar(), //~ ERROR empty tuple structs and enum variants are not allowed
//~^ HELP remove trailing () to make a unit struct or unit enum varian
Baz(), //~ ERROR empty tuple structs and enum variants are not allowed
//~^ HELP remove trailing () to make a unit struct or unit enum varian
Bazar
}