@@ -35,6 +35,7 @@ use crate::core::{
3535} ;
3636use crate :: ops:: resolve_all_features;
3737use crate :: util:: GlobalContext ;
38+ use crate :: util:: Unhashed ;
3839use crate :: util:: interning:: InternedString ;
3940
4041const IS_NO_ARTIFACT_DEP : Option < & ' static Artifact > = None ;
@@ -206,6 +207,8 @@ fn attach_std_deps(
206207 // TODO: Does this `public` make sense?
207208 public : true ,
208209 noprelude : true ,
210+ // Artificial dependency
211+ manifest_deps : Unhashed ( None ) ,
209212 } ) ) ;
210213 found = true ;
211214 }
@@ -305,6 +308,8 @@ fn compute_deps(
305308 let mode = check_or_build_mode ( unit. mode , dep_lib) ;
306309 let dep_unit_for = unit_for. with_dependency ( unit, dep_lib, unit_for. root_compile_kind ( ) ) ;
307310
311+ let manifest_deps = deps. iter ( ) . map ( |d| ( * d) . clone ( ) ) . collect :: < Vec < _ > > ( ) ;
312+
308313 let start = ret. len ( ) ;
309314 if state. gctx . cli_unstable ( ) . dual_proc_macros
310315 && dep_lib. proc_macro ( )
@@ -315,6 +320,7 @@ fn compute_deps(
315320 unit,
316321 dep_pkg,
317322 dep_lib,
323+ Some ( manifest_deps. clone ( ) ) ,
318324 dep_unit_for,
319325 unit. kind ,
320326 mode,
@@ -326,6 +332,7 @@ fn compute_deps(
326332 unit,
327333 dep_pkg,
328334 dep_lib,
335+ Some ( manifest_deps) ,
329336 dep_unit_for,
330337 CompileKind :: Host ,
331338 mode,
@@ -338,6 +345,7 @@ fn compute_deps(
338345 unit,
339346 dep_pkg,
340347 dep_lib,
348+ Some ( manifest_deps) ,
341349 dep_unit_for,
342350 unit. kind . for_target ( dep_lib) ,
343351 mode,
@@ -416,6 +424,7 @@ fn compute_deps(
416424 unit,
417425 & unit. pkg ,
418426 t,
427+ None , // artificial
419428 UnitFor :: new_normal ( unit_for. root_compile_kind ( ) ) ,
420429 unit. kind . for_target ( t) ,
421430 CompileMode :: Build ,
@@ -511,6 +520,7 @@ fn compute_deps_custom_build(
511520 unit,
512521 & unit. pkg ,
513522 & unit. target ,
523+ None , // artificial
514524 script_unit_for,
515525 // Build scripts always compiled for the host.
516526 CompileKind :: Host ,
@@ -604,6 +614,7 @@ fn artifact_targets_to_unit_deps(
604614 target
605615 . clone ( )
606616 . set_kind ( TargetKind :: Lib ( vec ! [ target_kind. clone( ) ] ) ) ,
617+ None , // TBD
607618 parent_unit_for,
608619 compile_kind,
609620 CompileMode :: Build ,
@@ -616,6 +627,7 @@ fn artifact_targets_to_unit_deps(
616627 parent,
617628 artifact_pkg,
618629 target,
630+ None , // TBD
619631 parent_unit_for,
620632 compile_kind,
621633 CompileMode :: Build ,
@@ -651,6 +663,7 @@ fn compute_deps_doc(
651663 unit,
652664 dep_pkg,
653665 dep_lib,
666+ None , // not checking unused deps
654667 dep_unit_for,
655668 unit. kind . for_target ( dep_lib) ,
656669 mode,
@@ -664,6 +677,7 @@ fn compute_deps_doc(
664677 unit,
665678 dep_pkg,
666679 dep_lib,
680+ None , // not checking unused deps
667681 dep_unit_for,
668682 unit. kind . for_target ( dep_lib) ,
669683 unit. mode ,
@@ -697,6 +711,7 @@ fn compute_deps_doc(
697711 unit,
698712 & unit. pkg ,
699713 lib,
714+ None , // not checking unused deps
700715 dep_unit_for,
701716 unit. kind . for_target ( lib) ,
702717 unit. mode ,
@@ -716,6 +731,7 @@ fn compute_deps_doc(
716731 scrape_unit,
717732 & scrape_unit. pkg ,
718733 & scrape_unit. target ,
734+ None , // not checking unused deps
719735 scrape_unit_for,
720736 scrape_unit. kind ,
721737 scrape_unit. mode ,
@@ -744,6 +760,7 @@ fn maybe_lib(
744760 unit,
745761 & unit. pkg ,
746762 t,
763+ None ,
747764 dep_unit_for,
748765 unit. kind . for_target ( t) ,
749766 mode,
@@ -805,6 +822,7 @@ fn dep_build_script(
805822 unit,
806823 & unit. pkg ,
807824 t,
825+ None , // artificial
808826 script_unit_for,
809827 unit. kind ,
810828 CompileMode :: RunCustomBuild ,
@@ -841,6 +859,7 @@ fn new_unit_dep(
841859 parent : & Unit ,
842860 pkg : & Package ,
843861 target : & Target ,
862+ manifest_deps : Option < Vec < Dependency > > ,
844863 unit_for : UnitFor ,
845864 kind : CompileKind ,
846865 mode : CompileMode ,
@@ -855,7 +874,16 @@ fn new_unit_dep(
855874 kind,
856875 ) ;
857876 new_unit_dep_with_profile (
858- state, parent, pkg, target, unit_for, kind, mode, profile, artifact,
877+ state,
878+ parent,
879+ pkg,
880+ target,
881+ manifest_deps,
882+ unit_for,
883+ kind,
884+ mode,
885+ profile,
886+ artifact,
859887 )
860888}
861889
@@ -864,6 +892,7 @@ fn new_unit_dep_with_profile(
864892 parent : & Unit ,
865893 pkg : & Package ,
866894 target : & Target ,
895+ manifest_deps : Option < Vec < Dependency > > ,
867896 unit_for : UnitFor ,
868897 kind : CompileKind ,
869898 mode : CompileMode ,
@@ -911,6 +940,7 @@ fn new_unit_dep_with_profile(
911940 dep_name,
912941 public,
913942 noprelude : false ,
943+ manifest_deps : Unhashed ( manifest_deps) ,
914944 } )
915945}
916946
0 commit comments