File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -2162,6 +2162,7 @@ impl Config {
21622162 extra_test_bin_args : self . runnables_extraTestBinaryArgs ( source_root) . clone ( ) ,
21632163 extra_env : self . extra_env ( source_root) . clone ( ) ,
21642164 target_dir : self . target_dir_from_config ( source_root) ,
2165+ set_test : true ,
21652166 }
21662167 }
21672168
@@ -2219,6 +2220,7 @@ impl Config {
22192220 extra_test_bin_args : self . runnables_extraTestBinaryArgs ( source_root) . clone ( ) ,
22202221 extra_env : self . check_extra_env ( source_root) ,
22212222 target_dir : self . target_dir_from_config ( source_root) ,
2223+ set_test : * self . cfg_setTest ( source_root) ,
22222224 } ,
22232225 ansi_color_output : self . color_diagnostic_output ( ) ,
22242226 } ,
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ pub(crate) enum InvocationStrategy {
3131pub ( crate ) struct CargoOptions {
3232 pub ( crate ) target_tuples : Vec < String > ,
3333 pub ( crate ) all_targets : bool ,
34+ pub ( crate ) set_test : bool ,
3435 pub ( crate ) no_default_features : bool ,
3536 pub ( crate ) all_features : bool ,
3637 pub ( crate ) features : Vec < String > ,
@@ -54,7 +55,13 @@ impl CargoOptions {
5455 cmd. args ( [ "--target" , target. as_str ( ) ] ) ;
5556 }
5657 if self . all_targets {
57- cmd. arg ( "--all-targets" ) ;
58+ if self . set_test {
59+ cmd. arg ( "--all-targets" ) ;
60+ } else {
61+ // No --benches unfortunately, as this implies --tests (see https://github.com/rust-lang/cargo/issues/6454),
62+ // and users setting `cfg.seTest = false` probably prefer disabling benches than enabling tests.
63+ cmd. args ( [ "--lib" , "--bins" , "--examples" ] ) ;
64+ }
5865 }
5966 if self . all_features {
6067 cmd. arg ( "--all-features" ) ;
You can’t perform that action at this time.
0 commit comments