升级 rust 到最新版本

更新日期: 2024-03-02 阅读次数: 1939 字数: 440 分类: rust

今天在安装 rust loco-cli 时,发现系统上的 rust 版本太低,无法安装相关依赖:

package clap_derive v4.5.0 cannot be built because it requires rustc 1.74 or newer, while the currently active rustc version is 1.73.0

看了一下版本,确实是 1.73.0 版本。

$ cargo --version
cargo 1.73.0 (9c4383fb5 2023-08-26)

升级命令

rustup update

执行之后,就能看到所有 rust 相关工具,都被升级到最新版本了。

~ $ rustup update
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
724.5 KiB / 724.5 KiB (100 %) 559.7 KiB/s in  2s ETA:  0s
info: latest update on 2024-02-08, rust version 1.76.0 (07dca489a 2024-02-04)
info: downloading component 'cargo'
  8.5 MiB /   8.5 MiB (100 %) 371.2 KiB/s in 25s ETA:  0s
info: downloading component 'clippy'
  2.1 MiB /   2.1 MiB (100 %) 380.7 KiB/s in  6s ETA:  0s
info: downloading component 'rust-docs'
 14.7 MiB /  14.7 MiB (100 %) 681.6 KiB/s in 27s ETA:  0s
info: downloading component 'rust-std'
 23.9 MiB /  23.9 MiB (100 %) 342.4 KiB/s in  1m 28s ETA:  0s
info: downloading component 'rustc'
 62.3 MiB /  62.3 MiB (100 %) 803.2 KiB/s in  1m 58s ETA:  0s
info: downloading component 'rustfmt'
  2.3 MiB /   2.3 MiB (100 %) 631.8 KiB/s in  3s ETA:  0s
info: removing previous version of component 'cargo'
info: removing previous version of component 'clippy'
info: removing previous version of component 'rust-docs'
info: removing previous version of component 'rust-std'
info: removing previous version of component 'rustc'
info: removing previous version of component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 14.7 MiB /  14.7 MiB (100 %)   2.8 MiB/s in  3s ETA:  0s
info: installing component 'rust-std'
 23.9 MiB /  23.9 MiB (100 %)  12.3 MiB/s in  2s ETA:  0s
info: installing component 'rustc'
 62.3 MiB /  62.3 MiB (100 %)  15.1 MiB/s in  4s ETA:  0s
 10 IO-ops /  10 IO-ops (100 %)   0 IOPS in  1s ETA: Unknown
info: installing component 'rustfmt'
info: checking for self-update

  stable-x86_64-unknown-linux-gnu updated - rustc 1.76.0 (07dca489a 2024-02-04) (from rustc 1.73.0 (cc66ad468 2023-10-03))

info: cleaning up downloads & tmp directories

再次确认版本:

$ cargo --version
cargo 1.76.0 (c84b36747 2024-01-18)

从 rust 官网也能看到,目前最新版本就是 1.76.0。

https://www.rust-lang.org/

不得不说 rust 升级版本,比 golang python 方便太多了。

微信关注我哦 👍

大象工具微信公众号

我是来自山东烟台的一名开发者,有感兴趣的话题,或者软件开发需求,欢迎加微信 zhongwei 聊聊, 查看更多联系方式