Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
- toolchain: nightly
half: 2
- toolchain: beta
only: '(aarch64|x86_64)' # just a spot check for beta
only: "(aarch64|x86_64)" # just a spot check for beta
- toolchain: stable
- toolchain: 1.65.0 # msrv
runs-on: ubuntu-26.04
Expand Down Expand Up @@ -220,7 +220,7 @@ jobs:
- target: powerpc64-unknown-linux-gnu
- target: powerpc64-unknown-linux-musl
- target: powerpc64-unknown-linux-musl
env: { RUST_LIBC_UNSTABLE_MUSL_V1_2: 1 }
env: { TEST_MUSL_V1_2: 1 }
artifact-tag: new-musl
- target: powerpc64le-unknown-linux-gnu
- target: powerpc64le-unknown-linux-musl
Expand Down Expand Up @@ -392,34 +392,34 @@ jobs:
env:
RUSTFLAGS: "" # No need to check warnings on old MSRV, clear `-Dwarnings`
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
Comment thread
tgross35 marked this conversation as resolved.

docs:
name: Ensure docs build
runs-on: ubuntu-26.04
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Rust
# FIXME(rust-lang/rust#160439): unpin once the issue is fixed
run: rustup update nightly-2026-08-02 --no-self-update && rustup default nightly-2026-08-02
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
- run: cargo doc --workspace --no-deps
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
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 ↩

run: rustup update nightly-2026-08-02 --no-self-update && rustup default nightly-2026-08-02
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
- run: cargo doc --workspace --no-deps

