Skip to content

Commit 832fff8

Browse files
committed
fix: more context when failed to load workspace member
1 parent 163097c commit 832fff8

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/cargo/core/workspace.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,13 @@ impl<'cfg> Workspace<'cfg> {
645645
};
646646

647647
for path in &members_paths {
648-
self.find_path_deps(&path.join("Cargo.toml"), &root_manifest_path, false)?;
648+
self.find_path_deps(&path.join("Cargo.toml"), &root_manifest_path, false)
649+
.with_context(|| {
650+
format!(
651+
"failed to load manifest for workspace member `{}`",
652+
path.display()
653+
)
654+
})?;
649655
}
650656

651657
if let Some(default) = default_members_paths {

tests/testsuite/workspaces.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,10 @@ fn invalid_members() {
408408
.with_status(101)
409409
.with_stderr(
410410
"\
411-
error: failed to read `[..]Cargo.toml`
411+
[ERROR] failed to load manifest for workspace member `[..]/foo`
412+
413+
Caused by:
414+
failed to read `[..]foo/foo/Cargo.toml`
412415
413416
Caused by:
414417
[..]
@@ -1869,7 +1872,10 @@ fn glob_syntax_invalid_members() {
18691872
.with_status(101)
18701873
.with_stderr(
18711874
"\
1872-
error: failed to read `[..]Cargo.toml`
1875+
[ERROR] failed to load manifest for workspace member `[..]/crates/bar`
1876+
1877+
Caused by:
1878+
failed to read `[..]foo/crates/bar/Cargo.toml`
18731879
18741880
Caused by:
18751881
[..]

0 commit comments

Comments
 (0)