cron
cron copied to clipboard
Panic on invalid cron expression
The string 1/0
causes a panic when fed to cron::Schedule::from_str
(0.11.0):
thread 'testing' panicked at 'assertion failed: step != 0', /rustc/6dd68402c5d7da168f87d8551dd9aed1d8a21893/library/core/src/iter/adapters/step_by.rs:21:9
stack backtrace:
0: rust_begin_unwind
at /rustc/6dd68402c5d7da168f87d8551dd9aed1d8a21893/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /rustc/6dd68402c5d7da168f87d8551dd9aed1d8a21893/library/core/src/panicking.rs:142:14
2: core::panicking::panic
at /rustc/6dd68402c5d7da168f87d8551dd9aed1d8a21893/library/core/src/panicking.rs:48:5
3: core::iter::adapters::step_by::StepBy<I>::new
at /rustc/6dd68402c5d7da168f87d8551dd9aed1d8a21893/library/core/src/iter/adapters/step_by.rs:21:9
4: core::iter::traits::iterator::Iterator::step_by
at /rustc/6dd68402c5d7da168f87d8551dd9aed1d8a21893/library/core/src/iter/traits/iterator.rs:384:9
5: cron::time_unit::TimeUnitField::ordinals_from_root_specifier
at /home/timo/.cargo/registry/src/github.com-1ecc6299db9ec823/cron-0.11.0/src/time_unit/mod.rs:310:17
6: <T as cron::parsing::FromField>::from_field
at /home/timo/.cargo/registry/src/github.com-1ecc6299db9ec823/cron-0.11.0/src/parsing.rs:60:50
This also happens in earlier versions (I tested 0.6.0), though that requires subexpressions to be present: 1/0 * * * * *