File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
src/cargo/ops/cargo_compile Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1265,8 +1265,17 @@ fn traverse_and_share(
1265
1265
}
1266
1266
} )
1267
1267
. collect ( ) ;
1268
+ // Here, we have recursively traversed this unit's dependencies, and hashed them: we can
1269
+ // finalize the dep hash.
1268
1270
let new_dep_hash = dep_hash. finish ( ) ;
1269
- let new_kind = if unit. kind == to_host {
1271
+
1272
+ // This is the key part of the sharing process: if the unit is a runtime dependency, whose
1273
+ // target is the same as the host, we canonicalize the compile kind to `CompileKind::Host`.
1274
+ // A possible host dependency counterpart to this unit would have that kind, and if such a unit
1275
+ // exists in the current `unit_graph`, they will unify in the new unit graph map `new_graph`.
1276
+ // The resulting unit graph will have be optimized with less units, thanks to sharing these host
1277
+ // dependencies.
1278
+ let canonical_kind = if unit. kind == to_host {
1270
1279
CompileKind :: Host
1271
1280
} else {
1272
1281
unit. kind
@@ -1311,7 +1320,7 @@ fn traverse_and_share(
1311
1320
& unit. pkg ,
1312
1321
& unit. target ,
1313
1322
profile,
1314
- new_kind ,
1323
+ canonical_kind ,
1315
1324
unit. mode ,
1316
1325
unit. features . clone ( ) ,
1317
1326
unit. is_std ,
You can’t perform that action at this time.
0 commit comments