@@ -55,6 +55,8 @@ struct UnitGraphUnit {
55
55
/// `artifact_outputs` with it instead of `src_path`.
56
56
pkg_id : String ,
57
57
target : Target ,
58
+ #[ serde( default ) ]
59
+ is_std : bool ,
58
60
dependencies : Vec < UnitGraphDependency > ,
59
61
}
60
62
@@ -166,6 +168,10 @@ struct CustomTargetLib {
166
168
cfgs : Vec < String > ,
167
169
/// environment variables
168
170
env : Vec < ( String , String ) > ,
171
+ /// Whether this library is one of the standard libraries (not necessarily
172
+ /// `std` specifically). Used to determine whether to pass
173
+ /// standard-library-specific flags.
174
+ is_stdlib : bool ,
169
175
}
170
176
171
177
impl CustomTarget < CustomTargetLib > {
@@ -666,6 +672,7 @@ fn main() {
666
672
. chain ( cfgs)
667
673
. collect ( ) ,
668
674
env,
675
+ is_stdlib : unit. is_std ,
669
676
}
670
677
} ) ,
671
678
dependencies : unit. dependencies ,
@@ -699,6 +706,7 @@ fn main() {
699
706
linked_paths : vec ! [ ] ,
700
707
cfgs : vec ! [ ] ,
701
708
env : vec ! [ ] ,
709
+ is_stdlib : false ,
702
710
} ,
703
711
vec ! [ dep_compiler_builtins. clone( ) , dep_core. clone( ) ] ,
704
712
) ;
@@ -719,6 +727,7 @@ fn main() {
719
727
linked_paths : vec ! [ ] ,
720
728
cfgs : vec ! [ ] ,
721
729
env : vec ! [ ] ,
730
+ is_stdlib : false ,
722
731
} ) ,
723
732
dependencies : vec ! [ dep_core. clone( ) , dep_compiler_builtins. clone( ) ] ,
724
733
} ) ;
@@ -733,6 +742,7 @@ fn main() {
733
742
linked_paths : vec ! [ ] ,
734
743
cfgs : vec ! [ ] ,
735
744
env : vec ! [ ] ,
745
+ is_stdlib : false ,
736
746
} ) ,
737
747
dependencies : vec ! [
738
748
dep_core. clone( ) ,
@@ -759,6 +769,7 @@ fn main() {
759
769
linked_paths : vec ! [ ] ,
760
770
cfgs : vec ! [ "feature=\" std\" " . into( ) ] ,
761
771
env : vec ! [ ] ,
772
+ is_stdlib : false ,
762
773
} ) ,
763
774
dependencies : vec ! [ dep_core, dep_std, dep_compiler_builtins] ,
764
775
} ) ;
@@ -801,16 +812,6 @@ fn main() {
801
812
. map ( |lib| CmdInvocation {
802
813
program : "mir-json" . into ( ) ,
803
814
args : {
804
- // Stdlib crates need `-Z force-unstable-if-unmarked` to
805
- // make stability attributes work properly. But `crucible`
806
- // must not be built with this flag, since the flag makes
807
- // everything unstable by default, requiring users to use
808
- // `#[feature(rustc_private)]`.
809
- let enable_stability_attrs =
810
- !( & * lib. target . crate_name == EXTRA_LIB_CRUCIBLE
811
- || & * lib. target . crate_name == EXTRA_LIB_INT512
812
- || & * lib. target . crate_name == EXTRA_LIB_BYTES
813
- || & * lib. target . crate_name == EXTRA_LIB_BYTEORDER ) ;
814
815
let mut args = vec ! [
815
816
lib. target. src_path. into( ) ,
816
817
"--edition" . into( ) ,
@@ -840,7 +841,12 @@ fn main() {
840
841
args. push ( "rlib" . into ( ) ) ;
841
842
args. push ( "--remap-path-prefix" . into ( ) ) ;
842
843
args. push ( format ! ( "{}=." , cwd) ) ;
843
- if enable_stability_attrs {
844
+ // Stdlib crates need `-Z force-unstable-if-unmarked` to
845
+ // make stability attributes work properly. But the extra
846
+ // libs must not be built with this flag, since the flag
847
+ // makes everything unstable by default, requiring users to
848
+ // use `#[feature(rustc_private)]`.
849
+ if lib. target . is_stdlib {
844
850
args. push ( "-Z" . into ( ) ) ;
845
851
args. push ( "force-unstable-if-unmarked" . into ( ) ) ;
846
852
}
0 commit comments