Skip to content
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

Error messages when collecting workspace members now mention the workspace root location #13480

Merged
merged 2 commits into from
Feb 22, 2024
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
13 changes: 8 additions & 5 deletions src/cargo/core/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
})?;
}
Expand All @@ -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)
Expand Down
11 changes: 7 additions & 4 deletions tests/testsuite/workspaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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`
Expand Down