Skip to content

Commit 51222df

Browse files
authored
Merge pull request #2554 from kinnison/fix-2440
UX: Ensure 'skipping nightly' messages use rename table
2 parents 54d8296 + 85d670e commit 51222df

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

src/dist/dist.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,11 @@ fn update_from_dist_<'a>(
693693
old_manifest
694694
};
695695

696+
let current_manifest = {
697+
let manifestation = Manifestation::open(prefix.clone(), toolchain.target.clone())?;
698+
manifestation.load_manifest()?
699+
};
700+
696701
loop {
697702
match try_update_from_dist_(
698703
download,
@@ -711,9 +716,13 @@ fn update_from_dist_<'a>(
711716
break Err(e);
712717
}
713718

714-
if let ErrorKind::RequestedComponentsUnavailable(components, ..) = e.kind() {
719+
if let ErrorKind::RequestedComponentsUnavailable(components, manifest, ..) =
720+
e.kind()
721+
{
715722
(download.notify_handler)(Notification::SkippingNightlyMissingComponent(
716-
&toolchain, components,
723+
&toolchain,
724+
current_manifest.as_ref().unwrap_or(manifest),
725+
components,
717726
));
718727

719728
if first_err.is_none() {

src/dist/notifications.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ use crate::utils::notify::NotificationLevel;
77
use std::fmt::{self, Display};
88
use std::path::Path;
99

10+
use super::manifest::Manifest;
11+
1012
#[derive(Debug)]
1113
pub enum Notification<'a> {
1214
Utils(crate::utils::Notification<'a>),
@@ -31,7 +33,7 @@ pub enum Notification<'a> {
3133
DownloadingManifest(&'a str),
3234
DownloadedManifest(&'a str, Option<&'a str>),
3335
DownloadingLegacyManifest,
34-
SkippingNightlyMissingComponent(&'a ToolchainDesc, &'a [Component]),
36+
SkippingNightlyMissingComponent(&'a ToolchainDesc, &'a Manifest, &'a [Component]),
3537
ForcingUnavailableComponent(&'a str),
3638
ManifestChecksumFailedHack,
3739
ComponentUnavailable(&'a str, Option<&'a TargetTriple>),
@@ -72,7 +74,7 @@ impl<'a> Notification<'a> {
7274
| ManifestChecksumFailedHack
7375
| RollingBack
7476
| DownloadingManifest(_)
75-
| SkippingNightlyMissingComponent(_, _)
77+
| SkippingNightlyMissingComponent(_, _, _)
7678
| RetryingDownload(_)
7779
| DownloadedManifest(_, _) => NotificationLevel::Info,
7880
CantReadUpdateHash(_)
@@ -174,17 +176,17 @@ impl<'a> Display for Notification<'a> {
174176
"removing stray hash found at '{}' in order to continue",
175177
path.display()
176178
),
177-
SkippingNightlyMissingComponent(toolchain, components) => write!(
179+
SkippingNightlyMissingComponent(toolchain, manifest, components) => write!(
178180
f,
179181
"skipping nightly which is missing installed component{} '{}'",
180182
if components.len() > 1 { "s" } else { "" },
181183
components
182184
.iter()
183185
.map(|component| {
184186
if component.target.as_ref() != Some(&toolchain.target) {
185-
component.name_in_manifest()
187+
component.name(manifest)
186188
} else {
187-
component.short_name_in_manifest().to_owned()
189+
component.short_name(manifest).to_owned()
188190
}
189191
})
190192
.collect::<Vec<_>>()

tests/mock/clitools.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,10 @@ fn create_mock_dist_server(path: &Path, s: Scenario) {
818818
Release::new("nightly", "1.3.0", "2019-12-10", "2").only_multi_arch(),
819819
],
820820
Scenario::MissingComponentMulti => vec![
821-
Release::new("nightly", "1.37.0", "2019-09-12", "1").multi_arch(),
822-
Release::new("nightly", "1.37.0", "2019-09-13", "2"),
821+
Release::new("nightly", "1.37.0", "2019-09-12", "1")
822+
.multi_arch()
823+
.with_rls(RlsStatus::Renamed),
824+
Release::new("nightly", "1.37.0", "2019-09-13", "2").with_rls(RlsStatus::Renamed),
823825
Release::new("nightly", "1.37.0", "2019-09-14", "3")
824826
.multi_arch()
825827
.with_rls(RlsStatus::Unavailable),

0 commit comments

Comments
 (0)