File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 5
5
//! source, dependencies, targets, and available features. The collected metadata is then
6
6
//! used to update the `Build` structure, ensuring proper dependency resolution and
7
7
//! compilation flow.
8
- use std:: collections:: BTreeMap ;
8
+ use std:: collections:: { BTreeMap , HashSet } ;
9
9
use std:: path:: PathBuf ;
10
10
11
11
use serde_derive:: Deserialize ;
@@ -89,7 +89,21 @@ fn workspace_members(build: &Build) -> Vec<Package> {
89
89
. arg ( "--manifest-path" )
90
90
. arg ( build. src . join ( manifest_path) ) ;
91
91
let metadata_output = cargo. run_always ( ) . run_capture_stdout ( build) . stdout ( ) ;
92
- let Output { packages, .. } = t ! ( serde_json:: from_str( & metadata_output) ) ;
92
+ let Output { mut packages, .. } = t ! ( serde_json:: from_str( & metadata_output) ) ;
93
+
94
+ // We need to remove local dependencies that exist outside of the workspace.
95
+ // This can happen when a package from the library workspace is directly
96
+ // depended on by the compiler, like for example proc_macro.
97
+ let local_deps =
98
+ packages. iter ( ) . map ( |package| package. name . clone ( ) ) . collect :: < HashSet < _ > > ( ) ;
99
+ for package in & mut packages {
100
+ let ( ) = package
101
+ . dependencies
102
+ . extract_if ( .., |dep| !local_deps. contains ( & dep. name ) )
103
+ . map ( |_| ( ) )
104
+ . collect ( ) ;
105
+ }
106
+
93
107
packages
94
108
} ;
95
109
You can’t perform that action at this time.
0 commit comments