-
Notifications
You must be signed in to change notification settings - Fork 541
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
Expose rkyv features as features for chrono users. #1368
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me, thanks!
If you want to use this any time soon, I recommend retargeting the PR/rebasing the branch on 0.4.x.
Thanks for the review, I updated this and also made some changes to CI scripts to account for the fact that --all-features no longer works out of the box in a new commit. |
Is there a timeline for the 0.5 release? I'm happy to send a PR for 0.4 if you think the 0.5 release is still a few months out. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 0.4.x #1368 +/- ##
==========================================
+ Coverage 91.64% 91.67% +0.02%
==========================================
Files 38 38
Lines 17554 17577 +23
==========================================
+ Hits 16088 16113 +25
+ Misses 1466 1464 -2 ☔ View full report in Codecov by Sentry. |
12ea985
to
bbfdc20
Compare
Looks like the last test-failure I get is
and it's due to https://github.com/chronotope/chrono/pull/1368/files#diff-2e9d962a08321605940b5a657135052fbcef87b5e360662bb527c96d9a615542R37 I added it due to the suggestion here:
I'm not quite sure if it's possible to specify the feature with the same intent without using |
There is not, you definitely want to be on 0.4.x for now (and we do regular merges from 0.4.x -> main), so please just retarget this PR. |
I think it is possible, just replace |
254b11a
to
92d8ffd
Compare
rkyv by default serializes usize as u32. This isn't ideal on most modern platforms and unfortunately is configured through a feature flag. If we just set `default-features = false` in the rkyv Cargo dependency, the crate fails to compile because all the size features are mutually exclusive. On the other hand if we want to e.g., change the serialization of usize to 64-bit and we also want to use chrono this currently fails to compile because chrono always enables rkyv/size_32. This re-exports the relevant rkyv features so users can choose which serialization to enable. The approach is similar to what the ordered-float crate does: https://github.com/reem/rust-ordered-float/blob/8111b345372632893af0b8aa12152f3dc7278aba/Cargo.toml#L37 Signed-off-by: Gerd Zellweger <[email protected]>
fbf5136
to
8e373df
Compare
This is due to the mutually exclusive features in rkyv which we expose now. `--all-features` will now activate them and the crate will fail to compile rkyv. We work around this by defining an explicit list of all mutually exclusive features to. Unfortunately there isn't an easy way to share env variables among different YAML files (actions/runner#655). There also isn't a good way to specify `--all-features` minus "just a few" (rust-lang/cargo#3126) aside from giving the complete list. Signed-off-by: Gerd Zellweger <[email protected]>
@djc I rebased it on the 0.4 branch |
Thanks! |
This PR was a breaking change, chrono no longer builds with just This breaks our build on docs.rs for 0.4.32, although that is easy to fix. |
rkyv by default serializes usize as u32. This isn't ideal on most modern platforms and unfortunately is configured through a feature flag.
If we just set
default-features = false
in the rkyv Cargo dependency, the crate fails to compile because all the size features are mutually exclusive. On the other hand if we want to e.g., change the serialization of usize to 64-bit and we also want to use chrono this currently fails to compile because chrono always enables rkyv/size_32.This re-exports the relevant rkyv features so users can choose which serialization to enable. The approach is similar to what the ordered-float crate does:
https://github.com/reem/rust-ordered-float/blob/8111b345372632893af0b8aa12152f3dc7278aba/Cargo.toml#L37
Note aside: rkyv with `default-features = false is what was recommended on the rkyv discord by the maintainer (see screenshot below). But it seems that the approach ordered-float took is better as it doesn't break backward compatibility (and compilation of chrono library without specifying any features).
Thanks for contributing to chrono!
If your feature is semver-compatible, please target the 0.4.x branch;
the main branch will be used for 0.5.0 development going forward.
Please consider adding a test to ensure your bug fix/feature will not break in the future.