@@ -173,7 +173,7 @@ fn run_cargo(
173
173
false ,
174
174
& [ ] ,
175
175
false ,
176
- false ,
176
+ opts . all_targets ,
177
177
) ,
178
178
features : & opts. features ,
179
179
all_features : opts. all_features ,
@@ -413,7 +413,13 @@ impl Executor for RlsExecutor {
413
413
// Because we only try to emulate `cargo test` using `cargo check`, so for now
414
414
// assume crate_type arg (i.e. in `cargo test` it isn't specified for --test targets)
415
415
// and build test harness only for final crate type
416
- let crate_type = crate_type. expect ( "no crate-type in rustc command line" ) ;
416
+ let crate_type = if config. all_targets {
417
+ // Crate type may be undefined when `all_targets` is true, for example for integration tests
418
+ crate_type. unwrap_or ( "undefined" . to_owned ( ) )
419
+ } else {
420
+ // Panic if crate type undefined for other cases
421
+ crate_type. expect ( "no crate-type in rustc command line" )
422
+ } ;
417
423
let build_lib = * config. build_lib . as_ref ( ) ;
418
424
let is_final_crate_type = crate_type == "bin" || ( crate_type == "lib" && build_lib) ;
419
425
@@ -512,6 +518,7 @@ struct CargoOptions {
512
518
no_default_features : bool ,
513
519
features : Vec < String > ,
514
520
jobs : Option < u32 > ,
521
+ all_targets : bool ,
515
522
}
516
523
517
524
impl Default for CargoOptions {
@@ -525,6 +532,7 @@ impl Default for CargoOptions {
525
532
no_default_features : false ,
526
533
features : vec ! [ ] ,
527
534
jobs : None ,
535
+ all_targets : false
528
536
}
529
537
}
530
538
}
@@ -538,6 +546,7 @@ impl CargoOptions {
538
546
all_features : config. all_features ,
539
547
no_default_features : config. no_default_features ,
540
548
jobs : config. jobs ,
549
+ all_targets : config. all_targets ,
541
550
..CargoOptions :: default ( )
542
551
}
543
552
} else {
@@ -562,6 +571,7 @@ impl CargoOptions {
562
571
all_features : config. all_features ,
563
572
no_default_features : config. no_default_features ,
564
573
jobs : config. jobs ,
574
+ all_targets : config. all_targets ,
565
575
..CargoOptions :: default ( )
566
576
}
567
577
}
0 commit comments