Rust: Configuring Rust development environment in Vscode _rust

Source: Internet
Author: User
Tags python script emscripten

There are two articles worth looking at,

https://zhuanlan.zhihu.com/p/29975631

Https://zhuanlan.zhihu.com/p/26944087?open_source=weibo_search

Another turn:

I recommend the Vscode development environment and contribute to the following processes for reference:

Pre-installation required on Windows platform: Microsoft Visual C + + Build Tools 2015

Compiler and tool chain installation: Downloading Setup

Select the second item (not default) for the installation prompt-start the interactive installation process:

I ' m going to ask you for the value of each of these installation options. You may simply press the Enter key to leave unchanged.
Default host triple?
X86_64-pc-windows-gnu (Explanation: This is necessary in order to be able to use GDB for debug breakpoints.) Please do not use the X86_64-pc-windows-msvc branch. It is the best platform, but GDB is not compatible with it. )
Default toolchain? (stable/beta/nightly)
Stable (I tried the nightly version, there are many pits, can not use the nightly version, it is best to bypass the first.) )
Modify PATH variable? (y/n)
Y
The tool chain includes: 1. RUSTC 2. Cargo 3. Rustup

Add Rust Home Directory%userprofile%.cargo\bin to the operating system's PATH environment variable

Verify installation success: Rustc–version

Rust IDE

Vscode currently supports rust development Extensions rust code and native Debug

Install RLS Reference:
Rustup Self Update

Rustup Update nightly

Rustup Component Add Rls–toolchain nightly

Rustup Component Add Rust-analysis–toolchain nightly

Rustup Component Add Rust-src–toolchain nightly

Rustup component Add Rust-src–toolchain stable

Adding environment variables

Set RUST_SRC_PATH=%USERPROFILE%.RUSTUP\TOOLCHAINS\STABLE-X86_64-PC-WINDOWS-GNU\LIB\RUSTLIB\SRC\RUST\SRC

Install using Cargo Package Manager

Cargo Install Racer

Cargo Install Rustfmt

Cargo Install Rustsym

WASM Compilation: Installing

Rustup Target Add Wasm32-unknown-emscripten stable

Compile

Cargo Build–target=wasm32-unknown-emscripten

or full command

Rustup Run Stable-x86_64-pc-windows-gnu Cargo build–target=wasm32-unknown-emscripten

Debug Environment Configuration reference:

A. Installation of gdb64
Append the following Python script to the D:\Program files\gdb-7.9.1-tdm64-2\gdb64\bin\gdbinit file.
Python

Print "--Loading rust pretty-printers--"

From Os.path import Expanduser

Sys.path.insert (0, Expanduser ("~") + "/.rustup/toolchains/stable-x86_64-pc-windows-gnu/lib/rustlib/etc")

Import gdb_rust_pretty_printing

Gdb_rust_pretty_printing.register_printers (GDB)

End

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.