Skip to content
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
6 changes: 5 additions & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ pub enum RustupError {
DownloadingFile { url: Url, path: PathBuf },
#[error("could not download file from '{url}' to '{}'", .path.display())]
DownloadNotExists { url: Url, path: PathBuf },
#[error("Missing manifest in toolchain '{}'", .0)]
#[error(
"missing manifest in toolchain '{0}'\n\
help: this may happen if the toolchain installation was interrupted\n\
help: try reinstalling or updating the toolchain"
)]
MissingManifest(ToolchainDesc),
#[error("server sent a broken manifest: missing package for component {0}")]
MissingPackageForComponent(String),
Expand Down
32 changes: 32 additions & 0 deletions tests/suite/cli_rustup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4144,3 +4144,35 @@ installed targets:
.with_stderr(snapbox::str![[""]])
.is_ok();
}

#[tokio::test]
async fn missing_manifest_shows_reinstall_help() {
let cx = CliTestContext::new(Scenario::SimpleV2).await;

cx.config
.expect(["rustup", "toolchain", "install", "nightly"])
.await
.is_ok();

let manifest_path = cx
.config
.rustupdir
.join("toolchains")
.join(format!("nightly-{}", this_host_triple()))
.join("lib")
.join("rustlib")
.join("multirust-channel-manifest.toml");

fs::remove_file(&manifest_path).unwrap();

cx.config
.expect(["rustup", "component", "list", "--toolchain", "nightly"])
.await
.with_stderr(snapbox::str![[r#"
error: missing manifest in toolchain 'nightly-[HOST_TRIPLE]'
help: this may happen if the toolchain installation was interrupted
help: try reinstalling or updating the toolchain

"#]])
.is_err();
}
Loading