rustup use

rustup tool that can help us install a different version of the programming needs of even the rust, and can facilitate the conduct of different versions
to switch between similar nodejs of nvm, n, Ruby of rvmthe python venv. . .

rustup basic use

We first use installation script, or after completing the installation package will be shipped rustup rust, and for the need to use different versions of
the process is as follows:

  • Select a version, rust provides different channnel (nightly, stabel, beta. Date format ..)
  • Use rustup installthe specified version, orrustup toolchain install
  • Specifies the rustup default versionversion of the switch
  • Use rustup toolchain listor rustup showcheck the switching configuration

rustup Help

  • toolchain
rustup-toolchain 
Modify or query the installed toolchains
USAGE:
    rustup toolchain <SUBCOMMAND>
FLAGS:
    -h, --help Prints help information
SUBCOMMANDS:
    list List installed toolchains
    install Install or update a given toolchain
    uninstall Uninstall a toolchain
    link Create a custom toolchain by symlinking to a directory
    help Prints this message or the help of the given subcommand(s)
DISCUSSION:
    Many `rustup` commands deal with *toolchains*, a single
    installation of the Rust compiler. `rustup` supports multiple
    types of toolchains. The most basic track the official release
    channels: 'stable', 'beta' and 'nightly'; but `rustup` can also
    install toolchains from the official archives, for alternate host
    platforms, and from local builds.
    Standard release channel toolchain names have the following form:
        <channel>[-<date>][-<host>]
        <channel> = stable|beta|nightly|<version>
        <date> = YYYY-MM-DD
        <host> = <target-triple>
    'channel' is either a named release channel or an explicit version
    number, such as '1.8.0'. Channel names can be optionally appended
    with an archive date, as in 'nightly-2017-05-09', in which case
    the toolchain is downloaded from the archive for that date.
    Finally, the host may be specified as a target triple. This is
    most useful for installing a 32-bit compiler on a 64-bit platform,
    or for installing the [MSVC-based toolchain] on Windows. For
    example:
        $ rustup toolchain install stable-x86_64-pc-windows-msvc
    For convenience, elements of the target triple that are omitted
    will be inferred, so the above could be written:
        $ rustup default stable-msvc
    rustup can also manage symlinked local toolchain builds, which are
    often used to for developing Rust itself. For more information see
    `rustup toolchain help link`.

A simple example of installation

For example, we need to install one nightly-2019-01-17, follow the format of the top convention

  • Installation is as follows:
rustup toolchain install nightly-2019-01-17

The message is below:

As can be seen the information is very detailed (We also know the version)

rustup toolchain install nightly-2019-01-17
info: syncing channel updates for 'nightly-2019-01-17-x86_64-apple-darwin'
316.6 KiB / 316.6 KiB (100 %) 223.0 KiB/s in 1s ETA: 0s
info: latest update on 2019-01-17, rust version 1.33.0-nightly (ceb251214 2019-01-16)
info: downloading component 'rustc'
 78.6 MiB / 78.6 MiB ( 100 %) 537.6 KIB / s at 3 m 6 s ETA: 0 s
info: downloading component 'rust-std'
 48.0 MiB / 51.3 MiB ( 94 %) 44.8 KiB/s in 3m 14s ETA: 1m 15s
 48.0 MiB / 51.3 MiB ( 94 %) 48.0 KiB/s in 3m 16s ETA: 1m 8s
 51.3 MiB / 51.3 MiB (100 %) 282.4 KiB/s in 3m 36s ETA: 0s 
info: downloading component 'cargo'
  3.4 MIB / 3.4 MiB ( 100 %) 388.1 KIB / s at 9 the ETA: 0 s
info: downloading component 'rust-docs'
  8.5 MiB / 8.5 MiB (100 %) 606.9 KiB/s in 18s ETA: 0s
info: installing component 'rustc'
 78.6 MiB / 78.6 MiB (100 %) 8.9 MiB/s in 7s ETA: 0s
info: installing component 'rust-std'
 51.3 MiB / 51.3 MiB ( 100 %) 12.1 MiB / s in 4 s ETA: 0 s
info: installing component 'cargo'
info: installing component 'rust-docs'
  8.5 MiB / 8.5 MiB (100 %) 1.3 MiB/s in 6s ETA: 0s
  nightly-2019-01-17-x86_64-apple-darwin installed - rustc 1.33.0-nightly (ceb251214 2019-01-16)
info: checking for self-updates
 
  • To start a new default
rustup default nightly-2019-01-17
  • View toolchain
rustup toolchain list                       

effect:

stable-x86_64-apple-darwin
nightly-2019-01-17-x86_64-apple-darwin (default)
nightly-x86_64-apple-darwin
 
  • Configuring default

    We can use the <channel>[-<date>][-<host>]format, you can use toolchain list to see version

rustup default nightly-2019-01-17

effect

info: using existing install for 'nightly-2019-01-17-x86_64-apple-darwin'
info: default toolchain set to 'nightly-2019-01-17-x86_64-apple-darwin'
  nightly-2019-01-17-x86_64-apple-darwin unchanged - rustc 1.33.0-nightly (ceb251214 2019-01-16)
  • Check the default
rustup show

effect:

Default host: x86_64-apple-darwin
installed toolchains
--------------------
stable-x86_64-apple-darwin
nightly-2019-01-17-x86_64-apple-darwin (default)
nightly-x86_64-apple-darwin
active toolchain
----------------
nightly-2019-01-17-x86_64-apple-darwin (default)
rustc 1.33.0-nightly (ceb251214 2019-01-16)
 
 

or:

rustup toolchain list

effect:

stable-x86_64-apple-darwin
nightly-2019-01-17-x86_64-apple-darwin (default)
nightly-x86_64-apple-darwin

Explanation

Because of changes in rust language, the compiler may often encounter problems (dependent on someone else's bag), by version management rustup, basically we can solve the
practical problems encountered, as well as for the problem of different versions of the package, the issue can be combined with github View (time will find a lot of)

Reference material

https://forge.rust-lang.org/channel-layout.html
https://forge.rust-lang.org/
https://forge.rust-lang.org/releases.html
https://rust-lang.github.io/rustup-components-history/index.html

Guess you like

Origin www.cnblogs.com/rongfengliang/p/11030135.html
use
use