-
Notifications
You must be signed in to change notification settings - Fork 542
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
Replace winapi
with windows-sys
#712
Conversation
This change brings MSRV to (maybe) 1.35.0. For the time being, wait for CI. |
Hi @hotate29 - thanks for this PR. If possible could you do the following:
As far as the increase in MSRV we may be better off waiting for an A solution in the meantime could be instead having a feature like "use-windows-rs" which would use "windows-rs" instead of "winapi" - however as per this issue I don't think this is currently possible. Please let me know your thoughts? |
Both done.
Ah, I completely forgot to check Cargo.toml in
I did not know about this issue. (Thanks for pointing it out!) Since there is no need to immediately switch to windows-sys, it may be safe to put this PR aside for now until there is more activity regarding version 0.5. (or close PR) |
2911b5c
to
d57099c
Compare
Would like to keep this open -- I tagged with the API-incompatible tag so we can easily find such changes in the future. |
@esheppa Do you mean to replace the part using 1.32 with 1.46? |
@hotate29 - yes in the |
@esheppa I understand. thanks! |
Curious, what's holding this change up? Let me know if I can help. |
@kennykerr what's the MSRV for the windows crates these days? We recently bumped to 1.38 but are being conservative about bumping more (probably the upper bound we'd consider is 1.48 at this point). |
The MSRV for
|
I think the limitation here is stable Debian, which IMO still affects a sizable contingent of downstream users. Anyway -- I'm generally interested in moving to windows-sys but this is why it's stalled. If you want to be lower in the stack than chrono, I think you should maybe be more conservative about MSRV bumps as well? 🙂 From my perspective (admittedly as a user of macOS on the desktop and Linux on servers -- and for other people I work with either at my day job or in OSS, it seems like Windows is a minority) I don't see a big benefit to switching away from winapi (and it's just a few small API calls, too) whereas I feel a substantial amount of responsibility towards downstream projects who want to serve users which have older compilers. |
Sorry for the delay - I lost track of this issue.
I just tested 1.48 and that works great: microsoft/windows-rs#2173 I'm happy to enforce that. As a practical matter, the current version of windows-sys works fine with 1.48 if you'd like to go ahead with that. |
Thanks for this @kennykerr. @djc - what are your thoughts on using this in |
Yes, that seems fine. @hotate29 are you interested in rebasing this and updating it to bump the MSRV to 1.48? |
@djc Yes, I am interested. I will work on that. |
I have added an empty feature for compatibility (e65acd1), but if this change is included in the 0.5 release, I don't think it is needed. |
c283218
to
aa19a98
Compare
Yes, please remove the empty feature. Would you mind rebasing this so that there are two commits:
Can also do two separate PRs if that's easier for you (then we can squash while merging). This would make it easier for me to review the changes. |
43bf05e
to
e0088e1
Compare
I rebased. |
Oops, found a mistake. |
e0088e1
to
dc3788e
Compare
Fixed. |
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.
Looks great, one small issue to address, please fix it in the originating commit?
Cargo.toml
Outdated
@@ -11,6 +11,7 @@ readme = "README.md" | |||
license = "MIT/Apache-2.0" | |||
exclude = ["/ci/*"] | |||
edition = "2018" | |||
rust = "1.48.0" |
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 is supposed to be rust-version
and that only starts working after 1.56, so I don't think we should add it here.
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.
Deleted. thanks!
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.
So please squash this into the first commit?
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.
Squashed.
b0a52bc
to
288a5a6
Compare
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.
Thanks for this @hotate29 - apologies to ask you to rebase this again, but we have recently merged the past while of work from 0.4.x
to main
and if you can rebase this on the HEAD of main
that would clean up the diff in this PR. (Separately if you could use git rebase -i
to move 288a5a6 into ef3fe078 that would be great)
3e1d064
to
313d125
Compare
@esheppa Rebased. |
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.
Thanks @hotate29 - there are just a few more changes I'd like you to take a look at if possible
src/offset/local/windows.rs
Outdated
@@ -36,7 +37,7 @@ pub(super) fn naive_to_local(d: &NaiveDateTime, local: bool) -> LocalResult<Date | |||
tm_yday: 0, // and this | |||
tm_isdst: -1, | |||
// This seems pretty fake? | |||
tm_utcoff: if local { 1 } else { 0 }, | |||
tm_utcoff: local as i32, |
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.
do you mind using i32::from(local)
here as per line 223 below?
src/offset/local/windows.rs
Outdated
tm.tm_hour as u32, | ||
tm.tm_min as u32, | ||
tm.tm_sec as u32, | ||
tm.tm_nsec as u32, | ||
); | ||
) | ||
.expect("invalid time"); |
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 could be cast to a LocalResult::None
which would avoid the expect
call (this is semantically sub-optimal, but is consistent with usage elsewhere):
let time = NaiveTime::from_hms_nano_opt(...).ok_or(LocalResult::None)?;
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.
Pushed changes (will squash later).
let datetime = tm_to_datetime(Timespec::now().local()); | ||
datetime.single().expect("invalid time") |
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.
An expectation is that the system will not return an invalid time.
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 looks reasonable, in the case of now()
823ecac
to
221de6e
Compare
Thanks for those fixes @hotate29 - if possible can you squash them down to the original two commits? We are using "Rebase and Merge" rather than "Squash and Merge" which is why we have to be a bit more picky about keeping all the commits within a given PR clean (I'll set up some docs on this to make it an explicit policy) edit: |
221de6e
to
b3e9664
Compare
@esheppa Squashed. |
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.
Thanks for this @hotate29, looks good to go!
Thanks to all who worked on this PR! |
Thanks for contributing to chrono!
about adding the PR number)
we can't reintroduce it?