@@ -500,7 +500,7 @@ impl ProfileMaker {
500
500
is_member : bool ,
501
501
unit_for : UnitFor ,
502
502
) -> Profile {
503
- let mut profile = self . default ;
503
+ let mut profile = self . default . clone ( ) ;
504
504
505
505
// First apply profile-specific settings, things like
506
506
// `[profile.release]`
@@ -626,6 +626,9 @@ fn merge_profile(profile: &mut Profile, toml: &TomlProfile) {
626
626
if let Some ( incremental) = toml. incremental {
627
627
profile. incremental = incremental;
628
628
}
629
+ if let Some ( flags) = & toml. rustflags {
630
+ profile. rustflags = flags. clone ( ) ;
631
+ }
629
632
profile. strip = match toml. strip {
630
633
Some ( StringOrBool :: Bool ( true ) ) => Strip :: Named ( InternedString :: new ( "symbols" ) ) ,
631
634
None | Some ( StringOrBool :: Bool ( false ) ) => Strip :: None ,
@@ -647,7 +650,7 @@ pub enum ProfileRoot {
647
650
648
651
/// Profile settings used to determine which compiler flags to use for a
649
652
/// target.
650
- #[ derive( Clone , Copy , Eq , PartialOrd , Ord , serde:: Serialize ) ]
653
+ #[ derive( Clone , Eq , PartialOrd , Ord , serde:: Serialize ) ]
651
654
pub struct Profile {
652
655
pub name : InternedString ,
653
656
pub opt_level : InternedString ,
@@ -666,6 +669,9 @@ pub struct Profile {
666
669
pub incremental : bool ,
667
670
pub panic : PanicStrategy ,
668
671
pub strip : Strip ,
672
+ #[ serde( skip_serializing_if = "Vec::is_empty" ) ] // remove when `rustflags` is stablized
673
+ // Note that `rustflags` is used for the cargo-feature `profile_rustflags`
674
+ pub rustflags : Vec < InternedString > ,
669
675
}
670
676
671
677
impl Default for Profile {
@@ -685,6 +691,7 @@ impl Default for Profile {
685
691
incremental : false ,
686
692
panic : PanicStrategy :: Unwind ,
687
693
strip : Strip :: None ,
694
+ rustflags : vec ! [ ] ,
688
695
}
689
696
}
690
697
}
@@ -712,6 +719,7 @@ compact_debug! {
712
719
incremental
713
720
panic
714
721
strip
722
+ rustflags
715
723
) ]
716
724
}
717
725
}
0 commit comments