Skip to content

Commit 078770f

Browse files
committed
notifications: log directly on missing components
1 parent 9dc4e8e commit 078770f

File tree

3 files changed

+16
-29
lines changed

3 files changed

+16
-29
lines changed

src/dist/mod.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -990,11 +990,18 @@ pub(crate) async fn update_from_dist(
990990
let cause = e.downcast_ref::<DistError>();
991991
match cause {
992992
Some(DistError::ToolchainComponentsMissing(components, manifest, ..)) => {
993-
(opts.dl_cfg.notify_handler)(Notification::SkippingNightlyMissingComponent(
994-
&toolchain,
995-
current_manifest.as_ref().unwrap_or(manifest),
996-
components,
997-
));
993+
let plural = if components.len() > 1 { "s" } else { "" };
994+
let manifest = current_manifest.as_ref().unwrap_or(manifest);
995+
let components = components
996+
.iter()
997+
.map(
998+
|component| match component.target.as_ref() == Some(&toolchain.target) {
999+
true => component.short_name(manifest),
1000+
false => component.name(manifest),
1001+
},
1002+
)
1003+
.join(", ");
1004+
info!("skipping nightly with missing component{plural}: {components}");
9981005

9991006
if first_err.is_none() {
10001007
first_err = Some(e);

src/notifications.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::path::{Path, PathBuf};
44
use url::Url;
55

66
use crate::dist::TargetTriple;
7-
use crate::dist::manifest::{Component, Manifest};
87
use crate::settings::MetadataVersion;
98
use crate::utils::units;
109
use crate::{dist::ToolchainDesc, toolchain::ToolchainName, utils::notify::NotificationLevel};
@@ -15,7 +14,6 @@ pub(crate) enum Notification<'a> {
1514
CachedFileChecksumFailed,
1615
/// The URL of the download is passed as the last argument, to allow us to track concurrent downloads.
1716
DownloadingComponent(&'a str, &'a TargetTriple, Option<&'a TargetTriple>, &'a str),
18-
SkippingNightlyMissingComponent(&'a ToolchainDesc, &'a Manifest, &'a [Component]),
1917
ForcingUnavailableComponent(&'a str),
2018
StrayHash(&'a Path),
2119
RetryingDownload(&'a str),
@@ -64,9 +62,7 @@ impl Notification<'_> {
6462
use self::Notification::*;
6563
match self {
6664
FileAlreadyDownloaded => NotificationLevel::Debug,
67-
DownloadingComponent(_, _, _, _)
68-
| SkippingNightlyMissingComponent(_, _, _)
69-
| RetryingDownload(_) => NotificationLevel::Info,
65+
DownloadingComponent(_, _, _, _) | RetryingDownload(_) => NotificationLevel::Info,
7066
CachedFileChecksumFailed | ForcingUnavailableComponent(_) | StrayHash(_) => {
7167
NotificationLevel::Warn
7268
}
@@ -117,22 +113,6 @@ impl Display for Notification<'_> {
117113
"removing stray hash found at '{}' in order to continue",
118114
path.display()
119115
),
120-
SkippingNightlyMissingComponent(toolchain, manifest, components) => write!(
121-
f,
122-
"skipping nightly which is missing installed component{} '{}'",
123-
if components.len() > 1 { "s" } else { "" },
124-
components
125-
.iter()
126-
.map(|component| {
127-
if component.target.as_ref() != Some(&toolchain.target) {
128-
component.name(manifest)
129-
} else {
130-
component.short_name(manifest)
131-
}
132-
})
133-
.collect::<Vec<_>>()
134-
.join("', '")
135-
),
136116
ForcingUnavailableComponent(component) => {
137117
write!(f, "Force-skipping unavailable component '{component}'")
138118
}

tests/suite/cli_exact.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ async fn install_unreleased_component() {
869869
.with_stderr(snapbox::str![[r#"
870870
info: syncing channel updates for nightly-[HOST_TRIPLE]
871871
info: latest update on 2019-09-13 for version 1.37.0 (hash-nightly-2)
872-
info: skipping nightly which is missing installed component 'rust-std-[MULTI_ARCH_I]'
872+
info: skipping nightly with missing component: rust-std-[MULTI_ARCH_I]
873873
info: syncing channel updates for nightly-2019-09-12-[HOST_TRIPLE]
874874
875875
"#]]);
@@ -889,10 +889,10 @@ info: syncing channel updates for nightly-2019-09-12-[HOST_TRIPLE]
889889
.with_stderr(snapbox::str![[r#"
890890
info: syncing channel updates for nightly-[HOST_TRIPLE]
891891
info: latest update on 2019-09-14 for version 1.37.0 (hash-nightly-3)
892-
info: skipping nightly which is missing installed component 'rls'
892+
info: skipping nightly with missing component: rls
893893
info: syncing channel updates for nightly-2019-09-13-[HOST_TRIPLE]
894894
info: latest update on 2019-09-13 for version 1.37.0 (hash-nightly-2)
895-
info: skipping nightly which is missing installed component 'rust-std-[MULTI_ARCH_I]'
895+
info: skipping nightly with missing component: rust-std-[MULTI_ARCH_I]
896896
info: syncing channel updates for nightly-2019-09-12-[HOST_TRIPLE]
897897
898898
"#]]);

0 commit comments

Comments
 (0)