@@ -284,6 +284,7 @@ fn compute_deps(
284
284
unit,
285
285
dep_pkg,
286
286
dep_lib,
287
+ /*rustflags*/ Default :: default ( ) ,
287
288
dep_unit_for,
288
289
unit. kind ,
289
290
mode,
@@ -295,6 +296,7 @@ fn compute_deps(
295
296
unit,
296
297
dep_pkg,
297
298
dep_lib,
299
+ /*rustflags*/ Default :: default ( ) ,
298
300
dep_unit_for,
299
301
CompileKind :: Host ,
300
302
mode,
@@ -307,6 +309,7 @@ fn compute_deps(
307
309
unit,
308
310
dep_pkg,
309
311
dep_lib,
312
+ /*rustflags*/ Default :: default ( ) ,
310
313
dep_unit_for,
311
314
unit. kind . for_target ( dep_lib) ,
312
315
mode,
@@ -377,6 +380,7 @@ fn compute_deps(
377
380
unit,
378
381
& unit. pkg ,
379
382
t,
383
+ /*rustflags*/ Default :: default ( ) ,
380
384
UnitFor :: new_normal ( unit_for. root_compile_kind ( ) ) ,
381
385
unit. kind . for_target ( t) ,
382
386
CompileMode :: Build ,
@@ -479,6 +483,7 @@ fn compute_deps_custom_build(
479
483
unit,
480
484
& unit. pkg ,
481
485
& unit. target ,
486
+ /*rustflags*/ Default :: default ( ) ,
482
487
script_unit_for,
483
488
// Build scripts always compiled for the host.
484
489
CompileKind :: Host ,
@@ -568,6 +573,7 @@ fn artifact_targets_to_unit_deps(
568
573
target
569
574
. clone ( )
570
575
. set_kind ( TargetKind :: Lib ( vec ! [ target_kind. clone( ) ] ) ) ,
576
+ /*rustflags*/ Default :: default ( ) ,
571
577
parent_unit_for,
572
578
compile_kind,
573
579
CompileMode :: Build ,
@@ -580,6 +586,7 @@ fn artifact_targets_to_unit_deps(
580
586
parent,
581
587
artifact_pkg,
582
588
target,
589
+ /*rustflags*/ Default :: default ( ) ,
583
590
parent_unit_for,
584
591
compile_kind,
585
592
CompileMode :: Build ,
@@ -655,6 +662,7 @@ fn compute_deps_doc(
655
662
unit,
656
663
dep_pkg,
657
664
dep_lib,
665
+ /*rustflags*/ Default :: default ( ) ,
658
666
dep_unit_for,
659
667
unit. kind . for_target ( dep_lib) ,
660
668
mode,
@@ -669,6 +677,7 @@ fn compute_deps_doc(
669
677
unit,
670
678
dep_pkg,
671
679
dep_lib,
680
+ /*rustflags*/ Default :: default ( ) ,
672
681
dep_unit_for,
673
682
unit. kind . for_target ( dep_lib) ,
674
683
unit. mode ,
@@ -699,6 +708,7 @@ fn compute_deps_doc(
699
708
unit,
700
709
& unit. pkg ,
701
710
lib,
711
+ /*rustflags*/ Default :: default ( ) ,
702
712
dep_unit_for,
703
713
unit. kind . for_target ( lib) ,
704
714
unit. mode ,
@@ -717,6 +727,7 @@ fn compute_deps_doc(
717
727
scrape_unit,
718
728
& scrape_unit. pkg ,
719
729
& scrape_unit. target ,
730
+ /*rustflags*/ Default :: default ( ) ,
720
731
unit_for,
721
732
scrape_unit. kind ,
722
733
scrape_unit. mode ,
@@ -740,11 +751,15 @@ fn maybe_lib(
740
751
. map ( |t| {
741
752
let mode = check_or_build_mode ( unit. mode , t) ;
742
753
let dep_unit_for = unit_for. with_dependency ( unit, t, unit_for. root_compile_kind ( ) ) ;
754
+
755
+ // When adding the lib targets for the current unit also pass down the user specified
756
+ // rustflags for the package.
743
757
new_unit_dep (
744
758
state,
745
759
unit,
746
760
& unit. pkg ,
747
761
t,
762
+ unit. rustflags . clone ( ) ,
748
763
dep_unit_for,
749
764
unit. kind . for_target ( t) ,
750
765
mode,
@@ -805,6 +820,7 @@ fn dep_build_script(
805
820
unit,
806
821
& unit. pkg ,
807
822
t,
823
+ Default :: default ( ) ,
808
824
script_unit_for,
809
825
unit. kind ,
810
826
CompileMode :: RunCustomBuild ,
@@ -839,6 +855,7 @@ fn new_unit_dep(
839
855
parent : & Unit ,
840
856
pkg : & Package ,
841
857
target : & Target ,
858
+ rustflags : Vec < InternedString > ,
842
859
unit_for : UnitFor ,
843
860
kind : CompileKind ,
844
861
mode : CompileMode ,
@@ -853,7 +870,7 @@ fn new_unit_dep(
853
870
kind,
854
871
) ;
855
872
new_unit_dep_with_profile (
856
- state, parent, pkg, target, unit_for, kind, mode, profile, artifact,
873
+ state, parent, pkg, target, rustflags , unit_for, kind, mode, profile, artifact,
857
874
)
858
875
}
859
876
@@ -862,6 +879,7 @@ fn new_unit_dep_with_profile(
862
879
parent : & Unit ,
863
880
pkg : & Package ,
864
881
target : & Target ,
882
+ rustflags : Vec < InternedString > ,
865
883
unit_for : UnitFor ,
866
884
kind : CompileKind ,
867
885
mode : CompileMode ,
@@ -885,6 +903,7 @@ fn new_unit_dep_with_profile(
885
903
kind,
886
904
mode,
887
905
features,
906
+ rustflags,
888
907
state. is_std ,
889
908
/*dep_hash*/ 0 ,
890
909
artifact. map_or ( IsArtifact :: No , |_| IsArtifact :: Yes ) ,
0 commit comments