crate: expose cfg for general 64-bit time_t functionality - #5411
Conversation
| @@ -190,7 +196,7 @@ fn main() { | |||
| } | |||
There was a problem hiding this comment.
This should also set the musl_v1_2 flag, since that's pretty much all it's gating
There was a problem hiding this comment.
I don't think I understand. You mention the musl_v1_2 flag, but that
is already set in that particular code block. Further, you also mention
in another review comment that I shouldn't need the time64 flag, so I
don't think there's anything to change in this particular area.
| // Global flag to enable one of `linux_time_bits64` or `gnu_time_bits64`. | ||
| // The musl flags are enabled by default on supported platforms. | ||
| "time64", |
There was a problem hiding this comment.
I think this isn't actually needed, this list is only for what gets sent to check-cfg and we won't use time64 directly (at least for now)
|
Reminder, once the PR becomes ready for a review, use |
98e48b9 to
1ab4287
Compare
This comment has been minimized.
This comment has been minimized.
1ab4287 to
01f4796
Compare
4c3b4f1 to
1b1d2bb
Compare
|
I think it's done now. While checking through the CI workflow file, I I was wondering what's our stance on that change for stable releases, @rustbot ready Footnotes |
1b1d2bb to
a89083f
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Add `cfg` enabling `time64` functionality across all supported targets. This ensures users have a simple entry point to the crate functionality gated behind one of `linux_time_bits64`, `uclibc_time64` and `gnu_time_bits64`.
Switch as many uses of other target-specific `cfg`s with the `time64` `cfg` introduced in the prior patch.
a89083f to
36137bc
Compare
|
☔ The latest upstream changes (possibly #5313) made this pull request unmergeable. Please resolve the merge conflicts. |
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
| - run: | | ||
| msrv="$( | ||
| cargo metadata --format-version 1 | | ||
| jq -r --arg CRATE_NAME ctest '.packages | map(select((.name == $CRATE_NAME) and (.id | startswith("path+file")))) | first | .rust_version' | ||
| )" | ||
| echo "MSRV: $msrv" | ||
| echo "MSRV=$msrv" >> "$GITHUB_ENV" | ||
| - name: Install Rust | ||
| run: rustup update "$MSRV" --no-self-update && rustup default "$MSRV" | ||
| - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 | ||
| - run: cargo build -p ctest | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
| - run: | | ||
| msrv="$( | ||
| cargo metadata --format-version 1 | | ||
| jq -r --arg CRATE_NAME ctest '.packages | map(select((.name == $CRATE_NAME) and (.id | startswith("path+file")))) | first | .rust_version' | ||
| )" | ||
| echo "MSRV: $msrv" | ||
| echo "MSRV=$msrv" >> "$GITHUB_ENV" | ||
| - name: Install Rust | ||
| run: rustup update "$MSRV" --no-self-update && rustup default "$MSRV" | ||
| - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 | ||
| - run: cargo build -p ctest |
There was a problem hiding this comment.
It's fine to reformat this if it makes things more consistent, but please put it in a separate commit
| if "musl" in target_env: | ||
| # Check with breaking changes from musl, including 64-bit time_t on 32-bit | ||
| run(cmd, rustflags=f"{rustflags} --cfg=libc_unstable_musl_v1_2") | ||
| if "gnu" in target_env and target_bits == "32" or "musl" in target_env: |
There was a problem hiding this comment.
Use parens to make the order of operations clear
Description
This patch adds support for a new
cfgthat should allow easilytoggling support for 64-bit
time_tin supported platforms. Thisshould make testing of this unstable feature flag in downstream crates
easier than having to manually set up the equivalent
cfgs for anyone of
linux_time_bits64,gnu_time_bits64oruclibc_time64.Note support for the equivalent flag in musl has not been included
because we already have set-up automatic detection and toggling of the
corresponding
cfgunder supported targets 1.Checklist
libc-test/semverhave been updated*LASTor*MAXhave thestandard doc comment
cargo test -p libc-test --target mytarget);especially relevant for platforms that may not be checked in CI
@rustbot label +stable-nominated
Footnotes
https://github.com/rust-lang/libc/blob/1a8e71f33b1d6ea1e072210e7fc994417bbb2e34/build.rs#L181-L190 ↩