@@ -249,15 +249,20 @@ fn setup(ask_user: bool) {
249
249
println ! ( "Installing xargo: `cargo install xargo -f`" ) ;
250
250
}
251
251
252
- if !cargo ( ) . args ( & [ "install" , "xargo" , "-f" ] ) . status ( ) . unwrap ( ) . success ( ) {
252
+ if !cargo ( ) . args ( & [ "install" , "xargo" , "-f" ] ) . status ( )
253
+ . expect ( "failed to install xargo" )
254
+ . success ( )
255
+ {
253
256
show_error ( format ! ( "Failed to install xargo" ) ) ;
254
257
}
255
258
}
256
259
257
260
// Then, unless `XARGO_RUST_SRC` is set, we also need rust-src.
258
261
// Let's see if it is already installed.
259
262
if std:: env:: var ( "XARGO_RUST_SRC" ) . is_err ( ) {
260
- let sysroot = Command :: new ( "rustc" ) . args ( & [ "--print" , "sysroot" ] ) . output ( ) . unwrap ( ) . stdout ;
263
+ let sysroot = Command :: new ( "rustc" ) . args ( & [ "--print" , "sysroot" ] ) . output ( )
264
+ . expect ( "failed to get rustc sysroot" )
265
+ . stdout ;
261
266
let sysroot = std:: str:: from_utf8 ( & sysroot) . unwrap ( ) ;
262
267
let src = Path :: new ( sysroot. trim_end_matches ( '\n' ) ) . join ( "lib" ) . join ( "rustlib" ) . join ( "src" ) ;
263
268
if !src. exists ( ) {
@@ -266,7 +271,10 @@ fn setup(ask_user: bool) {
266
271
} else {
267
272
println ! ( "Installing rust-src component: `rustup component add rust-src`" ) ;
268
273
}
269
- if !Command :: new ( "rustup" ) . args ( & [ "component" , "add" , "rust-src" ] ) . status ( ) . unwrap ( ) . success ( ) {
274
+ if !Command :: new ( "rustup" ) . args ( & [ "component" , "add" , "rust-src" ] ) . status ( )
275
+ . expect ( "failed to install rust-src component" )
276
+ . success ( )
277
+ {
270
278
show_error ( format ! ( "Failed to install rust-src component" ) ) ;
271
279
}
272
280
}
@@ -302,18 +310,24 @@ version = "0.0.0"
302
310
path = "lib.rs"
303
311
"# ) . unwrap ( ) ;
304
312
File :: create ( dir. join ( "lib.rs" ) ) . unwrap ( ) ;
305
- // Run xargo.
313
+ // Prepare xargo invocation .
306
314
let target = get_arg_flag_value ( "--target" ) ;
307
315
let print_env = !ask_user && has_arg_flag ( "--env" ) ; // whether we just print the necessary environment variable
308
316
let mut command = xargo ( ) ;
309
- command. arg ( "build" ) . arg ( "-q" )
310
- . current_dir ( & dir)
311
- . env ( "RUSTFLAGS" , miri:: miri_default_args ( ) . join ( " " ) )
312
- . env ( "XARGO_HOME" , dir. to_str ( ) . unwrap ( ) ) ;
317
+ command. arg ( "build" ) . arg ( "-q" ) ;
318
+ command. current_dir ( & dir) ;
319
+ command. env ( "RUSTFLAGS" , miri:: miri_default_args ( ) . join ( " " ) ) ;
320
+ command. env ( "XARGO_HOME" , dir. to_str ( ) . unwrap ( ) ) ;
321
+ // In bootstrap, make sure we don't get debug assertons into our libstd.
322
+ command. env ( "RUSTC_DEBUG_ASSERTIONS" , "false" ) ;
323
+ // Handle target flag.
313
324
if let Some ( ref target) = target {
314
325
command. arg ( "--target" ) . arg ( & target) ;
315
326
}
316
- if !command. status ( ) . unwrap ( ) . success ( )
327
+ // Finally run it!
328
+ if !command. status ( )
329
+ . expect ( "failed to run xargo" )
330
+ . success ( )
317
331
{
318
332
show_error ( format ! ( "Failed to run xargo" ) ) ;
319
333
}
0 commit comments