rig icon indicating copy to clipboard operation
rig copied to clipboard

refactor: add `#[non_exhaustive]`

Open joshua-mo-143 opened this issue 5 months ago • 6 comments

  • [x] I have looked for existing issues (including closed) about this

Feature Request

Currently, any change to an enum or struct with pub fields causes a breaking change.

We should add the #[non_exhaustive] macro to all pub items.

Motivation

Less breaking changes

Proposal

Alternatives

joshua-mo-143 avatar Jul 21 '25 15:07 joshua-mo-143

Don't forget serde tagging

hghalebi avatar Sep 04 '25 10:09 hghalebi

assigned

joshua-mo-143 avatar Sep 04 '25 10:09 joshua-mo-143

risk: Note that this can potentially cause breaking changes if a user adds #[deny(dead_code)] to a match statement and the upstream crate removes the #[non_exhaustive] lint. ref

hghalebi avatar Sep 04 '25 11:09 hghalebi

risk: Note that this can potentially cause breaking changes if a user adds #[deny(dead_code)] to a match statement and the upstream crate removes the #[non_exhaustive] lint. ref

Yeah that's fine. We're not going to be removing the lint as #[non_exhaustive] will be a permanent change.

joshua-mo-143 avatar Sep 04 '25 12:09 joshua-mo-143

https://github.com/0xPlaygrounds/rig/pull/779 if you could review this, please, to make sure we have the same understanding, then I will replicate it to the code base

hghalebi avatar Sep 04 '25 17:09 hghalebi