diff --git a/src/cargo/core/workspace.rs b/src/cargo/core/workspace.rs index eea2d171150..c8e98667e18 100644 --- a/src/cargo/core/workspace.rs +++ b/src/cargo/core/workspace.rs @@ -697,8 +697,10 @@ impl<'gctx> Workspace<'gctx> { self.find_path_deps(&path.join("Cargo.toml"), &root_manifest_path, false) .with_context(|| { format!( - "failed to load manifest for workspace member `{}`", - path.display() + "failed to load manifest for workspace member `{}`\n\ + referenced by workspace at `{}`", + path.display(), + root_manifest_path.display() ) })?; } @@ -722,9 +724,10 @@ impl<'gctx> Workspace<'gctx> { continue; } bail!( - "package `{}` is listed in workspace’s default-members \ - but is not a member.", - path.display() + "package `{}` is listed in default-members but is not a member\n\ + for workspace at {}.", + path.display(), + root_manifest_path.display() ) } self.default_members.push(manifest_path) diff --git a/tests/testsuite/workspaces.rs b/tests/testsuite/workspaces.rs index 080269dfc86..c5008f17ea9 100644 --- a/tests/testsuite/workspaces.rs +++ b/tests/testsuite/workspaces.rs @@ -438,6 +438,7 @@ fn invalid_members() { .with_stderr( "\ [ERROR] failed to load manifest for workspace member `[..]/foo` +referenced by workspace at `[..]/foo/Cargo.toml` Caused by: failed to read `[..]foo/foo/Cargo.toml` @@ -910,8 +911,8 @@ fn virtual_default_member_is_not_a_member() { .with_status(101) .with_stderr( "\ -error: package `[..]something-else` is listed in workspace’s default-members \ -but is not a member. +error: package `[..]something-else` is listed in default-members but is not a member\n\ +for workspace at [..]Cargo.toml. ", ) .run(); @@ -1672,8 +1673,8 @@ fn excluded_default_members_still_must_be_members() { .with_status(101) .with_stderr( "\ -error: package `[..]bar` is listed in workspace’s default-members \ -but is not a member. +error: package `[..]bar` is listed in default-members but is not a member\n\ +for workspace at [..]foo/Cargo.toml. ", ) .run(); @@ -1902,6 +1903,7 @@ fn glob_syntax_invalid_members() { .with_stderr( "\ [ERROR] failed to load manifest for workspace member `[..]/crates/bar` +referenced by workspace at `[..]/Cargo.toml` Caused by: failed to read `[..]foo/crates/bar/Cargo.toml` @@ -2388,6 +2390,7 @@ fn member_dep_missing() { .with_stderr( "\ [ERROR] failed to load manifest for workspace member `[..]/bar` +referenced by workspace at `[..]/Cargo.toml` Caused by: failed to load manifest for dependency `baz`