File tree Expand file tree Collapse file tree 2 files changed +56
-6
lines changed
Expand file tree Collapse file tree 2 files changed +56
-6
lines changed Original file line number Diff line number Diff line change @@ -725,14 +725,15 @@ impl<'cfg> Workspace<'cfg> {
725725 self . member_ids . insert ( pkg. package_id ( ) ) ;
726726 pkg. dependencies ( )
727727 . iter ( )
728- . map ( |d| d. source_id ( ) )
729- . filter ( |d| d . is_path ( ) )
730- . filter_map ( |d| d . url ( ) . to_file_path ( ) . ok ( ) )
731- . map ( |p| p. join ( "Cargo.toml" ) )
728+ . map ( |d| ( d. source_id ( ) , d . package_name ( ) ) )
729+ . filter ( |( s , _ ) | s . is_path ( ) )
730+ . filter_map ( |( s , n ) | s . url ( ) . to_file_path ( ) . ok ( ) . map ( |p| ( p , n ) ) )
731+ . map ( |( p , n ) | ( p. join ( "Cargo.toml" ) , n ) )
732732 . collect :: < Vec < _ > > ( )
733733 } ;
734- for candidate in candidates {
735- self . find_path_deps ( & candidate, root_manifest, true )
734+ for ( path, name) in candidates {
735+ self . find_path_deps ( & path, root_manifest, true )
736+ . with_context ( || format ! ( "failed to load manifest for dependency `{}`" , name) )
736737 . map_err ( |err| ManifestError :: new ( err, manifest_path. clone ( ) ) ) ?;
737738 }
738739 Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -2324,6 +2324,55 @@ Caused by:
23242324 . run ( ) ;
23252325}
23262326
2327+ #[ cargo_test]
2328+ fn member_dep_missing ( ) {
2329+ // Make sure errors are not suppressed with -q.
2330+ let p = project ( )
2331+ . file (
2332+ "Cargo.toml" ,
2333+ r#"
2334+ [project]
2335+ name = "foo"
2336+ version = "0.1.0"
2337+
2338+ [workspace]
2339+ members = ["bar"]
2340+ "# ,
2341+ )
2342+ . file ( "src/main.rs" , "fn main() {}" )
2343+ . file (
2344+ "bar/Cargo.toml" ,
2345+ r#"
2346+ [project]
2347+ name = "bar"
2348+ version = "0.1.0"
2349+
2350+ [dependencies]
2351+ baz = { path = "baz" }
2352+ "# ,
2353+ )
2354+ . file ( "bar/src/main.rs" , "fn main() {}" )
2355+ . build ( ) ;
2356+
2357+ p. cargo ( "build -q" )
2358+ . with_status ( 101 )
2359+ . with_stderr (
2360+ "\
2361+ [ERROR] failed to load manifest for workspace member `[..]/bar`
2362+
2363+ Caused by:
2364+ failed to load manifest for dependency `baz`
2365+
2366+ Caused by:
2367+ failed to read `[..]foo/bar/baz/Cargo.toml`
2368+
2369+ Caused by:
2370+ [..]
2371+ " ,
2372+ )
2373+ . run ( ) ;
2374+ }
2375+
23272376#[ cargo_test]
23282377fn simple_primary_package_env_var ( ) {
23292378 let is_primary_package = r#"
You can’t perform that action at this time.
0 commit comments