@@ -267,6 +267,10 @@ fn build_clif_sysroot_for_triple(
267267 prefix. to_str( ) . unwrap( )
268268 ) ) ;
269269 }
270+ rustflags. push ( "-Zunstable-options" . to_owned ( ) ) ;
271+ for ( name, values) in EXTRA_CHECK_CFGS {
272+ rustflags. push ( check_cfg_arg ( name, * values) ) ;
273+ }
270274 compiler. rustflags . extend ( rustflags) ;
271275 let mut build_cmd = STANDARD_LIBRARY . build ( & compiler, dirs) ;
272276 if channel == "release" {
@@ -326,3 +330,34 @@ fn build_rtstartup(dirs: &Dirs, compiler: &Compiler) -> Option<SysrootTarget> {
326330
327331 Some ( target_libs)
328332}
333+
334+ // Copied from https://github.com/rust-lang/rust/blob/4fd98a4b1b100f5329c6efae18031791f64372d2/src/bootstrap/src/utils/helpers.rs#L569-L585
335+ /// Create a `--check-cfg` argument invocation for a given name
336+ /// and it's values.
337+ fn check_cfg_arg ( name : & str , values : Option < & [ & str ] > ) -> String {
338+ // Creating a string of the values by concatenating each value:
339+ // ',values("tvos","watchos")' or '' (nothing) when there are no values.
340+ let next = match values {
341+ Some ( values) => {
342+ let mut tmp = values. iter ( ) . flat_map ( |val| [ "," , "\" " , val, "\" " ] ) . collect :: < String > ( ) ;
343+
344+ tmp. insert_str ( 1 , "values(" ) ;
345+ tmp. push ( ')' ) ;
346+ tmp
347+ }
348+ None => "" . to_string ( ) ,
349+ } ;
350+ format ! ( "--check-cfg=cfg({name}{next})" )
351+ }
352+
353+ const EXTRA_CHECK_CFGS : & [ ( & str , Option < & [ & str ] > ) ] = & [
354+ ( "bootstrap" , None ) ,
355+ ( "stdarch_intel_sde" , None ) ,
356+ ( "no_fp_fmt_parse" , None ) ,
357+ ( "no_global_oom_handling" , None ) ,
358+ ( "no_rc" , None ) ,
359+ ( "no_sync" , None ) ,
360+ ( "netbsd10" , None ) ,
361+ ( "backtrace_in_libstd" , None ) ,
362+ ( "target_arch" , Some ( & [ "xtensa" ] ) ) ,
363+ ] ;
0 commit comments