Skip to content

Commit f407084

Browse files
committed
Record notes on version bumping
1 parent f72399b commit f407084

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

content/rust/versioning.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
+++
2+
title="Versioning Crates"
3+
date=2026-04-29
4+
extra = { series = "Rust" }
5+
taxonomies = { tags = ["Rust"] }
6+
+++
7+
8+
# General tips
9+
10+
- The cargo book has a great [section on semver](https://doc.rust-lang.org/cargo/reference/semver.html) that gives examples different types of changes. Note: breaking changes require a bump of the first non-zero version number. That is what cargo looks for to determine incompatibility.
11+
- If you are releasing a library I highly recommend using [cargo-semver-checks](https://crates.io/crates/cargo-semver-checks) to help detect breaking changes. It's not perfect but it's always improving and is IMO a minimum amount of checking for libraries.
12+
13+
# Opinions on when to bump version numbers
14+
15+
For clarity I'm not talking which part of the version number to bump here which indicates the type of changes included.
16+
I'm only taking about when that bump should happen.
17+
18+
<details>
19+
20+
<summary>Background</summary>
21+
22+
I've been giving this a lot of thought recently as I've noticed different ways that various crates do it.
23+
After much consideration I came up with my opinions below.
24+
I recently wanted to patch a library create that I depended on but they'd already bumped the version number in the git repo so I wasn't able to use patch.
25+
Fortunately, it was a direct dependency so I just changed the source and was able to use my fork until my patch lands.
26+
27+
---
28+
29+
</details>
30+
31+
- For library crates do not bump until you are ready to release. I think this is the best way because if someone needs to make a change to your crate having the version number the same as the released version makes it easy to use [patch section](@/rust/cargo.md#patch-a-crate) of the `Cargo.toml` to replace your create throughout their dependencies. They are at least able to replace it without using patch if it's a direct dependency, but would still be better IMO to use patch to separate out when you're changing something on purpose.
32+
- For binary crates I think the bump should happen right after release by bumping the minor (or patch if still pre 1.0) and appending `-dev`. For example from `0.1.3` to `0.1.4-dev` so that you users who build from the git repo instead have a different version number.

0 commit comments

Comments
 (0)