Skip to content

Commit

Permalink
Improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Nov 9, 2015
1 parent e6b14aa commit 2a01e26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/libsyntax/feature_gate.rs
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/test/compile-fail/issue-12560-1.rs
Expand Up @@ -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
}

Expand Down

0 comments on commit 2a01e26

Please sign in to comment.