@@ -1225,7 +1225,15 @@ fn rebuild_unit_graph_shared(
1225
1225
let new_roots = roots
1226
1226
. iter ( )
1227
1227
. map ( |root| {
1228
- traverse_and_share ( interner, & mut memo, & mut result, & unit_graph, root, to_host)
1228
+ traverse_and_share (
1229
+ interner,
1230
+ & mut memo,
1231
+ & mut result,
1232
+ & unit_graph,
1233
+ root,
1234
+ false ,
1235
+ to_host,
1236
+ )
1229
1237
} )
1230
1238
. collect ( ) ;
1231
1239
let new_scrape_units = scrape_units
@@ -1246,6 +1254,7 @@ fn traverse_and_share(
1246
1254
new_graph : & mut UnitGraph ,
1247
1255
unit_graph : & UnitGraph ,
1248
1256
unit : & Unit ,
1257
+ unit_is_for_host : bool ,
1249
1258
to_host : CompileKind ,
1250
1259
) -> Unit {
1251
1260
if let Some ( new_unit) = memo. get ( unit) {
@@ -1256,8 +1265,15 @@ fn traverse_and_share(
1256
1265
let new_deps: Vec < _ > = unit_graph[ unit]
1257
1266
. iter ( )
1258
1267
. map ( |dep| {
1259
- let new_dep_unit =
1260
- traverse_and_share ( interner, memo, new_graph, unit_graph, & dep. unit , to_host) ;
1268
+ let new_dep_unit = traverse_and_share (
1269
+ interner,
1270
+ memo,
1271
+ new_graph,
1272
+ unit_graph,
1273
+ & dep. unit ,
1274
+ dep. unit_for . is_for_host ( ) ,
1275
+ to_host,
1276
+ ) ;
1261
1277
new_dep_unit. hash ( & mut dep_hash) ;
1262
1278
UnitDep {
1263
1279
unit : new_dep_unit,
@@ -1286,7 +1302,7 @@ fn traverse_and_share(
1286
1302
// If this is a build dependency, and it's not shared with runtime dependencies, we can weaken
1287
1303
// its debuginfo level to optimize build times. We do nothing if it's an artifact dependency,
1288
1304
// as it and its debuginfo may end up embedded in the main program.
1289
- if unit . kind . is_host ( ) && profile. debuginfo . is_deferred ( ) && !unit. artifact . is_true ( ) {
1305
+ if unit_is_for_host && profile. debuginfo . is_deferred ( ) && !unit. artifact . is_true ( ) {
1290
1306
// We create a "probe" test to see if a unit with the same explicit debuginfo level exists
1291
1307
// in the graph. This is the level we'd expect if it was set manually or the default value
1292
1308
// set by a profile for a runtime dependency: its canonical value.
0 commit comments