Skip to content

Commit 2b4bdbe

Browse files
enthropy7rami3l
authored andcommitted
unified nightly disclaimer wording/styling; preserved distinct messages per scenario
1 parent 8031de4 commit 2b4bdbe

File tree

3 files changed

+27
-42
lines changed

3 files changed

+27
-42
lines changed

src/dist/mod.rs

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use tracing::{debug, info, warn};
2121

2222
use crate::{
2323
config::Cfg,
24-
errors::RustupError,
24+
errors::{NIGHTLY_COMPONENT_NOTE, RustupError},
2525
process::Process,
2626
toolchain::{DistributableToolchain, ToolchainName},
2727
utils,
@@ -87,22 +87,15 @@ fn components_missing_msg(cs: &[Component], manifest: &ManifestV2, toolchain: &s
8787
if toolchain.starts_with("nightly") {
8888
let _ = write!(
8989
buf,
90-
"\
91-
Sometimes not all components are available in any given nightly.
92-
If you don't need these components, you could try a minimal installation with:
93-
94-
rustup toolchain add {toolchain} --profile minimal
95-
96-
If you require these components, please install and use the latest successfully built version,
97-
which you can find at <https://rust-lang.github.io/rustup-components-history>.
98-
99-
After determining the correct date, install it with a command such as:
100-
101-
rustup toolchain install nightly-2018-12-27
102-
103-
Then you can use the toolchain with commands such as:
104-
105-
cargo +nightly-2018-12-27 build"
90+
"\n{NIGHTLY_COMPONENT_NOTE}\n\
91+
help: if you don't need these components, you could try a minimal installation with:\n\
92+
help: rustup toolchain add {toolchain} --profile minimal\n\
93+
help: if you require these components, please install and use the latest successfully built version,\n\
94+
help: which you can find at <https://rust-lang.github.io/rustup-components-history>\n\
95+
help: after determining the correct date, install it with a command such as:\n\
96+
help: rustup toolchain install nightly-2018-12-27\n\
97+
help: then you can use the toolchain with commands such as:\n\
98+
help: cargo +nightly-2018-12-27 build"
10699
);
107100
} else if ["beta", "stable"].iter().any(|&p| toolchain.starts_with(p)) {
108101
let _ = write!(

src/errors.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ fn suggest_message(suggestion: &Option<String>) -> String {
181181
}
182182
}
183183

184+
pub(crate) const NIGHTLY_COMPONENT_NOTE: &str =
185+
"note: sometimes not all components are available in any given nightly";
186+
184187
/// Returns a error message indicating that certain [`Component`]s are unavailable.
185188
///
186189
/// See also [`components_missing_msg`](../dist/dist/fn.components_missing_msg.html)
@@ -203,10 +206,7 @@ fn component_unavailable_msg(cs: &[Component], manifest: &Manifest, toolchain: &
203206
);
204207

205208
if toolchain.starts_with("nightly") {
206-
let _ = write!(
207-
buf,
208-
"(sometimes not all components are available in any given nightly)"
209-
);
209+
let _ = write!(buf, "{NIGHTLY_COMPONENT_NOTE}");
210210
}
211211
}
212212
cs => {
@@ -227,16 +227,13 @@ fn component_unavailable_msg(cs: &[Component], manifest: &Manifest, toolchain: &
227227
.join(", ")
228228
};
229229

230-
let _ = write!(
230+
let _ = writeln!(
231231
buf,
232-
"some components are unavailable for download for channel '{toolchain}': {cs_str}"
232+
"some components are unavailable for download for channel '{toolchain}': {cs_str}",
233233
);
234234

235235
if toolchain.starts_with("nightly") {
236-
let _ = write!(
237-
buf,
238-
"(sometimes not all components are available in any given nightly)"
239-
);
236+
let _ = write!(buf, "{NIGHTLY_COMPONENT_NOTE}");
240237
}
241238
}
242239
}

tests/suite/cli_v2.rs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,7 +1972,7 @@ async fn add_missing_component() {
19721972
.with_stderr(snapbox::str![[r#"
19731973
...
19741974
error: component 'rls' for target '[HOST_TRIPLE]' is unavailable for download for channel 'nightly'
1975-
(sometimes not all components are available in any given nightly)
1975+
note: sometimes not all components are available in any given nightly
19761976
...
19771977
"#]])
19781978
.is_err();
@@ -1995,21 +1995,16 @@ async fn add_missing_component_toolchain() {
19951995
.with_stderr(snapbox::str![[r#"
19961996
...
19971997
error: component 'rust-std' for target '[HOST_TRIPLE]' is unavailable for download for channel 'nightly'
1998-
Sometimes not all components are available in any given nightly.
1999-
If you don't need these components, you could try a minimal installation with:
20001998
2001-
rustup toolchain add nightly --profile minimal
2002-
2003-
If you require these components, please install and use the latest successfully built version,
2004-
which you can find at <https://rust-lang.github.io/rustup-components-history>.
2005-
2006-
After determining the correct date, install it with a command such as:
2007-
2008-
rustup toolchain install nightly-2018-12-27
2009-
2010-
Then you can use the toolchain with commands such as:
2011-
2012-
cargo +nightly-2018-12-27 build
1999+
note: sometimes not all components are available in any given nightly
2000+
help: if you don't need these components, you could try a minimal installation with:
2001+
help: rustup toolchain add nightly --profile minimal
2002+
help: if you require these components, please install and use the latest successfully built version,
2003+
help: which you can find at <https://rust-lang.github.io/rustup-components-history>
2004+
help: after determining the correct date, install it with a command such as:
2005+
help: rustup toolchain install nightly-2018-12-27
2006+
help: then you can use the toolchain with commands such as:
2007+
help: cargo +nightly-2018-12-27 build
20132008
...
20142009
"#]])
20152010
.is_err();

0 commit comments

Comments
 (0)