@@ -133,10 +133,11 @@ fn emit_build_output(
133133fn build_work < ' a , ' cfg > ( cx : & mut Context < ' a , ' cfg > , unit : & Unit < ' a > ) -> CargoResult < Job > {
134134 assert ! ( unit. mode. is_run_custom_build( ) ) ;
135135 let bcx = & cx. bcx ;
136- let dependencies = cx. dep_targets ( unit) ;
136+ let dependencies = cx. unit_deps ( unit) ;
137137 let build_script_unit = dependencies
138138 . iter ( )
139- . find ( |d| !d. mode . is_run_custom_build ( ) && d. target . is_custom_build ( ) )
139+ . find ( |d| !d. unit . mode . is_run_custom_build ( ) && d. unit . target . is_custom_build ( ) )
140+ . map ( |d| & d. unit )
140141 . expect ( "running a script not depending on an actual script" ) ;
141142 let script_dir = cx. files ( ) . build_script_dir ( build_script_unit) ;
142143 let script_out_dir = cx. files ( ) . build_script_out_dir ( unit) ;
@@ -225,21 +226,19 @@ fn build_work<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) -> CargoRes
225226 //
226227 // This information will be used at build-time later on to figure out which
227228 // sorts of variables need to be discovered at that time.
228- let lib_deps = {
229- dependencies
230- . iter ( )
231- . filter_map ( |unit| {
232- if unit. mode . is_run_custom_build ( ) {
233- Some ( (
234- unit. pkg . manifest ( ) . links ( ) . unwrap ( ) . to_string ( ) ,
235- unit. pkg . package_id ( ) ,
236- ) )
237- } else {
238- None
239- }
240- } )
241- . collect :: < Vec < _ > > ( )
242- } ;
229+ let lib_deps = dependencies
230+ . iter ( )
231+ . filter_map ( |dep| {
232+ if dep. unit . mode . is_run_custom_build ( ) {
233+ Some ( (
234+ dep. unit . pkg . manifest ( ) . links ( ) . unwrap ( ) . to_string ( ) ,
235+ dep. unit . pkg . package_id ( ) ,
236+ ) )
237+ } else {
238+ None
239+ }
240+ } )
241+ . collect :: < Vec < _ > > ( ) ;
243242 let pkg_name = unit. pkg . to_string ( ) ;
244243 let build_script_outputs = Arc :: clone ( & cx. build_script_outputs ) ;
245244 let id = unit. pkg . package_id ( ) ;
@@ -563,15 +562,15 @@ fn prepare_metabuild<'a, 'cfg>(
563562 deps : & [ String ] ,
564563) -> CargoResult < ( ) > {
565564 let mut output = Vec :: new ( ) ;
566- let available_deps = cx. dep_targets ( unit) ;
565+ let available_deps = cx. unit_deps ( unit) ;
567566 // Filter out optional dependencies, and look up the actual lib name.
568567 let meta_deps: Vec < _ > = deps
569568 . iter ( )
570569 . filter_map ( |name| {
571570 available_deps
572571 . iter ( )
573- . find ( |u| u . pkg . name ( ) . as_str ( ) == name. as_str ( ) )
574- . map ( |dep| dep . target . crate_name ( ) )
572+ . find ( |d| d . unit . pkg . name ( ) . as_str ( ) == name. as_str ( ) )
573+ . map ( |d| d . unit . target . crate_name ( ) )
575574 } )
576575 . collect ( ) ;
577576 for dep in & meta_deps {
@@ -669,7 +668,7 @@ pub fn build_map<'b, 'cfg>(cx: &mut Context<'b, 'cfg>, units: &[Unit<'b>]) -> Ca
669668 // to rustc invocation caching schemes, so be sure to generate the same
670669 // set of build script dependency orderings via sorting the targets that
671670 // come out of the `Context`.
672- let mut dependencies = cx. dep_targets ( unit) ;
671+ let mut dependencies: Vec < Unit < ' _ > > = cx. unit_deps ( unit) . iter ( ) . map ( |d| d . unit ) . collect ( ) ;
673672 dependencies. sort_by_key ( |u| u. pkg . package_id ( ) ) ;
674673
675674 for dep_unit in dependencies. iter ( ) {
0 commit comments