Skip to content

Commit b5d74ac

Browse files
rami3ldjc
authored andcommitted
Move TOOLSTATE_MSG to dist to serve toolchain-wide operations
1 parent 310570b commit b5d74ac

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

src/dist/dist.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ static TOOLCHAIN_CHANNELS: &[&str] = &[
4343
r"\d{1}\.\d{1,3}(?:\.\d{1,2})?",
4444
];
4545

46+
const TOOLSTATE_MSG: &str =
47+
"If you require these components, please install and use the latest successful build version,\n\
48+
which you can find at <https://rust-lang.github.io/rustup-components-history>.\n\nAfter determining \
49+
the correct date, install it with a command such as:\n\n \
50+
rustup toolchain install nightly-2018-12-27\n\n\
51+
Then you can use the toolchain with commands such as:\n\n \
52+
cargo +nightly-2018-12-27 build";
53+
4654
/// Returns a error message indicating that certain [`Component`]s are missing in a toolchain distribution.
4755
///
4856
/// This message is currently used exclusively in toolchain-wide operations,
@@ -71,7 +79,7 @@ fn components_missing_msg(cs: &[Component], manifest: &ManifestV2, toolchain: &s
7179

7280
let _ = write!(
7381
buf,
74-
"If you don't need the component, you could try a minimal installation with:\n\n{suggestion}"
82+
"If you don't need the component, you could try a minimal installation with:\n\n{suggestion}\n\n{TOOLSTATE_MSG}"
7583
);
7684
}
7785
cs => {
@@ -91,7 +99,7 @@ fn components_missing_msg(cs: &[Component], manifest: &ManifestV2, toolchain: &s
9199

92100
let _ = write!(
93101
buf,
94-
"If you don't need the components, you could try a minimal installation with:\n\n{suggestion}"
102+
"If you don't need the components, you could try a minimal installation with:\n\n{suggestion}\n\n{TOOLSTATE_MSG}"
95103
);
96104
}
97105
}

src/errors.rs

-8
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ use crate::{
1919
toolchain::names::{PathBasedToolchainName, ToolchainName},
2020
};
2121

22-
const TOOLSTATE_MSG: &str =
23-
"If you require these components, please install and use the latest successful build version,\n\
24-
which you can find at <https://rust-lang.github.io/rustup-components-history>.\n\nAfter determining \
25-
the correct date, install it with a command such as:\n\n \
26-
rustup toolchain install nightly-2018-12-27\n\n\
27-
Then you can use the toolchain with commands such as:\n\n \
28-
cargo +nightly-2018-12-27 build";
29-
3022
/// A type erasing thunk for the retry crate to permit use with anyhow. See <https://github.com/dtolnay/anyhow/issues/149>
3123
#[derive(Debug, ThisError)]
3224
#[error(transparent)]

tests/suite/cli_v2.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,18 @@ fn add_missing_component_toolchain() {
10651065
r"component 'rust-std' for target '{0}' is unavailable for download for channel 'nightly'
10661066
Sometimes not all components are available in any given nightly. If you don't need the component, you could try a minimal installation with:
10671067
1068-
rustup toolchain add nightly --profile minimal"
1068+
rustup toolchain add nightly --profile minimal
1069+
1070+
If you require these components, please install and use the latest successful build version,
1071+
which you can find at <https://rust-lang.github.io/rustup-components-history>.
1072+
1073+
After determining the correct date, install it with a command such as:
1074+
1075+
rustup toolchain install nightly-2018-12-27
1076+
1077+
Then you can use the toolchain with commands such as:
1078+
1079+
cargo +nightly-2018-12-27 build"
10691080
),
10701081
);
10711082
});

0 commit comments

Comments
 (0)