Skip to content

Commit a12bb6c

Browse files
committed
Add explanations of cross-version crate compatibility to README
1 parent adbfa38 commit a12bb6c

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ To get started using Rand, see [The Book](https://rust-random.github.io/book).
3838

3939
## Versions
4040

41+
Rand libs have inter-dependencies and make use of the
42+
[semver trick](https://github.com/dtolnay/semver-trick/) in order to make traits
43+
(particularly `RngCore`) compatible across crate versions. This means that a
44+
few crate releases (`rand_core` versions `0.2.2` and `0.3.1`) are compatibility
45+
shims depending on the *next* version of `rand_core`. When multiple crates
46+
depend on `rand_core`, they must *all* depend on the same version of `rand_core`
47+
*or* depend on a compatibility shim, e.g. `rand_core` versions `0.4.x` and
48+
`0.3.1` are compatible, `0.4.0` and `0.3.0` are *not*. Usually, running
49+
`cargo update` is enough to resolve any issues.
50+
4151
The Rand lib is not yet stable, however we are careful to limit breaking changes
4252
and warn via deprecation wherever possible. Patch versions never introduce
4353
breaking changes. The following minor versions are supported:

rand_core/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ The `rand_core` crate provides:
4040

4141
The traits and error types are also available via `rand`.
4242

43+
## Versions
44+
45+
Rand libs have inter-dependencies and make use of the
46+
[semver trick](https://github.com/dtolnay/semver-trick/) in order to make traits
47+
(particularly `RngCore`) compatible across crate versions. This means that a
48+
few crate releases (`rand_core` versions `0.2.2` and `0.3.1`) are compatibility
49+
shims depending on the *next* version of `rand_core`. When multiple crates
50+
depend on `rand_core`, they must *all* depend on the same version of `rand_core`
51+
*or* depend on a compatibility shim, e.g. `rand_core` versions `0.4.x` and
52+
`0.3.1` are compatible, `0.4.0` and `0.3.0` are *not*. Usually, running
53+
`cargo update` is enough to resolve any issues.
54+
4355
## Crate Features
4456

4557
`rand_core` supports `no_std` and `alloc`-only configurations, as well as full

0 commit comments

Comments
 (0)