Skip to content

Commit 1911fa5

Browse files
committed
unified nightly disclaimer wording/styling; preserved distinct messages per scenario
1 parent 8031de4 commit 1911fa5

File tree

10 files changed

+28
-42
lines changed

10 files changed

+28
-42
lines changed

.DS_Store

8 KB
Binary file not shown.

.github/.DS_Store

6 KB
Binary file not shown.

ci/.DS_Store

6 KB
Binary file not shown.

doc/.DS_Store

6 KB
Binary file not shown.

src.zip

240 KB
Binary file not shown.

src/.DS_Store

8 KB
Binary file not shown.

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\n"
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, "\n{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, "\n{NIGHTLY_COMPONENT_NOTE}");
240237
}
241238
}
242239
}

tests.zip

114 KB
Binary file not shown.

tests/suite/cli_v2.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,7 +1972,8 @@ 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+
1976+
note: sometimes not all components are available in any given nightly
19761977
...
19771978
"#]])
19781979
.is_err();
@@ -1995,21 +1996,16 @@ async fn add_missing_component_toolchain() {
19951996
.with_stderr(snapbox::str![[r#"
19961997
...
19971998
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:
2000-
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:
20111999
2012-
cargo +nightly-2018-12-27 build
2000+
note: sometimes not all components are available in any given nightly
2001+
help: if you don't need these components, you could try a minimal installation with:
2002+
help: rustup toolchain add nightly --profile minimal
2003+
help: if you require these components, please install and use the latest successfully built version,
2004+
help: which you can find at <https://rust-lang.github.io/rustup-components-history>
2005+
help: after determining the correct date, install it with a command such as:
2006+
help: rustup toolchain install nightly-2018-12-27
2007+
help: then you can use the toolchain with commands such as:
2008+
help: cargo +nightly-2018-12-27 build
20132009
...
20142010
"#]])
20152011
.is_err();

0 commit comments

Comments
 (0)