@@ -575,37 +575,62 @@ fn bisect(cfg: &Config, client: &Client) -> Result<(), Error> {
575575 if let ToolchainSpec :: Nightly { date } = nightly_regression. spec {
576576 let previous_date = date - chrono:: Duration :: days ( 1 ) ;
577577
578- let bad_commit = Bound :: Date ( date) . sha ( ) ?;
579578 let working_commit = Bound :: Date ( previous_date) . sha ( ) ?;
579+ let bad_commit = Bound :: Date ( date) . sha ( ) ?;
580580 eprintln ! (
581581 "looking for regression commit between {} and {}" ,
582- date. format( YYYY_MM_DD ) ,
583582 previous_date. format( YYYY_MM_DD ) ,
583+ date. format( YYYY_MM_DD ) ,
584584 ) ;
585585
586586 let ci_bisection_result =
587587 bisect_ci_via ( cfg, client, & * cfg. repo_access , & working_commit, & bad_commit) ?;
588588
589589 print_results ( cfg, client, & ci_bisection_result) ;
590- print_final_report ( & nightly_bisection_result, & ci_bisection_result) ;
590+ print_final_report ( cfg , & nightly_bisection_result, & ci_bisection_result) ;
591591 }
592592 }
593593
594594 Ok ( ( ) )
595595}
596596
597+ fn searched_range (
598+ cfg : & Config ,
599+ searched_toolchains : & Vec < Toolchain > ,
600+ ) -> ( ToolchainSpec , ToolchainSpec ) {
601+ let first_toolchain = searched_toolchains. first ( ) . unwrap ( ) . spec . clone ( ) ;
602+ let last_toolchain = searched_toolchains. last ( ) . unwrap ( ) . spec . clone ( ) ;
603+
604+ match ( & first_toolchain, & last_toolchain) {
605+ ( ToolchainSpec :: Ci { .. } , ToolchainSpec :: Ci { .. } ) => ( first_toolchain, last_toolchain) ,
606+
607+ _ => {
608+ let start_toolchain = if let Some ( Bound :: Date ( date) ) = cfg. args . start {
609+ ToolchainSpec :: Nightly { date }
610+ } else {
611+ first_toolchain
612+ } ;
613+
614+ (
615+ start_toolchain,
616+ ToolchainSpec :: Nightly {
617+ date : get_end_date ( cfg) ,
618+ } ,
619+ )
620+ }
621+ }
622+ }
623+
597624fn print_results ( cfg : & Config , client : & Client , bisection_result : & BisectionResult ) {
598625 let BisectionResult {
599626 searched : toolchains,
600627 dl_spec,
601628 found,
602629 } = bisection_result;
603630
604- eprintln ! (
605- "searched toolchains {} through {}" ,
606- toolchains. first( ) . unwrap( ) ,
607- toolchains. last( ) . unwrap( ) ,
608- ) ;
631+ let ( start, end) = searched_range ( cfg, toolchains) ;
632+
633+ eprintln ! ( "searched toolchains {} through {}" , start, end) ;
609634
610635 if toolchains[ * found] == * toolchains. last ( ) . unwrap ( ) {
611636 let t = & toolchains[ * found] ;
@@ -645,6 +670,7 @@ fn print_results(cfg: &Config, client: &Client, bisection_result: &BisectionResu
645670}
646671
647672fn print_final_report (
673+ cfg : & Config ,
648674 nightly_bisection_result : & BisectionResult ,
649675 ci_bisection_result : & BisectionResult ,
650676) {
@@ -676,11 +702,9 @@ fn print_final_report(
676702 eprintln ! ( "# Regression found in the compiler" ) ;
677703 eprintln ! ( "" ) ;
678704
679- eprintln ! (
680- "searched nightlies: from {} to {}" ,
681- nightly_toolchains. first( ) . unwrap( ) ,
682- nightly_toolchains. last( ) . unwrap( ) ,
683- ) ;
705+ let ( start, end) = searched_range ( cfg, nightly_toolchains) ;
706+
707+ eprintln ! ( "searched nightlies: from {} to {}" , start, end) ;
684708
685709 eprintln ! ( "regressed nightly: {}" , nightly_toolchains[ * nightly_found] , ) ;
686710
@@ -843,6 +867,26 @@ fn bisect_to_regression(
843867 Ok ( found)
844868}
845869
870+ fn get_start_date ( cfg : & Config ) -> chrono:: Date < Utc > {
871+ if let Some ( Bound :: Date ( date) ) = cfg. args . start {
872+ date
873+ } else {
874+ get_end_date ( cfg)
875+ }
876+ }
877+
878+ fn get_end_date ( cfg : & Config ) -> chrono:: Date < Utc > {
879+ if let Some ( Bound :: Date ( date) ) = cfg. args . end {
880+ date
881+ } else {
882+ if let Some ( date) = Toolchain :: default_nightly ( ) {
883+ date
884+ } else {
885+ chrono:: Utc :: now ( ) . date ( )
886+ }
887+ }
888+ }
889+
846890// nightlies branch of bisect execution
847891fn bisect_nightlies ( cfg : & Config , client : & Client ) -> Result < BisectionResult , Error > {
848892 if cfg. args . alt {
@@ -858,21 +902,9 @@ fn bisect_nightlies(cfg: &Config, client: &Client) -> Result<BisectionResult, Er
858902 ) ;
859903 let mut first_success = None ;
860904
861- let mut last_failure = if let Some ( Bound :: Date ( date) ) = cfg. args . end {
862- date
863- } else {
864- if let Some ( date) = Toolchain :: default_nightly ( ) {
865- date
866- } else {
867- chrono:: Utc :: now ( ) . date ( )
868- }
869- } ;
870-
871- let ( mut nightly_date, has_start) = if let Some ( Bound :: Date ( date) ) = cfg. args . start {
872- ( date, true )
873- } else {
874- ( last_failure, false )
875- } ;
905+ let mut nightly_date = get_start_date ( cfg) ;
906+ let mut last_failure = get_end_date ( cfg) ;
907+ let has_start = cfg. args . start . is_some ( ) ;
876908
877909 let mut nightly_iter = NightlyFinderIter :: new ( nightly_date) ;
878910
0 commit comments