@@ -25,7 +25,7 @@ macro_rules! check_ci_llvm {
25
25
$name. is_none( ) ,
26
26
"setting {} is incompatible with download-ci-llvm." ,
27
27
stringify!( $name)
28
- ) ;
28
+ ) ;
29
29
} ;
30
30
}
31
31
@@ -89,6 +89,7 @@ pub struct Config {
89
89
pub llvm_skip_rebuild : bool ,
90
90
pub llvm_assertions : bool ,
91
91
pub llvm_tests : bool ,
92
+ pub llvm_enzyme : bool ,
92
93
pub llvm_plugins : bool ,
93
94
pub llvm_optimize : bool ,
94
95
pub llvm_thin_lto : bool ,
@@ -341,7 +342,7 @@ impl Merge for TomlConfig {
341
342
fn merge (
342
343
& mut self ,
343
344
TomlConfig { build, install, llvm, rust, dist, target, profile : _, changelog_seen : _ } : Self ,
344
- ) {
345
+ ) {
345
346
fn do_merge < T : Merge > ( x : & mut Option < T > , y : Option < T > ) {
346
347
if let Some ( new) = y {
347
348
if let Some ( original) = x {
@@ -367,17 +368,17 @@ macro_rules! define_config {
367
368
$( $field: ident: Option <$field_ty: ty> = $field_key: literal, ) *
368
369
} ) => {
369
370
$( #[ $attr] ) *
370
- struct $name {
371
- $( $field: Option <$field_ty>, ) *
372
- }
371
+ struct $name {
372
+ $( $field: Option <$field_ty>, ) *
373
+ }
373
374
374
375
impl Merge for $name {
375
376
fn merge( & mut self , other: Self ) {
376
377
$(
377
378
if !self . $field. is_some( ) {
378
379
self . $field = other. $field;
379
380
}
380
- ) *
381
+ ) *
381
382
}
382
383
}
383
384
@@ -386,64 +387,64 @@ macro_rules! define_config {
386
387
// compile time of rustbuild.
387
388
impl <' de> Deserialize <' de> for $name {
388
389
fn deserialize<D >( deserializer: D ) -> Result <Self , D :: Error >
389
- where
390
- D : Deserializer <' de>,
391
- {
392
- struct Field ;
393
- impl <' de> serde:: de:: Visitor <' de> for Field {
394
- type Value = $name;
395
- fn expecting( & self , f: & mut std:: fmt:: Formatter <' _>) -> std:: fmt:: Result {
396
- f. write_str( concat!( "struct " , stringify!( $name) ) )
397
- }
390
+ where
391
+ D : Deserializer <' de>,
392
+ {
393
+ struct Field ;
394
+ impl <' de> serde:: de:: Visitor <' de> for Field {
395
+ type Value = $name;
396
+ fn expecting( & self , f: & mut std:: fmt:: Formatter <' _>) -> std:: fmt:: Result {
397
+ f. write_str( concat!( "struct " , stringify!( $name) ) )
398
+ }
398
399
399
- #[ inline]
400
- fn visit_map<A >( self , mut map: A ) -> Result <Self :: Value , A :: Error >
401
- where
402
- A : serde:: de:: MapAccess <' de>,
403
- {
404
- $( let mut $field: Option <$field_ty> = None ; ) *
405
- while let Some ( key) =
406
- match serde:: de:: MapAccess :: next_key:: <String >( & mut map) {
407
- Ok ( val) => val,
408
- Err ( err) => {
409
- return Err ( err) ;
410
- }
411
- }
412
- {
413
- match & * key {
414
- $( $field_key => {
415
- if $field. is_some( ) {
416
- return Err ( <A :: Error as serde:: de:: Error >:: duplicate_field(
417
- $field_key,
418
- ) ) ;
419
- }
420
- $field = match serde:: de:: MapAccess :: next_value:: <$field_ty>(
421
- & mut map,
422
- ) {
423
- Ok ( val) => Some ( val) ,
424
- Err ( err) => {
425
- return Err ( err) ;
400
+ #[ inline]
401
+ fn visit_map<A >( self , mut map: A ) -> Result <Self :: Value , A :: Error >
402
+ where
403
+ A : serde:: de:: MapAccess <' de>,
404
+ {
405
+ $( let mut $field: Option <$field_ty> = None ; ) *
406
+ while let Some ( key) =
407
+ match serde:: de:: MapAccess :: next_key:: <String >( & mut map) {
408
+ Ok ( val) => val,
409
+ Err ( err) => {
410
+ return Err ( err) ;
411
+ }
412
+ }
413
+ {
414
+ match & * key {
415
+ $( $field_key => {
416
+ if $field. is_some( ) {
417
+ return Err ( <A :: Error as serde:: de:: Error >:: duplicate_field(
418
+ $field_key,
419
+ ) ) ;
420
+ }
421
+ $field = match serde:: de:: MapAccess :: next_value:: <$field_ty>(
422
+ & mut map,
423
+ ) {
424
+ Ok ( val) => Some ( val) ,
425
+ Err ( err) => {
426
+ return Err ( err) ;
427
+ }
428
+ } ;
429
+ } ) *
430
+ key => {
431
+ return Err ( serde:: de:: Error :: unknown_field( key, FIELDS ) ) ;
426
432
}
427
- } ;
428
- } ) *
429
- key => {
430
- return Err ( serde:: de:: Error :: unknown_field( key, FIELDS ) ) ;
433
+ }
431
434
}
435
+ Ok ( $name { $( $field) ,* } )
432
436
}
433
- }
434
- Ok ( $name { $( $field) ,* } )
435
437
}
438
+ const FIELDS : & ' static [ & ' static str ] = & [
439
+ $( $field_key, ) *
440
+ ] ;
441
+ Deserializer :: deserialize_struct(
442
+ deserializer,
443
+ stringify!( $name) ,
444
+ FIELDS ,
445
+ Field ,
446
+ )
436
447
}
437
- const FIELDS : & ' static [ & ' static str ] = & [
438
- $( $field_key, ) *
439
- ] ;
440
- Deserializer :: deserialize_struct(
441
- deserializer,
442
- stringify!( $name) ,
443
- FIELDS ,
444
- Field ,
445
- )
446
- }
447
448
}
448
449
}
449
450
}
@@ -515,6 +516,7 @@ define_config! {
515
516
release_debuginfo: Option <bool > = "release-debuginfo" ,
516
517
assertions: Option <bool > = "assertions" ,
517
518
tests: Option <bool > = "tests" ,
519
+ enzyme: Option <bool > = "enzyme" ,
518
520
plugins: Option <bool > = "plugins" ,
519
521
ccache: Option <StringOrBool > = "ccache" ,
520
522
version_check: Option <bool > = "version-check" ,
@@ -708,13 +710,13 @@ impl Config {
708
710
// TomlConfig and sub types to be monomorphized 5x by toml.
709
711
match toml:: from_str ( & contents)
710
712
. and_then ( |table : toml:: Value | TomlConfig :: deserialize ( table) )
711
- {
712
- Ok ( table) => table,
713
- Err ( err) => {
714
- println ! ( "failed to parse TOML configuration '{}': {}" , file. display( ) , err) ;
715
- process:: exit ( 2 ) ;
713
+ {
714
+ Ok ( table) => table,
715
+ Err ( err) => {
716
+ println ! ( "failed to parse TOML configuration '{}': {}" , file. display( ) , err) ;
717
+ process:: exit ( 2 ) ;
718
+ }
716
719
}
717
- }
718
720
} ;
719
721
720
722
// Read from `--config`, then `RUST_BOOTSTRAP_CONFIG`, then `./config.toml`, then `config.toml` in the root directory.
@@ -831,6 +833,7 @@ impl Config {
831
833
// we'll infer default values for them later
832
834
let mut llvm_assertions = None ;
833
835
let mut llvm_tests = None ;
836
+ let mut llvm_enzyme = None ;
834
837
let mut llvm_plugins = None ;
835
838
let mut debug = None ;
836
839
let mut debug_assertions = None ;
@@ -857,6 +860,7 @@ impl Config {
857
860
set ( & mut config. ninja_in_file , llvm. ninja ) ;
858
861
llvm_assertions = llvm. assertions ;
859
862
llvm_tests = llvm. tests ;
863
+ llvm_enzyme = llvm. enzyme ;
860
864
llvm_plugins = llvm. plugins ;
861
865
llvm_skip_rebuild = llvm_skip_rebuild. or ( llvm. skip_rebuild ) ;
862
866
set ( & mut config. llvm_optimize , llvm. optimize ) ;
@@ -917,7 +921,7 @@ impl Config {
917
921
"x86_64-unknown-illumos" ,
918
922
"x86_64-unknown-linux-musl" ,
919
923
"x86_64-unknown-netbsd" ,
920
- ] ;
924
+ ] ;
921
925
supported_platforms. contains ( & & * config. build . triple )
922
926
}
923
927
Some ( StringOrBool :: Bool ( b) ) => b,
@@ -950,6 +954,7 @@ impl Config {
950
954
check_ci_llvm ! ( llvm. polly) ;
951
955
check_ci_llvm ! ( llvm. clang) ;
952
956
check_ci_llvm ! ( llvm. build_config) ;
957
+ check_ci_llvm ! ( llvm. enzyme) ;
953
958
check_ci_llvm ! ( llvm. plugins) ;
954
959
955
960
// CI-built LLVM can be either dynamic or static.
@@ -961,7 +966,7 @@ impl Config {
961
966
let link_type = t ! (
962
967
std:: fs:: read_to_string( ci_llvm. join( "link-type.txt" ) ) ,
963
968
format!( "CI llvm missing: {}" , ci_llvm. display( ) )
964
- ) ;
969
+ ) ;
965
970
link_type == "dynamic"
966
971
} ;
967
972
}
@@ -1111,6 +1116,7 @@ impl Config {
1111
1116
config. llvm_skip_rebuild = llvm_skip_rebuild. unwrap_or ( false ) ;
1112
1117
config. llvm_assertions = llvm_assertions. unwrap_or ( false ) ;
1113
1118
config. llvm_tests = llvm_tests. unwrap_or ( false ) ;
1119
+ config. llvm_enzyme = llvm_enzyme. unwrap_or ( false ) ;
1114
1120
config. llvm_plugins = llvm_plugins. unwrap_or ( false ) ;
1115
1121
config. rust_optimize = optimize. unwrap_or ( true ) ;
1116
1122
@@ -1180,7 +1186,7 @@ impl Config {
1180
1186
config. stage, 2 ,
1181
1187
"x.py should be run with `--stage 2` on CI, but was run with `--stage {}`" ,
1182
1188
config. stage,
1183
- ) ;
1189
+ ) ;
1184
1190
}
1185
1191
Subcommand :: Clean { .. }
1186
1192
| Subcommand :: Check { .. }
0 commit comments