Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/dist/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ fn components_missing_msg(cs: &[Component], manifest: &ManifestV2, toolchain: &s
}
}

let from_complete_profile = manifest
.profiles
.get(&Profile::Complete)
.map(|profile| cs.iter().all(|c| profile.contains(&c.pkg)))
.unwrap_or(false);

if toolchain.starts_with("nightly") {
let _ = write!(
buf,
Expand All @@ -97,6 +103,13 @@ fn components_missing_msg(cs: &[Component], manifest: &ManifestV2, toolchain: &s
help: then you can use the toolchain with commands such as:\n\
help: cargo +nightly-2018-12-27 build"
);
} else if from_complete_profile {
let _ = write!(
buf,
"\
note: these were added as default components on another toolchain
help: run `rustup set profile minimal` to stop new toolchains from inheriting extra components"
);
} else if ["beta", "stable"].iter().any(|&p| toolchain.starts_with(p)) {
let _ = write!(
buf,
Expand Down
22 changes: 21 additions & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use url::Url;

use crate::{
dist::{
Channel, TargetTuple, ToolchainDesc,
Channel, Profile, TargetTuple, ToolchainDesc,
manifest::{Component, Manifest},
},
toolchain::{PathBasedToolchainName, ToolchainName},
Expand Down Expand Up @@ -217,6 +217,8 @@ fn component_unavailable_msg(cs: &[Component], manifest: &Manifest, toolchain: &

if toolchain.starts_with("nightly") {
let _ = write!(buf, "{NIGHTLY_COMPONENT_NOTE}");
} else {
write_nightly_profile_hint(&mut buf, cs, manifest);
}
}
cs => {
Expand Down Expand Up @@ -244,13 +246,31 @@ fn component_unavailable_msg(cs: &[Component], manifest: &Manifest, toolchain: &

if toolchain.starts_with("nightly") {
let _ = write!(buf, "{NIGHTLY_COMPONENT_NOTE}");
} else {
write_nightly_profile_hint(&mut buf, cs, manifest);
}
}
}

String::from_utf8(buf).unwrap()
}

fn write_nightly_profile_hint(buf: &mut Vec<u8>, cs: &[Component], manifest: &Manifest) {
let from_complete_profile = manifest
.profiles
.get(&Profile::Complete)
.map(|profile| cs.iter().all(|c| profile.contains(&c.pkg)))
.unwrap_or(false);
if from_complete_profile {
let _ = write!(
buf,
"\
note: these were added as default components on another toolchain
help: run `rustup set profile minimal` to stop new toolchains from inheriting extra components"
);
}
}

fn unknown_components_msg(desc: &ToolchainDesc, components: &[UnknownComponentInfo]) -> String {
let mut buf = String::new();

Expand Down
Loading