leizhiyuan opened a new pull request, #1468:
URL: https://github.com/apache/rocketmq-clients/pull/1468
### Which Issue(s) This PR Fixes
N/A
### Brief Description
`rust/Cargo.toml` pins several dependencies with exact or upper-bound
requirements to keep the Rust 1.74 MSRV build green:
| dependency | before | after |
|---|---|---|
| tokio | `>=1.20, <1.47` | `1.20` |
| tokio-util | `=0.7.10` | `0.7.10` |
| time | `>=0.3.20, <0.3.37` | `0.3.20` |
| indexmap / hashbrown / hyper-util / powerfmt | upper-bound pins (not used
directly) | removed |
| tempfile (build-dep, unused) | `>=3.0, <3.15` | removed |
Requirements in `[dependencies]` propagate to every downstream project,
while `Cargo.lock` of a library does not. As a result, a project using e.g.
`tokio = "=1.52.3"` + `tokio-util = "=0.7.18"` cannot depend on `rocketmq` at
all (`failed to select a version for tokio-util`).
This PR:
- keeps only lower bounds in `Cargo.toml`, so downstream picks its own
versions;
- enables the MSRV-aware resolver (`[resolver] incompatible-rust-versions =
"fallback"`) in `rust/.cargo/config.toml`, so Cargo 1.84+ prefers versions
compatible with `rust-version = 1.74` when resolving this crate's `Cargo.lock`.
This config only applies when building inside this repo;
- since `Cargo.lock` is not committed and Cargo 1.74 cannot parse
edition-2024 manifests in the index, the MSRV CI jobs now generate `Cargo.lock`
with stable Cargo first and then build/test with 1.74.
### How Did You Test This Change?
- Lockfile generated by stable Cargo with the MSRV-aware resolver, then with
Rust 1.74.0:
- `cargo build --all-targets` ✅
- `rm src/pb/*.rs && BUILD_PROTO=true cargo build` ✅
- `cargo test`: 164 passed, 0 failed ✅
- `cargo fmt --check` and `cargo clippy --all-features -- -D warnings` on
stable ✅
- Downstream check: a crate depending on this branch with `tokio =
"=1.52.3"`, `tokio-util = "=0.7.18"`, `time = "=0.3.47"`, `indexmap =
"=2.14.0"`, `hyper-util = "=0.1.20"` resolves and builds; the dependency tree
uses exactly those versions ✅
- Without the generated lockfile, Cargo 1.74 fails with `this version of
Cargo is older than the 2024 edition` (this is the reason for the CI step).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]