Skip to content

Commit 0cd6bb3

Browse files
committed
Print a final report suggesting to open an issue on rust repo
1 parent e00e764 commit 0cd6bb3

File tree

1 file changed

+80
-7
lines changed

1 file changed

+80
-7
lines changed

src/main.rs

Lines changed: 80 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -800,23 +800,24 @@ fn bisect(cfg: &Config, client: &Client) -> Result<(), Error> {
800800
let bisection_result = bisect_ci(&cfg, &client)?;
801801
print_results(cfg, client, &bisection_result);
802802
} else {
803-
let bisection_result = bisect_nightlies(&cfg, &client)?;
804-
print_results(cfg, client, &bisection_result);
805-
let regression = &bisection_result.searched[bisection_result.found];
803+
let nightly_bisection_result = bisect_nightlies(&cfg, &client)?;
804+
print_results(cfg, client, &nightly_bisection_result);
805+
let nightly_regression = &nightly_bisection_result.searched[nightly_bisection_result.found];
806806

807-
if let ToolchainSpec::Nightly { date } = regression.spec {
807+
if let ToolchainSpec::Nightly { date } = nightly_regression.spec {
808808
let previous_date = date - chrono::Duration::days(1);
809809

810-
if let Bound::Commit(regression_commit) = Bound::Date(date).as_commit()? {
810+
if let Bound::Commit(bad_commit) = Bound::Date(date).as_commit()? {
811811
if let Bound::Commit(working_commit) = Bound::Date(previous_date).as_commit()? {
812812
eprintln!(
813813
"looking for regression commit between {} and {}",
814814
date.format("%Y-%m-%d"),
815815
previous_date.format("%Y-%m-%d"),
816816
);
817817

818-
let bisection_result = bisect_ci_between(cfg, client, &working_commit, &regression_commit)?;
819-
print_results(cfg, client, &bisection_result);
818+
let ci_bisection_result = bisect_ci_between(cfg, client, &working_commit, &bad_commit)?;
819+
print_results(cfg, client, &ci_bisection_result);
820+
print_final_report(&nightly_bisection_result, &ci_bisection_result);
820821
}
821822
}
822823
}
@@ -869,6 +870,78 @@ fn print_results(cfg: &Config, client: &Client, bisection_result: &BisectionResu
869870
eprintln!("regression in {}", toolchains[*found]);
870871
}
871872

873+
fn print_final_report(
874+
nightly_bisection_result: &BisectionResult,
875+
ci_bisection_result: &BisectionResult,
876+
) {
877+
let BisectionResult {
878+
searched: nightly_toolchains,
879+
found: nightly_found,
880+
..
881+
} = nightly_bisection_result;
882+
883+
let BisectionResult {
884+
searched: ci_toolchains,
885+
found: ci_found,
886+
..
887+
} = ci_bisection_result;
888+
889+
eprintln!("");
890+
eprintln!("");
891+
892+
eprintln!("==================================================================================");
893+
eprintln!("= Please open an issue on Rust's github repository =");
894+
eprintln!("= https://github.com/rust-lang/rust/issues/new =");
895+
eprintln!("= Below you will find a text that would serve as a starting point of your report =");
896+
eprintln!("==================================================================================");
897+
898+
eprintln!("");
899+
900+
eprintln!("# Regression found in the compiler");
901+
eprintln!("");
902+
903+
eprintln!(
904+
"searched nightlies: from {} to {}",
905+
nightly_toolchains.first().unwrap(),
906+
nightly_toolchains.last().unwrap(),
907+
);
908+
909+
eprintln!(
910+
"regressed nightly: {}",
911+
nightly_toolchains[*nightly_found],
912+
);
913+
914+
eprintln!(
915+
"searched commits: from https://github.com/rust-lang/rust/commit/{} to https://github.com/rust-lang/rust/commit/{1}",
916+
ci_toolchains.first().unwrap(),
917+
ci_toolchains.last().unwrap(),
918+
);
919+
920+
eprintln!(
921+
"regressed commit: https://github.com/rust-lang/rust/commit/{}",
922+
ci_toolchains[*ci_found],
923+
);
924+
925+
eprintln!("source code: URL OF A REPOSITORY THAT REPRODUCES THE ERROR");
926+
927+
eprintln!("");
928+
929+
eprintln!("## Instructions");
930+
eprintln!("");
931+
eprintln!("Please give the steps for how to build your repository (platform, system dependencies, etc.)");
932+
933+
eprintln!("## Error");
934+
eprintln!("");
935+
eprintln!("<details><summary>COLLAPSIBLE ERROR STACKTRACE</summary>");
936+
eprintln!("<p>");
937+
eprintln!("");
938+
eprintln!("```bash");
939+
eprintln!("Paste the error the compiler is giving");
940+
eprintln!("```");
941+
eprintln!("");
942+
eprintln!("</p></details>");
943+
}
944+
872945
struct NightlyFinderIter {
873946
start_date: Date<Utc>,
874947
current_date: Date<Utc>,

0 commit comments

Comments
 (0)