@@ -433,6 +433,7 @@ pub enum U32OrBool {
433
433
pub struct TomlProfile {
434
434
pub opt_level : Option < TomlOptLevel > ,
435
435
pub lto : Option < StringOrBool > ,
436
+ pub codegen_backend : Option < InternedString > ,
436
437
pub codegen_units : Option < u32 > ,
437
438
pub debug : Option < U32OrBool > ,
438
439
pub split_debuginfo : Option < String > ,
@@ -491,12 +492,12 @@ impl TomlProfile {
491
492
) -> CargoResult < ( ) > {
492
493
if let Some ( ref profile) = self . build_override {
493
494
features. require ( Feature :: profile_overrides ( ) ) ?;
494
- profile. validate_override ( "build-override" ) ?;
495
+ profile. validate_override ( "build-override" , features ) ?;
495
496
}
496
497
if let Some ( ref packages) = self . package {
497
498
features. require ( Feature :: profile_overrides ( ) ) ?;
498
499
for profile in packages. values ( ) {
499
- profile. validate_override ( "package" ) ?;
500
+ profile. validate_override ( "package" , features ) ?;
500
501
}
501
502
}
502
503
@@ -562,6 +563,11 @@ impl TomlProfile {
562
563
if self . strip . is_some ( ) {
563
564
features. require ( Feature :: strip ( ) ) ?;
564
565
}
566
+
567
+ if self . codegen_backend . is_some ( ) {
568
+ features. require ( Feature :: codegen_backend ( ) ) ?;
569
+ }
570
+
565
571
Ok ( ( ) )
566
572
}
567
573
@@ -642,7 +648,7 @@ impl TomlProfile {
642
648
Ok ( ( ) )
643
649
}
644
650
645
- fn validate_override ( & self , which : & str ) -> CargoResult < ( ) > {
651
+ fn validate_override ( & self , which : & str , features : & Features ) -> CargoResult < ( ) > {
646
652
if self . package . is_some ( ) {
647
653
bail ! ( "package-specific profiles cannot be nested" ) ;
648
654
}
@@ -658,6 +664,9 @@ impl TomlProfile {
658
664
if self . rpath . is_some ( ) {
659
665
bail ! ( "`rpath` may not be specified in a `{}` profile" , which)
660
666
}
667
+ if self . codegen_backend . is_some ( ) {
668
+ features. require ( Feature :: codegen_backend ( ) ) ?;
669
+ }
661
670
Ok ( ( ) )
662
671
}
663
672
@@ -671,6 +680,10 @@ impl TomlProfile {
671
680
self . lto = Some ( v. clone ( ) ) ;
672
681
}
673
682
683
+ if let Some ( v) = profile. codegen_backend {
684
+ self . codegen_backend = Some ( v) ;
685
+ }
686
+
674
687
if let Some ( v) = profile. codegen_units {
675
688
self . codegen_units = Some ( v) ;
676
689
}
0 commit comments