Skip to content

Commit 0275363

Browse files
committed
Validate date bounds
1 parent e00e764 commit 0275363

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/main.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,10 +747,26 @@ impl Config {
747747
}
748748
}
749749

750+
fn check_bounds(start: &Option<Bound>, end: &Option<Bound>) -> Result<(), Error> {
751+
match (&start, &end) {
752+
(Some(Bound::Date(start)), Some(Bound::Date(end))) if end < start => {
753+
bail!(
754+
"end should be after start, got start: {:?} and end {:?}",
755+
start,
756+
end
757+
);
758+
},
759+
_ => {}
760+
}
761+
762+
Ok(())
763+
}
764+
750765
fn run() -> Result<(), Error> {
751766
env_logger::try_init()?;
752767
let args = env::args_os().filter(|a| a != "bisect-rustc");
753768
let args = Opts::from_iter(args);
769+
check_bounds(&args.start, &args.end)?;
754770
let cfg = Config::from_args(args)?;
755771

756772
let client = Client::new();

0 commit comments

Comments
 (0)