Skip to content

Let docs pass through with custom toolchains #2235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 24, 2020
Merged
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
24 changes: 13 additions & 11 deletions src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1312,17 +1312,19 @@ const DOCS_DATA: &[(&str, &str, &str,)] = &[

fn doc(cfg: &Cfg, m: &ArgMatches<'_>) -> Result<()> {
let toolchain = explicit_or_dir_toolchain(cfg, m)?;
for cstatus in &toolchain.list_components()? {
if cstatus.component.short_name_in_manifest() == "rust-docs" && !cstatus.installed {
info!(
"`rust-docs` not installed in toolchain `{}`",
toolchain.name()
);
info!(
"To install, try `rustup component add --toolchain {} rust-docs`",
toolchain.name()
);
return Err("unable to view documentation which is not installed".into());
if !toolchain.is_custom() {
for cstatus in &toolchain.list_components()? {
if cstatus.component.short_name_in_manifest() == "rust-docs" && !cstatus.installed {
info!(
"`rust-docs` not installed in toolchain `{}`",
toolchain.name()
);
info!(
"To install, try `rustup component add --toolchain {} rust-docs`",
toolchain.name()
);
return Err("unable to view documentation which is not installed".into());
}
}
}
let topical_path: PathBuf;
Expand Down
11 changes: 11 additions & 0 deletions tests/cli-rustup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1654,6 +1654,17 @@ fn docs_missing() {
});
}

#[test]
fn docs_custom() {
setup(&|config| {
let path = config.customdir.join("custom-1");
let path = path.to_string_lossy();
expect_ok(config, &["rustup", "toolchain", "link", "custom", &path]);
expect_ok(config, &["rustup", "default", "custom"]);
expect_stdout_ok(config, &["rustup", "doc", "--path"], "custom");
});
}

#[cfg(unix)]
#[test]
fn non_utf8_arg() {
Expand Down