File tree 5 files changed +30
-5
lines changed
5 files changed +30
-5
lines changed Original file line number Diff line number Diff line change 277
277
# compiler.
278
278
#codegen-units = 1
279
279
280
+ # Sets the number of codegen units to build the standard library with,
281
+ # regardless of what the codegen-unit setting for the rest of the compiler is.
282
+ #codegen-units-std = 1
283
+
280
284
# Whether or not debug assertions are enabled for the compiler and standard
281
285
# library. Also enables compilation of debug! and trace! logging macros.
282
286
#debug-assertions = false
Original file line number Diff line number Diff line change @@ -1119,10 +1119,15 @@ impl<'a> Builder<'a> {
1119
1119
cargo. arg ( "-v" ) ;
1120
1120
}
1121
1121
1122
- // This must be kept before the thinlto check, as we set codegen units
1123
- // to 1 forcibly there.
1124
- if let Some ( n) = self . config . rust_codegen_units {
1125
- cargo. env ( "RUSTC_CODEGEN_UNITS" , n. to_string ( ) ) ;
1122
+ match ( mode, self . config . rust_codegen_units_std , self . config . rust_codegen_units ) {
1123
+ ( Mode :: Std , Some ( n) , _) |
1124
+ ( Mode :: Test , Some ( n) , _) |
1125
+ ( _, _, Some ( n) ) => {
1126
+ cargo. env ( "RUSTC_CODEGEN_UNITS" , n. to_string ( ) ) ;
1127
+ }
1128
+ _ => {
1129
+ // Don't set anything
1130
+ }
1126
1131
}
1127
1132
1128
1133
if self . config . rust_optimize {
Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ pub struct Config {
95
95
// rust codegen options
96
96
pub rust_optimize : bool ,
97
97
pub rust_codegen_units : Option < u32 > ,
98
+ pub rust_codegen_units_std : Option < u32 > ,
98
99
pub rust_debug_assertions : bool ,
99
100
pub rust_debuginfo : bool ,
100
101
pub rust_debuginfo_lines : bool ,
@@ -294,6 +295,7 @@ impl Default for StringOrBool {
294
295
struct Rust {
295
296
optimize : Option < bool > ,
296
297
codegen_units : Option < u32 > ,
298
+ codegen_units_std : Option < u32 > ,
297
299
debug_assertions : Option < bool > ,
298
300
debuginfo : Option < bool > ,
299
301
debuginfo_lines : Option < bool > ,
@@ -580,6 +582,8 @@ impl Config {
580
582
Some ( n) => config. rust_codegen_units = Some ( n) ,
581
583
None => { }
582
584
}
585
+
586
+ config. rust_codegen_units_std = rust. codegen_units_std ;
583
587
}
584
588
585
589
if let Some ( ref t) = toml. target {
Original file line number Diff line number Diff line change @@ -393,6 +393,13 @@ def set(key, value):
393
393
targets [target ][0 ] = targets [target ][0 ].replace ("x86_64-unknown-linux-gnu" , target )
394
394
395
395
396
+ def is_number (value ):
397
+ try :
398
+ float (value )
399
+ return True
400
+ except :
401
+ return False
402
+
396
403
# Here we walk through the constructed configuration we have from the parsed
397
404
# command line arguments. We then apply each piece of configuration by
398
405
# basically just doing a `sed` to change the various configuration line to what
@@ -406,7 +413,11 @@ def to_toml(value):
406
413
elif isinstance (value , list ):
407
414
return '[' + ', ' .join (map (to_toml , value )) + ']'
408
415
elif isinstance (value , str ):
409
- return "'" + value + "'"
416
+ # Don't put quotes around numeric values
417
+ if is_number (value ):
418
+ return value
419
+ else :
420
+ return "'" + value + "'"
410
421
else :
411
422
raise RuntimeError ('no toml' )
412
423
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-sccache"
40
40
RUST_CONFIGURE_ARGS=" $RUST_CONFIGURE_ARGS --disable-manage-submodules"
41
41
RUST_CONFIGURE_ARGS=" $RUST_CONFIGURE_ARGS --enable-locked-deps"
42
42
RUST_CONFIGURE_ARGS=" $RUST_CONFIGURE_ARGS --enable-cargo-native-static"
43
+ RUST_CONFIGURE_ARGS=" $RUST_CONFIGURE_ARGS --set rust.codegen-units-std=1"
43
44
44
45
if [ " $DIST_SRC " = " " ]; then
45
46
RUST_CONFIGURE_ARGS=" $RUST_CONFIGURE_ARGS --disable-dist-src"
You can’t perform that action at this time.
0 commit comments