Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error[E0277]: the trait bound Tz: Copy is not satisfied #29

Open
kekonn opened this issue Mar 31, 2024 · 5 comments · May be fixed by #30
Open

Compilation error[E0277]: the trait bound Tz: Copy is not satisfied #29

kekonn opened this issue Mar 31, 2024 · 5 comments · May be fixed by #30

Comments

@kekonn
Copy link

kekonn commented Mar 31, 2024

I get the following error trying to compile the crate:

error[E0277]: the trait bound `Tz: Copy` is not satisfied
   --> /home/kekkon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/chrono-english-0.1.7/src/types.rs:131:40
    |
131 |                 if let Some(correct) = next_last_direction(date, base, nd.direct) {
    |                                        ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Tz`, which is required by `chrono::DateTime<Tz>: Copy`
    |
    = note: required for `chrono::DateTime<Tz>` to implement `Copy`
note: required by a bound in `next_last_direction`
   --> /home/kekkon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/chrono-english-0.1.7/src/types.rs:61:40
    |
61  | fn next_last_direction<T: PartialOrd + Copy>(date: T, base: T, direct: Direction) -> Option<i32> {
    |                                        ^^^^ required by this bound in `next_last_direction`
help: consider further restricting this bound
    |
101 |     pub fn to_date_time<Tz: TimeZone + std::marker::Copy>(
    |                                      +++++++++++++++++++

I believe this is caused by one of the latest chrono versions, that included changes and deprecations.
I am using chrono 0.4.37 and chrono-tz 0.8.6 .

@Nukesor
Copy link

Nukesor commented Apr 1, 2024

Just ran into this myself.

It would be awesome if this could be fixed upstream. @stevedonovan could you take a look at this and eventually publish a new release :)?

@Nukesor Nukesor linked a pull request Apr 1, 2024 that will close this issue
@Nukesor
Copy link

Nukesor commented Apr 1, 2024

I fixed the problem in 8e07035

@kekonn
Copy link
Author

kekonn commented Apr 1, 2024

You're a lifesaver mate. This is the only library that can do what I want to do (human input parsing for a discord bot to set reminders) other than going overkill and using some LLM or other such BS. I will probably tell cargo to use your PR until there is an official release.

@Nukesor
Copy link

Nukesor commented Apr 1, 2024

You're welcome :). We definitely need this in a release though^^ This currently prevents dependant libraries from upgrading chrono. One cannot release crates that point to git repositories, all dependencies need to be published on crates.io 😓

arxanas added a commit to arxanas/git-branchless that referenced this issue Apr 13, 2024
Accepted all updates,

- except for `chrono`, which remains at `0.4.34` instead of being updated to `0.4.37` because the `chrono-english` dependency is incompatible: stevedonovan/chrono-english#29
  - It would be possible to patch the dependency in `Cargo.toml`, but then (I believe) we wouldn't be able to publish the git-branchless crate to crates.io: https://stackoverflow.com/questions/69235287/can-i-publish-a-crate-that-uses-a-patch#comment122393890_69235309,
    - and a large number of users install directly from `cargo`/crates.io.
arxanas added a commit to arxanas/git-branchless that referenced this issue Apr 14, 2024
Accepted all updates,

- except for `chrono`, which remains at `0.4.34` instead of being updated to `0.4.37` because the `chrono-english` dependency is incompatible: stevedonovan/chrono-english#29
  - It would be possible to patch the dependency in `Cargo.toml`, but then (I believe) we wouldn't be able to publish the git-branchless crate to crates.io: https://stackoverflow.com/questions/69235287/can-i-publish-a-crate-that-uses-a-patch#comment122393890_69235309,
    - and a large number of users install directly from `cargo`/crates.io.
arxanas added a commit to arxanas/git-branchless that referenced this issue Apr 28, 2024
Accepted all updates,

- except for `chrono`, which remains at `0.4.34` instead of being updated to `0.4.37` because the `chrono-english` dependency is incompatible: stevedonovan/chrono-english#29
  - It would be possible to patch the dependency in `Cargo.toml`, but then (I believe) we wouldn't be able to publish the git-branchless crate to crates.io: https://stackoverflow.com/questions/69235287/can-i-publish-a-crate-that-uses-a-patch#comment122393890_69235309,
    - and a large number of users install directly from `cargo`/crates.io.
@Nukesor
Copy link

Nukesor commented May 31, 2024

I fixed this by switching to the drop-in replacement https://github.com/conradludgate/interim

It seems well-maintained, properly tested and has the exact same API surface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants