Restrict #[non_exaustive] on structs with default field values
Do not allow users to apply `#[non_exaustive]` to a struct when they have also used default field values.
This commit is contained in:
@@ -119,6 +119,15 @@ pub(crate) struct NonExhaustiveWrongLocation {
|
||||
pub defn_span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_non_exaustive_with_default_field_values)]
|
||||
pub(crate) struct NonExhaustiveWithDefaultFieldValues {
|
||||
#[primary_span]
|
||||
pub attr_span: Span,
|
||||
#[label]
|
||||
pub defn_span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(passes_should_be_applied_to_trait)]
|
||||
pub(crate) struct AttrShouldBeAppliedToTrait {
|
||||
|
||||
Reference in New Issue
Block a user