Skip to content

Commit 9413cb6

Browse files
committed
docs: update docs and add comment
1 parent 0674f36 commit 9413cb6

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

doc/src/basics.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,14 @@ This is the essence of `rustup`.
4040

4141
## Keeping rustup up to date
4242

43-
Running `rustup update` also checks for updates to `rustup` and automatically
44-
installs the latest version. To manually check for updates and install the
43+
We control the automatic update of rustup by setting the auto-self-update configuration.
44+
The auto-self-update setting supports three values: `enable` and `disable` and `check-only`.
45+
46+
When it is `enable`, running `rustup update` will also check for updates to `rustup` and automatically install the latest version.
47+
If it is `disable`, the available updates is not checked and installed.
48+
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.
49+
50+
To manually force check for updates and install the
4551
latest version of `rustup` without updating installed toolchains type `rustup
4652
self update`:
4753

@@ -51,7 +57,7 @@ info: checking for self-updates
5157
info: downloading self-updates
5258
```
5359

54-
**Note**: `rustup` will automatically update itself at the end of any
60+
**Note**: If auto-self-update is `enable`, `rustup` will automatically update itself at the end of any
5561
toolchain installation as well. You can prevent this automatic behaviour by
5662
passing the `--no-self-update` argument when running `rustup update` or
5763
`rustup toolchain install`.

src/cli/rustup_mode.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -932,9 +932,12 @@ fn check_updates(cfg: &Cfg) -> Result<utils::ExitCode> {
932932

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

0 commit comments

Comments
 (0)