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 55//! source, dependencies, targets, and available features. The collected metadata is then
66//! used to update the `Build` structure, ensuring proper dependency resolution and
77//! compilation flow.
8- use std:: collections:: BTreeMap ;
8+ use std:: collections:: { BTreeMap , HashSet } ;
99use std:: path:: PathBuf ;
1010
1111use serde_derive:: Deserialize ;
@@ -89,7 +89,21 @@ fn workspace_members(build: &Build) -> Vec<Package> {
8989 . arg ( "--manifest-path" )
9090 . arg ( build. src . join ( manifest_path) ) ;
9191 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+
93107 packages
94108 } ;
95109
You can’t perform that action at this time.
0 commit comments