zizmor:
name: Zizmor (Static analysis for GitHub Actions)
Expand Down
9 changes: 6 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,12 @@ fn main() {
|| target_env == "ohos"
|| target_abi == "pauthtest";

// Single entry-point to enable `time64` on supported platforms.
let time64 = env_flag("CARGO_CFG_LIBC_UNSTABLE_TIME64");

// OpenHarmony uses a fork of the musl libc
let musl = target_env == "musl" || target_env == "ohos";
let musl_v1_2 = musl && (musl_v1_2_env || only_v1_2_on_musl);
let musl_v1_2 = musl && (musl_v1_2_env || only_v1_2_on_musl || time64);

if musl_v1_2 {
cfgs.push(Cfg::MuslV1_2);
Expand Down Expand Up @@ -301,7 +304,7 @@ fn main() {
|| target_arch == "x86_64"
|| !matches!(target_os.as_str(), "linux" | "windows" | "hurd");
let gnu = target_env == "gnu";
let gnu32_time64 = gnu && target_ptr_width == "32" && gnu32_timebits == "64";
let gnu32_time64 = gnu && target_ptr_width == "32" && (gnu32_timebits == "64" || time64);

if gnu32_time64 && !gnu32_already_time64 {
// These configs all set up nonstandard options. They are not needed on platforms like
Expand All @@ -315,7 +318,7 @@ fn main() {

let uclibc_time64_env = env_flag("CARGO_CFG_LIBC_UNSTABLE_UCLIBC_TIME64");
let uclibc = target_env == "uclibc";
let uclibc32_time64 = uclibc && target_ptr_width == "32" && uclibc_time64_env;
let uclibc32_time64 = uclibc && target_ptr_width == "32" && (uclibc_time64_env || time64);

if uclibc32_time64 {
if target_os == "linux" {
Expand Down
2 changes: 1 addition & 1 deletion ci/run-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ run() {

if [ -n "${TEST_UCLIBC_TIME64:-}" ]; then
build_args+=("--build-arg=TEST_UCLIBC_TIME64=1")
RUSTFLAGS="$RUSTFLAGS --cfg=libc_unstable_uclibc_time64"
RUSTFLAGS="$RUSTFLAGS --cfg=libc_unstable_time64"
fi
if [[ "$run_target" = *-linux-uclibc* ]]; then
if [ "${UCLIBC_TOOLCHAIN_URL:-}" ]; then
Expand Down
2 changes: 1 addition & 1 deletion ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ $cmd --features extra_traits -- $test_flags

if [ "$env" = "gnu" ] && [ "$bits" = "32" ]; then
# shellcheck disable=SC2086
RUSTFLAGS="$RUSTFLAGS --cfg=libc_unstable_gnu_time_bits=\"64\"" $cmd -- $test_flags
RUSTFLAGS="$RUSTFLAGS --cfg=libc_unstable_time64" $cmd -- $test_flags
fi
15 changes: 8 additions & 7 deletions ci/verify-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,14 @@ def test_target(cfg: Cfg, target: Target) -> TargetResult:
run(cmd, rustflags=rustflags)
run([*cmd, "--features=extra_traits"], rustflags=rustflags)

if "gnu" in target_env and target_bits == "32":
# Equivalent of _TIME_BITS=64
run(cmd, rustflags=f'{rustflags} --cfg=libc_unstable_gnu_time_bits="64"')

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
or "uclibc" in target_env
):
# Global toggle for `_TIME_BITS=64` on glibc, musl breaking changes and
# uClibc buil-time options concerning 64-bit `time_t`.
run(cmd, rustflags=f"{rustflags} --cfg=libc_unstable_time64")

if "uclibc" in target_env:
# Equivalent of UCLIBC_USE_TIME64 on 32-bit targets, ignored on 64-bit
Expand Down
15 changes: 10 additions & 5 deletions libc-test/build/main.rs

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.

"crate: expose cfg for general time64" please mention the cfg name in the commit message summary, it doesn't show up anywhere in this commit

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.

It does, though (before this review, I mean.)

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.

What am I missing? 3901563 has the text:

crate: expose cfg for general time64

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 time64.

`libc_unstable_time64` is not in the summary, and I don't see it mentioned at all

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.

It does; At the end. I mention time64 but not libc_unstable_time64
because all our public cfgs require libc_unstable_ to be prepended
to them. It seems to me like the commit history is something internal.

The PR summary also mentions it, though I get it is confusing to say
that the cfg itself is named time64.

The name of the cfg is time64.

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.

It won't always be the case that they have a common prefix, this one is going to be stabilized as libc_time64. Just refer to them by the exact name to avoid confusion, when somebody greps in commit logs they're most likely going to be looking for the exact name rather than a substring of it.

Original file line number Diff line number Diff line change
Expand Up @@ -746,14 +746,16 @@ fn test_windows(t: &Target) {
}
cfg.define("_WIN32_WINNT", Some("0x8000"));

let win_gnu_x86_time64 = match env::var("CARGO_CFG_LIBC_UNSTABLE_GNU_TIME_BITS") {
let time64 = env_flag("CARGO_CFG_LIBC_UNSTABLE_TIME64");
let mut win_gnu_x86_time64 = match env::var("CARGO_CFG_LIBC_UNSTABLE_GNU_TIME_BITS") {
Ok(v) if v == "64" => true,
Ok(v) if v == "32" => false,
Ok(_) => {
panic!("Invalid value for `libc_unstable_gnu_time_bits`. Must be 32, 64 or unset.");
}
Err(_) => false,
};
win_gnu_x86_time64 |= time64;

// Needed for the Windows `time_t` test.
println!("cargo::rustc-check-cfg=cfg(gnu_time_bits64)");
Expand Down Expand Up @@ -3877,6 +3879,7 @@ fn config_gnu_bits(t: &Target, cfg: &mut ctest::TestGenerator) {
if t.gnu() && t.linux() && !t.x32() && !t.riscv32() && t.pointer_width == P32 {
let defaultbits = "32";
let mut tb_env = env::var("CARGO_CFG_LIBC_UNSTABLE_GNU_TIME_BITS");
let time64 = env_flag("CARGO_CFG_LIBC_UNSTABLE_TIME64");

// FIXME: remove these fallbacks in a few releases
if let Ok(old_tb_env) = env::var("RUST_LIBC_UNSTABLE_GNU_TIME_BITS") {
Expand Down Expand Up @@ -3905,7 +3908,7 @@ fn config_gnu_bits(t: &Target, cfg: &mut ctest::TestGenerator) {
}
};

if timebits == "64" {
if timebits == "64" || time64 {
cfg.define("_TIME_BITS", Some("64"));
cfg.define("_FILE_OFFSET_BITS", Some("64"));
cfg.cfg("linux_time_bits64", None);
Expand Down Expand Up @@ -3970,21 +3973,23 @@ fn test_linux(t: &Target) {
None => panic!("failed to detect kernel version for Linux target {t:?}",),
};

let time64 = env_flag("CARGO_CFG_LIBC_UNSTABLE_TIME64");

let mut musl_v1_2 = env_flag("CARGO_CFG_LIBC_UNSTABLE_MUSL_V1_2");
if musl_v1_2 {
assert!(musl);
}

// Some platforms only exist with recent musl. Keep in sync with libc's build.rs.
if musl && (loongarch64 || hexagon || pauthtest/* || ohos */) {
if musl && (loongarch64 || hexagon || pauthtest/* || ohos */ || time64) {
musl_v1_2 = true;
}

let old_musl = musl && !musl_v1_2;

let mut cfg = ctest_cfg();

if musl_v1_2 {
if musl && musl_v1_2 {
cfg.cfg("musl_v1_2", None);
if p32 {
cfg.cfg("musl32_time64", None);
Expand All @@ -3996,7 +4001,7 @@ fn test_linux(t: &Target) {
}

let uclibc_time64_env = env_flag("CARGO_CFG_LIBC_UNSTABLE_UCLIBC_TIME64");
let uclibc32_time64 = uclibc && p32 && uclibc_time64_env;
let uclibc32_time64 = uclibc && p32 && (uclibc_time64_env || time64);

if uclibc32_time64 {
cfg.cfg("linux_time_bits64", None);
Expand Down
Loading