add workspace root path to error messages on members collecting

This commit is contained in:
Cerber Ursi 2024-02-22 22:54:31 +07:00
parent 08c173a000
commit 07eb70811f
2 changed files with 15 additions and 9 deletions

View File

@ -697,8 +697,10 @@ impl<'gctx> Workspace<'gctx> {
self.find_path_deps(&path.join("Cargo.toml"), &root_manifest_path, false) self.find_path_deps(&path.join("Cargo.toml"), &root_manifest_path, false)
.with_context(|| { .with_context(|| {
format!( format!(
"failed to load manifest for workspace member `{}`", "failed to load manifest for workspace member `{}`\n\
path.display() referenced by workspace at `{}`",
path.display(),
root_manifest_path.display()
) )
})?; })?;
} }
@ -722,9 +724,10 @@ impl<'gctx> Workspace<'gctx> {
continue; continue;
} }
bail!( bail!(
"package `{}` is listed in workspaces default-members \ "package `{}` is listed in default-members\n\
but is not a member.", for workspace at {} but is not a member.",
path.display() path.display(),
root_manifest_path.display()
) )
} }
self.default_members.push(manifest_path) self.default_members.push(manifest_path)

View File

@ -438,6 +438,7 @@ fn invalid_members() {
.with_stderr( .with_stderr(
"\ "\
[ERROR] failed to load manifest for workspace member `[..]/foo` [ERROR] failed to load manifest for workspace member `[..]/foo`
referenced by workspace at `[..]/foo/Cargo.toml`
Caused by: Caused by:
failed to read `[..]foo/foo/Cargo.toml` failed to read `[..]foo/foo/Cargo.toml`
@ -910,8 +911,8 @@ fn virtual_default_member_is_not_a_member() {
.with_status(101) .with_status(101)
.with_stderr( .with_stderr(
"\ "\
error: package `[..]something-else` is listed in workspaces default-members \ error: package `[..]something-else` is listed in default-members\n\
but is not a member. for workspace at [..]Cargo.toml but is not a member.
", ",
) )
.run(); .run();
@ -1672,8 +1673,8 @@ fn excluded_default_members_still_must_be_members() {
.with_status(101) .with_status(101)
.with_stderr( .with_stderr(
"\ "\
error: package `[..]bar` is listed in workspaces default-members \ error: package `[..]bar` is listed in default-members\n\
but is not a member. for workspace at [..]foo/Cargo.toml but is not a member.
", ",
) )
.run(); .run();
@ -1902,6 +1903,7 @@ fn glob_syntax_invalid_members() {
.with_stderr( .with_stderr(
"\ "\
[ERROR] failed to load manifest for workspace member `[..]/crates/bar` [ERROR] failed to load manifest for workspace member `[..]/crates/bar`
referenced by workspace at `[..]/Cargo.toml`
Caused by: Caused by:
failed to read `[..]foo/crates/bar/Cargo.toml` failed to read `[..]foo/crates/bar/Cargo.toml`
@ -2388,6 +2390,7 @@ fn member_dep_missing() {
.with_stderr( .with_stderr(
"\ "\
[ERROR] failed to load manifest for workspace member `[..]/bar` [ERROR] failed to load manifest for workspace member `[..]/bar`
referenced by workspace at `[..]/Cargo.toml`
Caused by: Caused by:
failed to load manifest for dependency `baz` failed to load manifest for dependency `baz`