Merge pull request #4118 from miguelff/master

Fix abort message when deriving non-unit enum variants
This commit is contained in:
Ed Page 2022-08-26 07:26:39 -05:00 committed by GitHub
commit b1e3dad190
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -84,7 +84,7 @@ fn lits(
None
} else {
if !matches!(variant.fields, Fields::Unit) {
abort!(variant.span(), "`#[derive(ValueEnum)]` only supports non-unit variants, unless they are skipped");
abort!(variant.span(), "`#[derive(ValueEnum)]` only supports unit variants. Non-unit variants must be skipped");
}
let fields = attrs.field_methods(false);
let name = attrs.cased_name();

View file

@ -1,4 +1,4 @@
error: `#[derive(ValueEnum)]` only supports non-unit variants, unless they are skipped
error: `#[derive(ValueEnum)]` only supports unit variants. Non-unit variants must be skipped
--> tests/derive_ui/value_enum_non_unit.rs:5:5
|
5 | Foo(usize),