我知道rustup将rustc和cargo二进制文件安装到~/.cargo/bin,但是它将rustup可执行文件安装到哪里?据我所知,任何文档都没有对此进行解释,并且运行安装程序也不会告诉您。如果可能,我希望避免将其安装到主目录以外的任何位置。我正在使用macOS,如果有帮助的话。
当我跑步时rustup doc --book我得到这个:
Access to the file was denied.
The file at file:///home/ken/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/share/doc/rust/html/index.html is not readable. It may have been removed, moved or file permissions may be preventing access.
Run Code Online (Sandbox Code Playgroud)
我已经重新安装,我尝试chmod -R 777在目录上使用。还有什么可以尝试的?文件就在那里。
我正在尝试使用 Rocket 构建一个 Rust 项目,但在编译时我总是遇到此错误,即使在成功覆盖项目的工具链之后也是如此:
D:\GitHub\Learning-Rust\poke_api> rustup override set nightly
info: using existing install for 'nightly-x86_64-pc-windows-msvc'
info: override toolchain for 'D:\GitHub\Learning-Rust\poke_api' set to 'nightly-x86_64-pc-windows-msvc'
nightly-x86_64-pc-windows-msvc unchanged - rustc 1.52.0-nightly (4a8b6f708 2021-03-11)
PS D:\GitHub\Learning-Rust\poke_api> cargo build
Compiling winapi v0.3.9
Compiling serde_derive v1.0.124
Compiling rocket v0.4.7
Compiling pear_codegen v0.1.4
Compiling rocket_codegen v0.4.7
Compiling proc-macro2 v1.0.24
Compiling pq-sys v0.4.6
Compiling aho-corasick v0.6.10
Compiling serde_json v1.0.64
error: …Run Code Online (Sandbox Code Playgroud) 我试图了解 rust nightly 和 beta 版本之间的区别。它们似乎都适合需要使用实验性功能的情况,但我无法真正找到确切的区别。
我使用官方安装脚本安装了 rustup+rust+cargo 。
如何启用 shell 补全,以便能够cargo <TAB>在终端中键入并查看可能的命令,例如cargo check?
在 Rust 中,默认情况下,文件放置在$HOME/.cargo和$HOME/.rustup. 有没有办法覆盖这些默认值?
我正在尝试调试一个模糊的问题,并且我想尝试更改文件位置。
我只是尝试在 Windows 上使用 emscripten 将 Rust 示例项目编译为 WebAssembly,但它会导致错误。我该如何修复它?
我做了什么:
>git clone https://github.com/emscripten-core/emsdk.git
>cd emsdk
>git pull
>emsdk install latest
>emsdk activate latest
>emsdk_env.bat
Run Code Online (Sandbox Code Playgroud)
>rustup target add wasm32-unknown-emscripten
Run Code Online (Sandbox Code Playgroud)
>cargo new --bin web_assembly
>cd web_assembly
Run Code Online (Sandbox Code Playgroud)
>cargo build --target wasm32-unknown-emscripten
Compiling web_assembly v0.1.0 (F:\github\rusttest\web_assembly)
error: linking with `emcc.bat` failed: exit code: 1
|
= note: "cmd" "/c" "emcc.bat" "-s" "DISABLE_EXCEPTION_CATCHING=0" "-L" "C:\\Users\\Username\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\wasm32-unknown-emscripten\\lib" "-L" "C:\\Users\\Username\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\wasm32-unknown-emscripten\\lib\\self-contained" "F:\\github\\rusttest\\web_assembly\\target\\wasm32-unknown-emscripten\\debug\\deps\\web_assembly.web_assembly.egwz9uoo-cgu.0.rcgu.o" "F:\\github\\rusttest\\web_assembly\\target\\wasm32-unknown-emscripten\\debug\\deps\\web_assembly.web_assembly.egwz9uoo-cgu.1.rcgu.o" "F:\\github\\rusttest\\web_assembly\\target\\wasm32-unknown-emscripten\\debug\\deps\\web_assembly.web_assembly.egwz9uoo-cgu.2.rcgu.o" "F:\\github\\rusttest\\web_assembly\\target\\wasm32-unknown-emscripten\\debug\\deps\\web_assembly.web_assembly.egwz9uoo-cgu.3.rcgu.o" …Run Code Online (Sandbox Code Playgroud) 我是 Rust 的新手,目前正在官方网站上阅读 Rust 书籍。
我现在正在研究 Rustup,我认为它非常酷。
我知道我们可以用 Rustup 管理 rustc 和 cargo 的版本,但是如果我以后想升级 Rustup 的版本怎么办?我怎样才能做到这一点?
为什么在安装时cargo build --target wasm32-wasi会抛出错误并提示没有安装。\n重现的步骤wasm32-wasi
接下来是控制台的输出
\n\xe2\x9e\x9c train git:(master) \xe2\x9c\x97 cargo build --target wasm32-wasi\n Compiling train v0.1.0 (/user/playground/rustLang/train)\nerror[E0463]: can't find crate for `std`\n |\n = note: the `wasm32-wasi` target may not be installed\n = help: consider downloading the target with `rustup target add wasm32-wasi`\n\nerror: cannot find macro `println` in this scope\n --> src/main.rs:2:5\n |\n2 | println!("hello");\n | ^^^^^^^\n\nerror: requires `sized` lang_item\n\nFor more information about this …Run Code Online (Sandbox Code Playgroud) 我试着跑
rustup update stable
Run Code Online (Sandbox Code Playgroud)
我得到以下输出。
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2020-05-07, rust version 1.43.1 (8d69840ab 2020-05-04)
error: some components unavailable for download for channel stable: 'rust-std' for target 'i386-apple-ios', 'rust-std' for target 'armv7s-apple-ios', 'rust-std' for target 'armv7-apple-ios'
If you require these components, please install and use the latest successful build version,
which you can find at <https://rust-lang.github.io/rustup-components-history>.
After determining the correct date, install it with a command such as:
rustup toolchain install nightly-2018-12-27
Then you …Run Code Online (Sandbox Code Playgroud) rust ×10
rustup ×10
rust-cargo ×3
bash ×1
emscripten ×1
rust-rocket ×1
rust-wasm ×1
webassembly ×1
windows ×1