|
| 1 | +# SemVer classification rules |
| 2 | + |
| 3 | +How to classify a change to the crates published from this repository, based on |
| 4 | +the [Cargo SemVer Compatibility reference](https://doc.rust-lang.org/cargo/reference/semver.html). |
| 5 | + |
| 6 | +A change is classified by the highest category any part of it falls into. If any |
| 7 | +single change is major, the whole change is major. |
| 8 | + |
| 9 | +## Major (vX._._) — breaking change to the public API |
| 10 | + |
| 11 | +- [Removing, renaming, or moving public items](https://doc.rust-lang.org/cargo/reference/semver.html#item-remove). |
| 12 | +- [Changing a trait's item signatures](https://doc.rust-lang.org/cargo/reference/semver.html#trait-item-signature), or [adding a non-defaulted trait item](https://doc.rust-lang.org/cargo/reference/semver.html#trait-new-item-no-default). |
| 13 | +- [Adding a field, public or private, to a struct whose fields are all public](https://doc.rust-lang.org/cargo/reference/semver.html#struct-add-public-field-when-no-private) and that isn't `non_exhaustive`. Once the struct has one private field, [adding more is minor](https://doc.rust-lang.org/cargo/reference/semver.html#struct-private-fields-with-private). |
| 14 | +- [Adding an enum variant](https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new) to an enum that isn't `non_exhaustive`. |
| 15 | +- [Adding `non_exhaustive`](https://doc.rust-lang.org/cargo/reference/semver.html#attr-adding-non-exhaustive). |
| 16 | +- [Tightening generic bounds](https://doc.rust-lang.org/cargo/reference/semver.html#generic-bounds-tighten). |
| 17 | +- [Changing function arity](https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity). |
| 18 | +- [Changing the alignment, layout, or size of a type that was previously well-defined](https://doc.rust-lang.org/cargo/reference/semver.html#type-layout): removing `repr(C)`, `repr(transparent)`, or an enum's `repr(<int>)`, or adding or changing `repr(packed)` or `repr(align)`. A type with the default representation guarantees no layout, so its size changing is not on its own major. |
| 19 | +- [Requiring `std` where `no_std` worked](https://doc.rust-lang.org/cargo/reference/semver.html#attr-no-std-to-std). |
| 20 | +- [Removing a Cargo feature](https://doc.rust-lang.org/cargo/reference/semver.html#cargo-feature-remove). |
| 21 | + |
| 22 | +## Minor (v_.Y._) — additive change to the public API |
| 23 | + |
| 24 | +- [Adding new public items](https://doc.rust-lang.org/cargo/reference/semver.html#item-new). |
| 25 | +- [Adding defaulted type parameters](https://doc.rust-lang.org/cargo/reference/semver.html#generic-new-default) or [defaulted trait parameters](https://doc.rust-lang.org/cargo/reference/semver.html#trait-new-parameter-default). |
| 26 | +- [Loosening generic bounds](https://doc.rust-lang.org/cargo/reference/semver.html#generic-bounds-loosen) or [generalizing to more generic types](https://doc.rust-lang.org/cargo/reference/semver.html#generic-more-generic). |
| 27 | +- [Making an `unsafe` function safe](https://doc.rust-lang.org/cargo/reference/semver.html#fn-unsafe-safe). |
| 28 | +- [Adding private struct fields when one already exists](https://doc.rust-lang.org/cargo/reference/semver.html#struct-private-fields-with-private). |
| 29 | +- [Adding a Cargo feature](https://doc.rust-lang.org/cargo/reference/semver.html#cargo-feature-add) or [dependency](https://doc.rust-lang.org/cargo/reference/semver.html#cargo-dep-add). |
| 30 | +- The [possibly-breaking changes](https://doc.rust-lang.org/cargo/reference/semver.html#possibly-breaking-changes), such as [raising the minimum supported Rust version](https://doc.rust-lang.org/cargo/reference/semver.html#env-new-rust), [adding a defaulted trait item](https://doc.rust-lang.org/cargo/reference/semver.html#trait-new-default-item), or [adding inherent items](https://doc.rust-lang.org/cargo/reference/semver.html#impl-item-new). |
| 31 | + |
| 32 | +## Patch (v_._.Z) — no change to the public API |
| 33 | + |
| 34 | +- Bug fixes that preserve documented behavior. |
| 35 | +- Performance improvements. |
| 36 | +- Internal refactors and private item changes. |
| 37 | +- Documentation, example, test, or CI changes. |
| 38 | +- Dependency patch bumps. |
| 39 | + |
| 40 | +## Applying the rules to this repository |
| 41 | + |
| 42 | +The crates in the top level directories are published and are the ones being |
| 43 | +classified. The crates under `tests/` are test vectors and are not published. |
| 44 | + |
| 45 | +The public API of the SDK includes the code that the macros in |
| 46 | +`soroban-sdk-macros` generate. A change to what `#[contract]`, |
| 47 | +`#[contractimpl]`, `#[contracttype]`, or the other macros emit can break |
| 48 | +contracts that build against the SDK, or change the contract spec and events a |
| 49 | +built contract exposes, even when no Rust item in the SDK itself changes. |
| 50 | +`tests-expanded/` holds the generated code for the test vectors, so a diff there |
| 51 | +is evidence that the generated API changed, and it is classified by what the |
| 52 | +change does to a contract that uses it. |
| 53 | + |
| 54 | +Changes confined to `tests/`, `.github/`, the `Makefile`, or the repository's |
| 55 | +documentation are patch. |
0 commit comments