如何修复“此版本的 Cargo 早于`2021`版本”错误?

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

我在 Chromebook Lenovo Duet 5 上使用 Cargo。当我尝试编写更复杂的代码时,我遇到了此错误。我试图导入映像包并收到此错误:

this version of Cargo is older than the `2021` edition, and only supports `2015` and `2018` editions.

我怀疑该镜像包可能只是为 x86_64 构建的,而我恰好正在 ARM 上学习 Rust。我尝试使用我拥有的二进制货物从源代码构建货物,但这也有相同的错误。

rust rust-cargo
2个回答
3
投票

您的问题不是平台差异;而是问题。你只是有一个旧版本。 2021 年语言版本是在 2021 年 10 月随 Rust 发行版本 1.56.0 添加的。您需要安装至少是新版本的 Rust 版本。

安装和维护 Rust 工具链的推荐方法是使用 Rustup。我个人可以确认它可以在 ARM Chromebook Linux 上运行。


0
投票

我最终使用了 rustup 安装程序。这是无人值守安装:

export RUSTUP_HOME=/opt/rust/rustup 
export CARGO_HOME=/opt/rust/cargo
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable --profile default --no-modify-path -y
export PATH="/opt/rust/cargo/bin:$PATH"

这 2 个 HOME 目录是安装位置。

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