chrono-english
chrono-english copied to clipboard
Compilation error[E0277]: the trait bound `Tz: Copy` is not satisfied
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
.
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 :)?
I fixed the problem in https://github.com/stevedonovan/chrono-english/pull/30/commits/8e07035d56c89a437f3cb237f5ca1f39a7d43549
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.
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 :sweat:
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.