@@ -1203,37 +1203,39 @@ impl Config {
1203
1203
}
1204
1204
}
1205
1205
1206
- pub fn parse ( flags : Flags ) -> Config {
1207
- #[ cfg( test) ]
1208
- fn get_toml ( _: & Path ) -> TomlConfig {
1209
- TomlConfig :: default ( )
1210
- }
1206
+ #[ cfg( test) ]
1207
+ fn get_toml ( _: & Path ) -> TomlConfig {
1208
+ TomlConfig :: default ( )
1209
+ }
1211
1210
1212
- #[ cfg( not( test) ) ]
1213
- fn get_toml ( file : & Path ) -> TomlConfig {
1214
- let contents =
1215
- t ! ( fs:: read_to_string( file) , format!( "config file {} not found" , file. display( ) ) ) ;
1216
- // Deserialize to Value and then TomlConfig to prevent the Deserialize impl of
1217
- // TomlConfig and sub types to be monomorphized 5x by toml.
1218
- toml:: from_str ( & contents)
1219
- . and_then ( |table : toml:: Value | TomlConfig :: deserialize ( table) )
1220
- . unwrap_or_else ( |err| {
1221
- if let Ok ( Some ( changes) ) = toml:: from_str ( & contents)
1222
- . and_then ( |table : toml:: Value | ChangeIdWrapper :: deserialize ( table) ) . map ( |change_id| change_id . inner . map ( crate :: find_recent_config_change_ids ) )
1223
- {
1224
- if !changes . is_empty ( ) {
1225
- println ! (
1226
- "WARNING: There have been changes to x.py since you last updated: \n {}" ,
1227
- crate :: human_readable_changes ( & changes)
1228
- ) ;
1229
- }
1211
+ #[ cfg( not( test) ) ]
1212
+ fn get_toml ( file : & Path ) -> TomlConfig {
1213
+ let contents =
1214
+ t ! ( fs:: read_to_string( file) , format!( "config file {} not found" , file. display( ) ) ) ;
1215
+ // Deserialize to Value and then TomlConfig to prevent the Deserialize impl of
1216
+ // TomlConfig and sub types to be monomorphized 5x by toml.
1217
+ toml:: from_str ( & contents)
1218
+ . and_then ( |table : toml:: Value | TomlConfig :: deserialize ( table) )
1219
+ . unwrap_or_else ( |err| {
1220
+ if let Ok ( Some ( changes) ) = toml:: from_str ( & contents)
1221
+ . and_then ( |table : toml:: Value | ChangeIdWrapper :: deserialize ( table) )
1222
+ . map ( |change_id| change_id . inner . map ( crate :: find_recent_config_change_ids ) )
1223
+ {
1224
+ if !changes . is_empty ( ) {
1225
+ println ! (
1226
+ "WARNING: There have been changes to x.py since you last updated: \n {}" ,
1227
+ crate :: human_readable_changes ( & changes )
1228
+ ) ;
1230
1229
}
1230
+ }
1231
1231
1232
- eprintln ! ( "failed to parse TOML configuration '{}': {err}" , file. display( ) ) ;
1233
- exit ! ( 2 ) ;
1234
- } )
1235
- }
1236
- Self :: parse_inner ( flags, get_toml)
1232
+ eprintln ! ( "failed to parse TOML configuration '{}': {err}" , file. display( ) ) ;
1233
+ exit ! ( 2 ) ;
1234
+ } )
1235
+ }
1236
+
1237
+ pub fn parse ( flags : Flags ) -> Config {
1238
+ Self :: parse_inner ( flags, Self :: get_toml)
1237
1239
}
1238
1240
1239
1241
pub ( crate ) fn parse_inner ( mut flags : Flags , get_toml : impl Fn ( & Path ) -> TomlConfig ) -> Config {
@@ -2668,21 +2670,21 @@ fn check_incompatible_options_for_ci_rustc(rust: &Rust) -> Result<(), String> {
2668
2670
macro_rules! err {
2669
2671
( $name: expr) => {
2670
2672
if $name. is_some( ) {
2671
- return Err ( format!(
2672
- "ERROR: Setting `rust.{}` is incompatible with `rust.download-rustc`." ,
2673
+ return Err ( format!(
2674
+ "ERROR: Setting `rust.{}` is incompatible with `rust.download-rustc`." ,
2673
2675
stringify!( $name) . replace( "_" , "-" )
2674
- ) ) ;
2676
+ ) ) ;
2675
2677
}
2676
2678
} ;
2677
2679
}
2678
2680
2679
2681
macro_rules! warn {
2680
2682
( $name: expr) => {
2681
2683
if $name. is_some( ) {
2682
- println!(
2683
- "WARNING: `rust.{}` has no effect with `rust.download-rustc`." ,
2684
+ println!(
2685
+ "WARNING: `rust.{}` has no effect with `rust.download-rustc`." ,
2684
2686
stringify!( $name) . replace( "_" , "-" )
2685
- ) ;
2687
+ ) ;
2686
2688
}
2687
2689
} ;
2688
2690
}
0 commit comments