Split examples & check minimum versions #3370
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Partly #2942, partly trying to make the minimum dependencies checks better (which is similar to the first point in that discussion.
Currently, both
cargo deny
and our MSRV checks use Cargo.lock file which has unified features and versions across both the axum crates and all the examples. This can hide some issues as usually when someone adds an example, they might usecargo add
which will silently update the dependency for the whole repository. Some compilation errors (likeaxum
requiringbytes@1.0
while it uses features frombytes@1.7
) will then be hidden.I don't think most users would ever need to use the minimal versions anyway so this is not as severe, but someone might run into compilation errors.
Solution
Split the examples out of the top-level workspace. I think this improves the situation and if we want to really move the examples to their own repository at any time, this would be the first step anyway.
In the discussion there was a consideration that this makes it harder to test changes locally because CI might error on the examples which will not be built locally with
cargo test
, but due todefault-members
in the workspace this has always been the case (unless you use--workspace
).The changes that are here regarding versions:
crc32fast
is a transitive dependency which doesn't build with the lowest possible version. This was patched in CI manually, I just moved the patch intoCargo.toml
.lazy_static
has the same issue but the minimum version seemed to be higher because of examples.serde
- we use features that were added after1.0.0
. I didn't look for the lowest possible version and just used whatever was the lowest version we used until now (the lowest version including tests). This could be lowered but I don't think there's a point.bytes
- we useimpl From<Bytes> for BytesMut
insse.rs
which was added in 1.7.tracing-subscriber
- last release accidentally did not updatetracing-core
to the correct and this optional feature forces the correct versions to be selected.