安装
rustup default stable
rustup default stable info: syncing channel updates for 'stable-aarch64-apple-darwin' 1009.5 KiB / 1009.5 KiB (100 %) 35.2 KiB/s in 1m 29s info: latest update on 2025-11-10, rust version 1.91.1 (ed61e7d7e 2025-11-07) info: downloading component 'cargo' info: downloading component 'clippy' info: downloading component 'rust-docs' info: downloading component 'rust-std' info: downloading component 'rustc' 60.9 MiB / 60.9 MiB (100 %) 44.8 KiB/s in 44m 8s info: downloading component 'rustfmt' 1.5 MiB / 1.5 MiB (100 %) 25.6 KiB/s in 2m 18s info: installing component 'cargo' info: installing component 'clippy' info: installing component 'rust-docs' 20.5 MiB / 20.5 MiB (100 %) 5.4 MiB/s in 2s info: installing component 'rust-std' 25.9 MiB / 25.9 MiB (100 %) 23.2 MiB/s in 1s info: installing component 'rustc' 60.9 MiB / 60.9 MiB (100 %) 25.3 MiB/s in 2s info: installing component 'rustfmt' info: default toolchain set to 'stable-aarch64-apple-darwin' stable-aarch64-apple-darwin installed - rustc 1.91.1 (ed61e7d7e 2025-11-07)主要是因为网络原因引发的错误
info:syncing channel updates for 'stable-aarch64-apple-darwin'
1009.5 KiB / 1009.5 KiB (100 %) 27.1 KiB/s in 43s
info:latest update on 2025-11-10, rust version 1.91.1 (ed61e7d7e 2025-11-07)
info:downloading component 'cargo'
info:downloading component 'clippy'
info:downloading component 'rust-docs'
info:downloading component 'rust-std'
info:downloading component 'rustc'
2.4 MiB / 60.9 MiB ( 4 %) 5.0 KiB/s in 3m 45s ETA: 3h 21m 0s
info:retrying download for 'https://static.rust-lang.org/dist/2025-11-10/rustc-1.91.1-aarch64-apple-darwin.tar.xz'
7.6 MiB / 60.9 MiB ( 13 %) 17.0 KiB/s in 13m 26s ETA: 53m 20s
info:retrying download for 'https://static.rust-lang.org/dist/2025-11-10/rustc-1.91.1-aarch64-apple-darwin.tar.xz'
40.3 KiB / 60.9 MiB ( 0 %) 20.1 KiB/s in 48s ETA: 51m 32s
info:retrying download for 'https://static.rust-lang.org/dist/2025-11-10/rustc-1.91.1-aarch64-apple-darwin.tar.xz'
21.7 MiB / 60.9 MiB ( 36 %) 15.8 KiB/s in 17m 59s ETA: 42m 13s
info:retrying download for 'https://static.rust-lang.org/dist/2025-11-10/rustc-1.91.1-aarch64-apple-darwin.tar.xz'
error:component download failed for rustc-aarch64-apple-darwin: could not download file from 'https://static.rust-lang.org/dist/2025-11-10/rustc-1.91.1-aarch64-apple-darwin.tar.xz' to '/Users/tree/.rustup/downloads/327c9017195b4ad0465ab6b1f1036377415cc6dc3612301af6ed9e3414ff53c8.partial': error decoding response body: request or response body error: operation timed out
rustup 的下载和更新速度比较慢。
创建项目后,Run 时会加载 Reloading 项目所需的「库」文件。
第一个项目的默认结构
fn main() { println!("Hello, world!"); }