@@ -427,23 +427,16 @@ pub fn create_bcx<'a, 'gctx>(
427427 . requested_kinds
428428 . iter ( )
429429 . any ( CompileKind :: is_host) ;
430- let should_share_deps = host_kind_requested
431- || gctx. cli_unstable ( ) . bindeps
432- && unit_graph
433- . iter ( )
434- . any ( |( unit, _) | unit. artifact_target_for_features . is_some ( ) ) ;
435- if should_share_deps {
436- // Rebuild the unit graph, replacing the explicit host targets with
437- // CompileKind::Host, removing `artifact_target_for_features` and merging any dependencies
438- // shared with build and artifact dependencies.
439- ( units, scrape_units, unit_graph) = rebuild_unit_graph_shared (
440- interner,
441- unit_graph,
442- & units,
443- & scrape_units,
444- host_kind_requested. then_some ( explicit_host_kind) ,
445- ) ;
446- }
430+ // Rebuild the unit graph, replacing the explicit host targets with
431+ // CompileKind::Host, removing `artifact_target_for_features` and merging any dependencies
432+ // shared with build and artifact dependencies.
433+ ( units, scrape_units, unit_graph) = rebuild_unit_graph_shared (
434+ interner,
435+ unit_graph,
436+ & units,
437+ & scrape_units,
438+ host_kind_requested. then_some ( explicit_host_kind) ,
439+ ) ;
447440
448441 let mut extra_compiler_args = HashMap :: new ( ) ;
449442 if let Some ( args) = extra_args {
@@ -545,7 +538,8 @@ where `<compatible-ver>` is the latest version supporting rustc {rustc_version}"
545538 Ok ( bcx)
546539}
547540
548- /// This is used to rebuild the unit graph, sharing host dependencies if possible.
541+ /// This is used to rebuild the unit graph, sharing host dependencies if possible,
542+ /// and applying other unit adjustments based on the whole graph.
549543///
550544/// This will translate any unit's `CompileKind::Target(host)` to
551545/// `CompileKind::Host` if `to_host` is not `None` and the kind is equal to `to_host`.
@@ -567,6 +561,14 @@ where `<compatible-ver>` is the latest version supporting rustc {rustc_version}"
567561/// to the `Unit`, this allows the `CompileKind` to be changed back to `Host`
568562/// and `artifact_target_for_features` to be removed without fear of an unwanted
569563/// collision for build or artifact dependencies.
564+ ///
565+ /// This is also responsible for adjusting the `strip` profile option to
566+ /// opportunistically strip if debug is 0 for all dependencies. This helps
567+ /// remove debuginfo added by the standard library.
568+ ///
569+ /// This is also responsible for adjusting the `debug` setting for host
570+ /// dependencies, turning off debug if the user has not explicitly enabled it,
571+ /// and the unit is not shared with a target unit.
570572fn rebuild_unit_graph_shared (
571573 interner : & UnitInterner ,
572574 unit_graph : UnitGraph ,
0 commit comments