如何让 Cargo 自动安装版本适合所需 rustc 的依赖项?

问题描述 投票:0回答:1

我需要构建这个https://github.com/yaoxin1995/Trusted_Client/tree/main 每晚使用 Rust 版本 1.65。但是,它不断通知有关依赖项版本以及这些依赖项的依赖项的错误。当尝试单独为每个包指定版本时,这会消耗大量时间。

error: package `clap_builder v4.5.2` cannot be built because it requires rustc 1.74 or newer, while the currently active rustc version is 1.65.0-nightly
Either upgrade to rustc 1.74 or newer, or use
cargo update -p [email protected] --precise ver
where `ver` is the latest version of `clap_builder` supporting rustc 1.65.0-nightly

我必须遵守 rustc 1.65.0-nightly,因为我需要部署仅支持此特定版本的 rust 的 QuarkContainer。 那么如何

cargo build
自动安装版本适合当前rustc的依赖项?

rust build version rust-cargo
1个回答
0
投票

MSRV 感知解析器有一个可接受的 RFC:https://rust-lang.github.io/rfcs/3537-msrv-resolver.html。该 RFC 预计将在 2024 版中稳定下来(因为这是一个重大更改),但今天在不稳定的配置背后仍受支持。此外,

cargo add
已更改为添加最新的 MSRV 兼容版本(今天可用)。

遗憾的是,这与您的情况不兼容,因为它需要最近的货物,但至少有希望:)

当然,只有当您的依赖项设置了

rust-version
时,这才有效。

© www.soinside.com 2019 - 2024. All rights reserved.