Skip to content

Commit 2a01e26

Browse files
committed
Improve error message
1 parent e6b14aa commit 2a01e26

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/libsyntax/feature_gate.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,8 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
867867
self.context.span_handler.span_err(span, "empty tuple structs and enum variants \
868868
are not allowed, use unit structs and \
869869
enum variants instead");
870+
self.context.span_handler.span_help(span, "remove trailing () to make a unit \
871+
struct or unit enum varian");
870872
}
871873
}
872874
visit::walk_struct_def(self, s)

src/test/compile-fail/issue-12560-1.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414

1515
enum Foo {
1616
Bar(), //~ ERROR empty tuple structs and enum variants are not allowed
17+
//~^ HELP remove trailing () to make a unit struct or unit enum varian
1718
Baz(), //~ ERROR empty tuple structs and enum variants are not allowed
19+
//~^ HELP remove trailing () to make a unit struct or unit enum varian
1820
Bazar
1921
}
2022

0 commit comments

Comments
 (0)