Fix subdiagnostic-only enum variants not generating code
This commit is contained in:
parent
eee14e9adf
commit
36902fbcf6
1 changed files with 2 additions and 2 deletions
|
@ -510,11 +510,11 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> {
|
||||||
.map(|binding| self.generate_field_attr_code(binding, kind_stats))
|
.map(|binding| self.generate_field_attr_code(binding, kind_stats))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
if kind_slugs.is_empty() {
|
if kind_slugs.is_empty() && !self.has_subdiagnostic {
|
||||||
if self.is_enum {
|
if self.is_enum {
|
||||||
// It's okay for a variant to not be a subdiagnostic at all..
|
// It's okay for a variant to not be a subdiagnostic at all..
|
||||||
return Ok(quote! {});
|
return Ok(quote! {});
|
||||||
} else if !self.has_subdiagnostic {
|
} else {
|
||||||
// ..but structs should always be _something_.
|
// ..but structs should always be _something_.
|
||||||
throw_span_err!(
|
throw_span_err!(
|
||||||
self.variant.ast().ident.span().unwrap(),
|
self.variant.ast().ident.span().unwrap(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue