plotters-rs / plotters

A rust drawing library for high quality data plotting for both WASM and native, statically and realtimely πŸ¦€ πŸ“ˆπŸš€
https://plotters-rs.github.io/home/
MIT License
3.82k stars 277 forks source link

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

Closed eric-seppanen closed 1 month ago

eric-seppanen commented 1 month ago

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.