BurntSushi / jiff

A date-time library for Rust that encourages you to jump into the pit of success.
The Unlicense
1.65k stars 26 forks source link

0.1.7 version fails to compile from crates.io #108

Closed tyranron closed 3 weeks ago

tyranron commented 3 weeks ago

See the CI log:

error[E0433]: failed to resolve: use of undeclared crate or module `std`
 --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jiff-0.1.7/src/duration.rs:1:5
  |
1 | use std::time::Duration as UnsignedDuration;
  |     ^^^ use of undeclared crate or module `std`

error[E0433]: failed to resolve: use of undeclared crate or module `std`
    --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jiff-0.1.7/src/timestamp.rs:2109:25
     |
2109 |         (self.signum(), std::time::Duration::new(second, nanosecond))
     |                         ^^^ use of undeclared crate or module `std`
     |
help: consider importing one of these items
     |
1    + use core::time::Duration;
     |
1    + use crate::duration::Duration;
     |
help: if you import `Duration`, refer to it directly
     |
2109 -         (self.signum(), std::time::Duration::new(second, nanosecond))
2109 +         (self.signum(), Duration::new(second, nanosecond))
     |

    Checking event-listener-strategy v0.5.2
error[E0277]: the trait bound `duration::Duration: From<core::time::Duration>` is not satisfied
    --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jiff-0.1.7/src/civil/date.rs:2611:24
     |
2611 |         let duration = Duration::from(udur);
     |                        ^^^^^^^^ the trait `From<core::time::Duration>` is not implemented for `duration::Duration`
     |
     = help: the following other types implement trait `From<T>`:
               <duration::Duration as From<SignedDuration>>
               <duration::Duration as From<Span>>

error[E0277]: the trait bound `duration::Duration: From<core::time::Duration>` is not satisfied
    --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jiff-0.1.7/src/civil/datetime.rs:2681:24
     |
2681 |         let duration = Duration::from(udur);
     |                        ^^^^^^^^ the trait `From<core::time::Duration>` is not implemented for `duration::Duration`
     |
     = help: the following other types implement trait `From<T>`:
               <duration::Duration as From<SignedDuration>>
               <duration::Duration as From<Span>>

error[E0277]: the trait bound `duration::Duration: From<core::time::Duration>` is not satisfied
    --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jiff-0.1.7/src/civil/time.rs:2169:24
     |
2169 |         let duration = Duration::from(udur);
     |                        ^^^^^^^^ the trait `From<core::time::Duration>` is not implemented for `duration::Duration`
     |
     = help: the following other types implement trait `From<T>`:
               <duration::Duration as From<SignedDuration>>
               <duration::Duration as From<Span>>

error[E0277]: the trait bound `duration::Duration: From<core::time::Duration>` is not satisfied
    --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jiff-0.1.7/src/span.rs:4199:24
     |
4199 |         let duration = Duration::from(duration);
     |                        ^^^^^^^^ the trait `From<core::time::Duration>` is not implemented for `duration::Duration`
     |
     = help: the following other types implement trait `From<T>`:
               <duration::Duration as From<SignedDuration>>
               <duration::Duration as From<Span>>

error[E0277]: the trait bound `duration::Duration: From<core::time::Duration>` is not satisfied
    --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jiff-0.1.7/src/timestamp.rs:2776:24
     |
2776 |         let duration = Duration::from(udur);
     |                        ^^^^^^^^ the trait `From<core::time::Duration>` is not implemented for `duration::Duration`
     |
     = help: the following other types implement trait `From<T>`:
               <duration::Duration as From<SignedDuration>>
               <duration::Duration as From<Span>>

error[E0277]: the trait bound `duration::Duration: From<core::time::Duration>` is not satisfied
    --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jiff-0.1.7/src/tz/offset.rs:1190:24
     |
1190 |         let duration = Duration::from(udur);
     |                        ^^^^^^^^ the trait `From<core::time::Duration>` is not implemented for `duration::Duration`
     |
     = help: the following other types implement trait `From<T>`:
               <duration::Duration as From<SignedDuration>>
               <duration::Duration as From<Span>>

error[E0277]: the trait bound `duration::Duration: From<core::time::Duration>` is not satisfied
    --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jiff-0.1.7/src/zoned.rs:3429:24
     |
3429 |         let duration = Duration::from(udur);
     |                        ^^^^^^^^ the trait `From<core::time::Duration>` is not implemented for `duration::Duration`
     |
     = help: the following other types implement trait `From<T>`:
               <duration::Duration as From<SignedDuration>>
               <duration::Duration as From<Span>>

The crate is imported in the following way:

jiff = { version = "0.1.5", features = ["alloc"], default-features = false, optional = true }
BurntSushi commented 3 weeks ago

Ug. Yeah. This is a case where cargo test --lib --no-default-features --features alloc passes (which is what's run in CI) but cargo build --no-default-features --features alloc does not.

Thank you for the report!

BurntSushi commented 3 weeks ago

Okay, this should be fixed in jiff 0.1.8. And CI has been updated to catch this kind of regression in the future. Thanks for the report!

tyranron commented 3 weeks ago

@BurntSushi thank you for the quick reaction!