File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -165,10 +165,6 @@ fn main() {
165
165
cmd. arg ( "-C" ) . arg ( format ! ( "debug-assertions={}" , debug_assertions) ) ;
166
166
}
167
167
168
- if let Ok ( s) = env:: var ( "RUSTC_CODEGEN_UNITS" ) {
169
- cmd. arg ( "-C" ) . arg ( format ! ( "codegen-units={}" , s) ) ;
170
- }
171
-
172
168
if let Ok ( map) = env:: var ( "RUSTC_DEBUGINFO_MAP" ) {
173
169
cmd. arg ( "--remap-path-prefix" ) . arg ( & map) ;
174
170
}
Original file line number Diff line number Diff line change @@ -774,7 +774,17 @@ impl<'a> Builder<'a> {
774
774
775
775
cargo
776
776
. env ( "CARGO_TARGET_DIR" , out_dir)
777
- . arg ( cmd) ;
777
+ . arg ( cmd)
778
+ . arg ( "-Zconfig-profile" ) ;
779
+
780
+ let profile_var = |name : & str | {
781
+ let profile = if self . config . rust_optimize {
782
+ "RELEASE"
783
+ } else {
784
+ "DEV"
785
+ } ;
786
+ format ! ( "CARGO_PROFILE_{}_{}" , profile, name)
787
+ } ;
778
788
779
789
// See comment in librustc_llvm/build.rs for why this is necessary, largely llvm-config
780
790
// needs to not accidentally link to libLLVM in stage0/lib.
@@ -1190,7 +1200,7 @@ impl<'a> Builder<'a> {
1190
1200
match ( mode, self . config . rust_codegen_units_std , self . config . rust_codegen_units ) {
1191
1201
( Mode :: Std , Some ( n) , _) |
1192
1202
( _, _, Some ( n) ) => {
1193
- cargo. env ( "RUSTC_CODEGEN_UNITS" , n. to_string ( ) ) ;
1203
+ cargo. env ( profile_var ( "CODEGEN_UNITS" ) , n. to_string ( ) ) ;
1194
1204
}
1195
1205
_ => {
1196
1206
// Don't set anything
You can’t perform that action at this time.
0 commit comments