@@ -17,6 +17,9 @@ use anyhow::{bail, Context, Result};
17
17
use tempfile:: TempDir ;
18
18
use walkdir:: WalkDir ;
19
19
20
+ /// The name of the profile used for buliding the sysroot.
21
+ const DEFAULT_SYSROOT_PROFILE : & str = "custom_sysroot" ;
22
+
20
23
/// Returns where the given rustc stores its sysroot source code.
21
24
pub fn rustc_sysroot_src ( mut rustc : Command ) -> Result < PathBuf > {
22
25
let output = rustc
@@ -347,6 +350,13 @@ version = "0.0.0"
347
350
# empty dummy, just so that things are being built
348
351
path = "lib.rs"
349
352
353
+ [profile.{DEFAULT_SYSROOT_PROFILE}]
354
+ # While it says "inherits", we override all settings.
355
+ # This is to insulate us from any custom release profile.
356
+ # The only reason we use inherits is because it's required.
357
+ inherits = "release"
358
+ panic = 'unwind'
359
+
350
360
{crates}
351
361
352
362
{patches}
@@ -426,7 +436,8 @@ path = "lib.rs"
426
436
// Run cargo.
427
437
let mut cmd = cargo;
428
438
cmd. arg ( self . mode . as_str ( ) ) ;
429
- cmd. arg ( "--release" ) ;
439
+ cmd. arg ( "--profile" ) ;
440
+ cmd. arg ( DEFAULT_SYSROOT_PROFILE ) ;
430
441
cmd. arg ( "--manifest-path" ) ;
431
442
cmd. arg ( & manifest_file) ;
432
443
cmd. arg ( "--target" ) ;
@@ -458,7 +469,7 @@ path = "lib.rs"
458
469
TempDir :: new_in ( & self . sysroot_dir ) . context ( "failed to create staging dir" ) ?;
459
470
let out_dir = build_target_dir
460
471
. join ( & target_name)
461
- . join ( "release" )
472
+ . join ( DEFAULT_SYSROOT_PROFILE )
462
473
. join ( "deps" ) ;
463
474
for entry in fs:: read_dir ( & out_dir) . context ( "failed to read cargo out dir" ) ? {
464
475
let entry = entry. context ( "failed to read cargo out dir entry" ) ?;
0 commit comments