Skip to content

crate: expose cfg for general 64-bit time_t functionality - #5411

Merged
tgross35 merged 4 commits into
rust-lang:mainfrom
dybucc:time64-global-cfg
Sep 21, 2026
Merged

tgross35 merged 4 commits into
rust-lang:mainfrom
dybucc:time64-global-cfg

Conversation

@dybucc

@dybucc dybucc commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Description

This patch adds support for a new cfg for easily toggling support for
64-bit time_t in supported platforms. This really only sets up the any
one of linux_time_bits64, gnu_time_bits64 or uclibc_time64.

The name of the cfg is 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 cfg under supported targets 1.

Checklist

  • Relevant tests in libc-test/semver have been updated
  • Commit messages permalink to headers for added or changed API
  • Placeholder or unstable values like *LAST or *MAX have the
    standard doc comment
  • Tested locally (cargo test -p libc-test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot label +stable-nominated

Footnotes

  1. https://github.com/rust-lang/libc/blob/1a8e71f33b1d6ea1e072210e7fc994417bbb2e34/build.rs#L181-L190 ↩

@rustbot rustbot added S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Aug 14, 2026

@tgross35 tgross35 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also update CI to use this cfg rather than the current glibc/musl cfg? Since this is what we're most likely to ship, we should make sure it works.

View changes since this review

Comment thread build.rs Outdated
Comment thread build.rs Outdated
@rustbot

rustbot commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@dybucc
dybucc force-pushed the time64-global-cfg branch from 98e48b9 to 1ab4287 Compare August 29, 2026 06:37
@rustbot

This comment has been minimized.

@dybucc
dybucc force-pushed the time64-global-cfg branch from 1ab4287 to 01f4796 Compare August 29, 2026 07:18
@rustbot rustbot added the A-CI Area: CI-related items label Aug 29, 2026
@dybucc
dybucc force-pushed the time64-global-cfg branch from 4c3b4f1 to 1b1d2bb Compare August 29, 2026 09:53
@dybucc

dybucc commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

I think it's done now. While checking through the CI workflow file, I
noticed that we even though we set the "updated but deprecated"
RUST_LIBC_UNSTABLE_MUSL_V1_2 environment variable for certain targets
1, we still check for RUSTC_LIBC_UNSTABLE_MUSL_V1_2_3 in build.rs
2.

I was wondering what's our stance on that change for stable releases,
and whether we should even set the deprecated environment variable in
CI. It seems wrong.

@rustbot ready

Footnotes

  1. https://github.com/rust-lang/libc/blob/75b2850150d0c50fa012ce965b7466d46da8e4e3/.github/workflows/ci.yaml#L223 ↩

  2. https://github.com/rust-lang/libc/blob/75b2850150d0c50fa012ce965b7466d46da8e4e3/build.rs#L162-L164 ↩

@rustbot

This comment has been minimized.

@dybucc
dybucc force-pushed the time64-global-cfg branch from a89083f to 36137bc Compare August 30, 2026 14:10
@rustbot

This comment has been minimized.

@tgross35 tgross35 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small things then LGTM

View changes since this review

Comment thread .github/workflows/ci.yaml
Comment thread ci/verify-build.py Outdated
@rustbot

This comment has been minimized.

@dybucc

dybucc commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@tgross35

tgross35 commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

I think it's done now. While checking through the CI workflow file, I noticed that we even though we set the "updated but deprecated" RUST_LIBC_UNSTABLE_MUSL_V1_2 environment variable for certain targets 1, we still check for RUSTC_LIBC_UNSTABLE_MUSL_V1_2_3 in build.rs 2.

I was wondering what's our stance on that change for stable releases, and whether we should even set the deprecated environment variable in CI. It seems wrong.

Oh, I did mean to update main.yaml here. Could you do that?

I'm not sure I follow the rest, why do you consider RUST_LIBC_UNSTABLE_MUSL_V1_2 "updated but deprecated"? And what do we need to take a stance on regarding stable releases?

@rustbot

This comment has been minimized.

@tgross35

tgross35 commented Sep 7, 2026

Copy link
Copy Markdown
Member

Could you rebase this once #5508 lands? let musl_v1_2 = ..., let uclibc_time64 = ..., and let gnu32_time64.

@tgross35

tgross35 commented Sep 7, 2026

Copy link
Copy Markdown
Member

Also please update the commit summary and PR title to mention the name of the config, it doesn't actually show up anywhere except the env form :)

Comment thread libc-test/build/main.rs Outdated
@rustbot

This comment has been minimized.

@tgross35

Copy link
Copy Markdown
Member

@dybucc There's still a test failure here, and could you please add the full cfg name to the commit summary? #5411 (comment)

@tgross35 tgross35 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dybucc

dybucc commented Sep 20, 2026

Copy link
Copy Markdown
Contributor Author

@dybucc There's still a test failure here, and could you please add the
full cfg name to the commit summary?
#5411 (comment)

Done, except the test. Sorry, I checked off this PR from my list of
pending stuff without properly finishing work on it. The test failure
seems odd; This PR introduced no changes that should make it fail.

The assertion about the linux_time_bits64 cfg being only valid for
Linux may be too restrictive. This is currently set in main also for
targets using uClibc 1.

The reason why this might not be popping up in CI workflow runs across
other PRs is because there is already another (likely unrelated) CI
failure concerning an AIX target. L4Re tests haven't run at that point.

Footnotes

  1. https://github.com/rust-lang/libc/blob/35c8b7d847f64265cb578343dc5d1be467fe63db/build.rs#L265-L269 ↩

@rustbot

This comment has been minimized.

@tgross35

Copy link
Copy Markdown
Member

AIX is probably rust-lang/rust#162979, feel free to add a commit disabling that with a FIXME for now.

The assertion about the linux_time_bits64 cfg being only valid for Linux may be too restrictive. This is currently set in main also for targets using uClibc 1.

The reason why this might not be popping up in CI workflow runs across other PRs is because there is already another (likely unrelated) CI failure concerning an AIX target. L4Re tests haven't run at that point.

Is that one failing? I didn't notice it hitting any error last time I ran check-all-targets, but that wasn't super recent.

I guess uclibc should have its own cfg independent of Linux, like glibc does. Or we could merge more cfgs together in the future after this single-cfg option is around for a bit.

@dybucc

dybucc commented Sep 20, 2026

Copy link
Copy Markdown
Contributor Author

AIX is probably rust-lang/rust#162979, feel
free to add a commit disabling that with a FIXME for now.

Just commented out the AIX target from being checked in CI.

I guess uclibc should have its own cfg independent of Linux, like glibc
does. Or we could merge more cfgs together in the future after this
single-cfg option is around for a bit.

I've made available a new cfg for uClibc targets. This may need
further discussion, so for now it continues to use the same Linux cfg
in code, but the build script differentiates from uClibc.

Back when this was introduced, there were no issues with the uClibc
targets setting up a seemingly Linux-only flag 1.

Footnotes

  1. https://github.com/rust-lang/libc/pull/5046/changes#diff-aedce4e8d381f53dae77653609e3174da7ee2a184308251ad33f7a47bebabe14R3755-R3760 ↩

Comment thread .github/workflows/ci.yaml
with:
persist-credentials: false
- name: Install Rust
# FIXME(rust-lang/rust#160439): unpin once the issue is fixed

@xtqqczze xtqqczze Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we include full URL: https://github.com/rust-lang/rust/pull/162979, makes navigation a bit easier.

View changes since the review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't do that simply because there's other FIXME comments
throughout the codebase already using this style. I think only when the
links are outside GitHub is it that full links are included.

If we were to include the full link, though, I would think it best to
not include it in between parenthesis, but rather as part of the comment
"body" (e.g. FIXME: see <link-here>.)

(If that's the GitHub PR extension for VSCode, I think there's a setting
for it to attempt to link to the right issue when detecting these
shortforms in any file.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using a format like rust-lang/rust#160439 is generally over-indexing on GitHub. I don't think readers should need to configure an extension just to make the reference navigable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I digress but, of course, this is open source, so be my guest.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, since rust-lang/rust#162979 was recently merged, is this pin expected to be removable once nightly-2026-09-20 is released, or is there another issue that still needs to be addressed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the issue the comment 1 mentions is related to
rust-lang/rust#162979.

Footnotes

  1. cargo doc freezes on libc with nightly-2026-08-03 rust#160439 ↩

This was referenced Sep 20, 2026
@tgross35

Copy link
Copy Markdown
Member

Cherry picked the AIX skip as #5541 to unblock other things

@rustbot

This comment has been minimized.

@tgross35 tgross35 mentioned this pull request Sep 21, 2026
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`. The new `cfg` goes by the name
`libc_unstable_time64`.
Switch as many uses of other target-specific `cfg`s with the `time64`
`cfg` introduced in the prior patch.
- Change indentation of two YAML arrays to consistently appear as nested
  within the key that corresponds with the array.

- Change one inconsistent use of single quotes with double quotes for
  YAML strings.
Replace use of `RUST_LIBC_UNSTABLE_MUSL_V1_2` with `TEST_MUSL_V1_2` in
the PowerPC CI runs. The former is deprecated; The latter is used in CI
scripts to set the right unstable `cfg` for functionality gated behind
musl's v1.2.
@rustbot

rustbot commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

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.

@tgross35 tgross35 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the conflict but I think that should resolve the uclibc issue. LGTM assuming CI passes

View changes since this review

@tgross35
tgross35 enabled auto-merge September 21, 2026 07:31
@tgross35
tgross35 added this pull request to the merge queue Sep 21, 2026
Merged via the queue into rust-lang:main with commit dde449d Sep 21, 2026
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CI Area: CI-related items S-waiting-on-author stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants