Skip to content

Commit

Permalink
Move TOOLSTATE_MSG to dist to serve toolchain-wide operations
Browse files Browse the repository at this point in the history
  • Loading branch information
rami3l authored and djc committed Oct 26, 2023
1 parent 310570b commit b5d74ac
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
12 changes: 10 additions & 2 deletions src/dist/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ static TOOLCHAIN_CHANNELS: &[&str] = &[
r"\d{1}\.\d{1,3}(?:\.\d{1,2})?",
];

const TOOLSTATE_MSG: &str =
"If you require these components, please install and use the latest successful build version,\n\
which you can find at <https://rust-lang.github.io/rustup-components-history>.\n\nAfter determining \
the correct date, install it with a command such as:\n\n \
rustup toolchain install nightly-2018-12-27\n\n\
Then you can use the toolchain with commands such as:\n\n \
cargo +nightly-2018-12-27 build";

/// Returns a error message indicating that certain [`Component`]s are missing in a toolchain distribution.
///
/// This message is currently used exclusively in toolchain-wide operations,
Expand Down Expand Up @@ -71,7 +79,7 @@ fn components_missing_msg(cs: &[Component], manifest: &ManifestV2, toolchain: &s

let _ = write!(
buf,
"If you don't need the component, you could try a minimal installation with:\n\n{suggestion}"
"If you don't need the component, you could try a minimal installation with:\n\n{suggestion}\n\n{TOOLSTATE_MSG}"
);
}
cs => {
Expand All @@ -91,7 +99,7 @@ fn components_missing_msg(cs: &[Component], manifest: &ManifestV2, toolchain: &s

let _ = write!(
buf,
"If you don't need the components, you could try a minimal installation with:\n\n{suggestion}"
"If you don't need the components, you could try a minimal installation with:\n\n{suggestion}\n\n{TOOLSTATE_MSG}"
);
}
}
Expand Down
8 changes: 0 additions & 8 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ use crate::{
toolchain::names::{PathBasedToolchainName, ToolchainName},
};

const TOOLSTATE_MSG: &str =
"If you require these components, please install and use the latest successful build version,\n\
which you can find at <https://rust-lang.github.io/rustup-components-history>.\n\nAfter determining \
the correct date, install it with a command such as:\n\n \
rustup toolchain install nightly-2018-12-27\n\n\
Then you can use the toolchain with commands such as:\n\n \
cargo +nightly-2018-12-27 build";

/// A type erasing thunk for the retry crate to permit use with anyhow. See <https://github.com/dtolnay/anyhow/issues/149>
#[derive(Debug, ThisError)]
#[error(transparent)]
Expand Down
13 changes: 12 additions & 1 deletion tests/suite/cli_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,18 @@ fn add_missing_component_toolchain() {
r"component 'rust-std' for target '{0}' is unavailable for download for channel 'nightly'
Sometimes not all components are available in any given nightly. If you don't need the component, you could try a minimal installation with:
rustup toolchain add nightly --profile minimal"
rustup toolchain add nightly --profile minimal
If you require these components, please install and use the latest successful build version,
which you can find at <https://rust-lang.github.io/rustup-components-history>.
After determining the correct date, install it with a command such as:
rustup toolchain install nightly-2018-12-27
Then you can use the toolchain with commands such as:
cargo +nightly-2018-12-27 build"
),
);
});
Expand Down

0 comments on commit b5d74ac

Please sign in to comment.