@@ -433,6 +433,7 @@ pub enum U32OrBool {
433433pub struct TomlProfile {
434434 pub opt_level : Option < TomlOptLevel > ,
435435 pub lto : Option < StringOrBool > ,
436+ pub codegen_backend : Option < InternedString > ,
436437 pub codegen_units : Option < u32 > ,
437438 pub debug : Option < U32OrBool > ,
438439 pub split_debuginfo : Option < String > ,
@@ -491,12 +492,12 @@ impl TomlProfile {
491492 ) -> CargoResult < ( ) > {
492493 if let Some ( ref profile) = self . build_override {
493494 features. require ( Feature :: profile_overrides ( ) ) ?;
494- profile. validate_override ( "build-override" ) ?;
495+ profile. validate_override ( "build-override" , features ) ?;
495496 }
496497 if let Some ( ref packages) = self . package {
497498 features. require ( Feature :: profile_overrides ( ) ) ?;
498499 for profile in packages. values ( ) {
499- profile. validate_override ( "package" ) ?;
500+ profile. validate_override ( "package" , features ) ?;
500501 }
501502 }
502503
@@ -562,6 +563,11 @@ impl TomlProfile {
562563 if self . strip . is_some ( ) {
563564 features. require ( Feature :: strip ( ) ) ?;
564565 }
566+
567+ if self . codegen_backend . is_some ( ) {
568+ features. require ( Feature :: codegen_backend ( ) ) ?;
569+ }
570+
565571 Ok ( ( ) )
566572 }
567573
@@ -642,7 +648,7 @@ impl TomlProfile {
642648 Ok ( ( ) )
643649 }
644650
645- fn validate_override ( & self , which : & str ) -> CargoResult < ( ) > {
651+ fn validate_override ( & self , which : & str , features : & Features ) -> CargoResult < ( ) > {
646652 if self . package . is_some ( ) {
647653 bail ! ( "package-specific profiles cannot be nested" ) ;
648654 }
@@ -658,6 +664,9 @@ impl TomlProfile {
658664 if self . rpath . is_some ( ) {
659665 bail ! ( "`rpath` may not be specified in a `{}` profile" , which)
660666 }
667+ if self . codegen_backend . is_some ( ) {
668+ features. require ( Feature :: codegen_backend ( ) ) ?;
669+ }
661670 Ok ( ( ) )
662671 }
663672
@@ -671,6 +680,10 @@ impl TomlProfile {
671680 self . lto = Some ( v. clone ( ) ) ;
672681 }
673682
683+ if let Some ( v) = profile. codegen_backend {
684+ self . codegen_backend = Some ( v) ;
685+ }
686+
674687 if let Some ( v) = profile. codegen_units {
675688 self . codegen_units = Some ( v) ;
676689 }
0 commit comments