plotters-rs/plotters

[BUG] `plotters` fails to compile in a workspace using chrono 0.4.31

eric-seppanen opened this issue · 0 comments

When adding a plotters 0.3.6 dependency to an existing workspace, it fails to compile:

error[E0368]: binary assignment operation `+=` cannot be applied to type `chrono::Duration`
   --> .cargo/registry/src/index.crates.io-6f17d22bba15001f/plotters-0.3.6/src/coord/ranged1d/types/datetime.rs:782:21
    |
782 |                     current += Duration::nanoseconds(period as i64);
    |                     -------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |                     |
    |                     cannot use `+=` on type `chrono::Duration`

error[E0368]: binary assignment operation `+=` cannot be applied to type `chrono::Duration`
   --> .cargo/registry/src/index.crates.io-6f17d22bba15001f/plotters-0.3.6/src/coord/ranged1d/types/datetime.rs:821:13
    |
821 |             current += Duration::days(i64::from(days_per_tick));
    |             -------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |             |
    |             cannot use `+=` on type `chrono::Duration`

The cause is that the existing workspace already uses chrono 0.4.31, and the plotters crate does not correctly specify the version it requires.

The plotters crate declares a dependency on chrono 0.4.20, but actually uses features that only exist in a later version (chrono >= 0.4.34).

This was previously noticed in #592, but is still unfixed.