Skip to content

Commit

Permalink
docs: update docs and add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustin170506 committed May 12, 2021
1 parent 0674f36 commit 9413cb6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
12 changes: 9 additions & 3 deletions doc/src/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,14 @@ This is the essence of `rustup`.

## Keeping rustup up to date

Running `rustup update` also checks for updates to `rustup` and automatically
installs the latest version. To manually check for updates and install the
We control the automatic update of rustup by setting the auto-self-update configuration.
The auto-self-update setting supports three values: `enable` and `disable` and `check-only`.

When it is `enable`, running `rustup update` will also check for updates to `rustup` and automatically install the latest version.
If it is `disable`, the available updates is not checked and installed.
In addition, you can set auto-self-update to `check-only` if you want to check rustup for available updates during `rustup update` as well.

To manually force check for updates and install the
latest version of `rustup` without updating installed toolchains type `rustup
self update`:

Expand All @@ -51,7 +57,7 @@ info: checking for self-updates
info: downloading self-updates
```

**Note**: `rustup` will automatically update itself at the end of any
**Note**: If auto-self-update is `enable`, `rustup` will automatically update itself at the end of any
toolchain installation as well. You can prevent this automatic behaviour by
passing the `--no-self-update` argument when running `rustup update` or
`rustup toolchain install`.
9 changes: 6 additions & 3 deletions src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -932,9 +932,12 @@ fn check_updates(cfg: &Cfg) -> Result<utils::ExitCode> {

fn update(cfg: &mut Cfg, m: &ArgMatches<'_>) -> Result<utils::ExitCode> {
let self_update_mode = cfg.get_self_update_mode()?;
let self_update = !m.is_present("no-self-update")
&& !self_update::NEVER_SELF_UPDATE
&& self_update_mode == "enable";
// Update only if rustup does **not** have the no-self-update feature,
// and auto-self-update is configured to **enable**
// and has **no** no-self-update parameter.
let self_update = !self_update::NEVER_SELF_UPDATE
&& self_update_mode == "enable"
&& !m.is_present("no-self-update");
let forced = m.is_present("force-non-host");
if let Some(p) = m.value_of("profile") {
let p = Profile::from_str(p)?;
Expand Down

0 comments on commit 9413cb6

Please sign in to comment.