- Windows 10
- rustup 1.23.1 (3df2264a9 2020-11-30)
- 默认的rustc版本为1.50.0 (cb75ad5db 2021-02-10)
- 项目所用的rustc版本为1.52.0-nightly (4a8b6f708 2021-03-11)
- rocket = "0.4.4"
我正在尝试使用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: failed to run custom build command for `pear_codegen v0.1.4`
Caused by:
process didn't exit successfully: `D:\GitHub\Learning-Rust\poke_api\target\debug\build\pear_codegen-e182711746033ac9\build-script-build` (exit code: 101)
--- stderr
Error: Pear requires a 'dev' or 'nightly' version of rustc.
Installed version: 1.48.0 (2020-11-16)
Minimum required: 1.31.0-nightly (2018-10-05)
thread 'main' panicked at 'Aborting compilation due to incompatible compiler.', C:\Users\gabre\.cargo\registry\src\github.com-1ecc6299db9ec823\pear_codegen-0.1.4\build.rs:24:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
cargo +nightly build
,它是否有效? - transistorRUSTUP_TOOLCHAIN
环境变量设置为"stable"
或其他非每夜版工具链,否则无法复现。该变量和直接在命令中使用(如 @transistor 所提到的)是唯一优先级高于目录覆盖的方法,请参见此处。 - kmdrekocargo +nightly build
时,它给我发送了一个错误:error: no such subcommand: +nightly
@transistor - Gabriel Gutierrez