Lantern-chat/iso8601-timestamp

[v0.2.15] -- error: could not compile : "expected std::time::Duration`, found `time::Duration"

Closed this issue · 2 comments

Hi,

I was using version 0.2.12 in a project I have.
Nothing but defaults enabled:
cargo.toml

iso8601-timestamp = "0.2.12"

Today I updated to 0.2.15 and now get the following error when trying to compile my project:

Compiling iso8601-timestamp v0.2.15
error[E0308]: mismatched types
   --> /home/brendan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/iso8601-timestamp-0.2.15/src/lib.rs:159:34
    |
159 |         SystemTime::UNIX_EPOCH + ts.duration_since(Timestamp::UNIX_EPOCH)
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `std::time::Duration`, found `time::Duration`
    |
    = note: `time::Duration` and `std::time::Duration` have similar names, but are actually distinct types
note: `time::Duration` is defined in crate `time`
   --> /home/brendan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/time-0.3.31/src/duration.rs:39:1
    |
39  | pub struct Duration {
    | ^^^^^^^^^^^^^^^^^^^
note: `std::time::Duration` is defined in crate `core`
   --> /usr/lib/rust/1.71.1/lib/rustlib/src/rust/library/core/src/time.rs:86:1
    |
86  | pub struct Duration {
    | ^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `iso8601-timestamp` (lib) due to previous error

Not sure what has changed or if there is some issue with my machine/setup.
I am using Rust/Cargo 1.71.1.

For now, I worked around this via disabling std, and only enabling serde since I need that feature but not std yet.
Cargo.toml

iso8601-timestamp = { version ="0.2.15", default-features = false, features = ["serde"] }

Fixed in 0.2.16. Unfortunate bug that's only visible when used in another crate due to cargo features.

Many thanks, all good now !