windows下rust安装及vscode下编译调试配置
rust安装
官网下载rustup-init.exe,如果不想使用默认的安装位置,则在安装前在系统变量里分别添加CARGO_HOME和RUSTUP_HOME,并同时将这两个路径添加到PATH里面,再运行安装程序.
安装好之后,使用rustup component list可以查看默认安装好的组件.
为了方便调试,还可使用rustup component add rust-src安装源码.使用cargo安装racer之前,最好在CARGO_HOME下使用config文件来配置代理:
[http]
proxy = "http://127.0.0.1:1081"
[https]
proxy = "https://127.0.0.1:1081"racer安装需要切换到nightly:
rustup install nightly
rustup default nightly然后使用cargo install racer安装racer,安装好之后,再rustup component add rls rust-analysis安装rls.
至此,rust已经可以正常被编译了,你可以使用cargo new 项目名创建项目,然后cargo build编译.