File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -634,7 +634,12 @@ fn toml_targets_and_inferred(
634
634
) -> Vec < TomlTarget > {
635
635
let inferred_targets = inferred_to_toml_targets ( inferred) ;
636
636
match toml_targets {
637
- None => inferred_targets,
637
+ None =>
638
+ if let Some ( false ) = autodiscover {
639
+ vec ! [ ]
640
+ } else {
641
+ inferred_targets
642
+ } ,
638
643
Some ( targets) => {
639
644
let mut targets = targets. clone ( ) ;
640
645
Original file line number Diff line number Diff line change @@ -463,6 +463,28 @@ fn run_example_autodiscover_2018() {
463
463
. run ( ) ;
464
464
}
465
465
466
+ #[ test]
467
+ fn autobins_disables ( ) {
468
+ let p = project ( )
469
+ . file (
470
+ "Cargo.toml" ,
471
+ r#"
472
+ [project]
473
+ name = "foo"
474
+ version = "0.0.1"
475
+ autobins = false
476
+ "#
477
+ )
478
+ . file ( "src/lib.rs" , "pub mod bin;" )
479
+ . file ( "src/bin/mod.rs" , "// empty" )
480
+ . build ( ) ;
481
+
482
+ p. cargo ( "run" )
483
+ . with_status ( 101 )
484
+ . with_stderr ( "[ERROR] a bin target must be available for `cargo run`" )
485
+ . run ( ) ;
486
+ }
487
+
466
488
#[ test]
467
489
fn run_bins ( ) {
468
490
let p = project ( )
You can’t perform that action at this time.
0 commit comments