-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Summary
New variants were added to the DType enum (I16, I32, F8E4M3, F6E2M3, F6E3M2, F4, F8E8M0) in the 0.9.2 patch release. This is a semver-breaking change that was released without a major version bump.
In Rust, adding variants to a public enum is a breaking change because it breaks exhaustive match statements in downstream code. According to SemVer, breaking changes require a major version increment. Patch releases (0.9.1 → 0.9.2) should only contain backwards-compatible bug fixes.
Example breakage
burn-import v0.20.1 fails to compile with candle-core v0.9.2:
error[E0004]: non-exhaustive patterns: `candle_core::DType::I16`, `candle_core::DType::I32`,
`candle_core::DType::F8E4M3` and 4 more not covered
--> burn-import-0.20.1/src/common/candle.rs:62:15
Suggested fix
To allow adding variants in future minor/patch releases without breaking downstream crates, add #[non_exhaustive] to the DType enum:
#[non_exhaustive]
pub enum DType {
// ...
}This forces downstream crates to include a wildcard arm (_ => ...), making future variant additions non-breaking.