Skip to content
Open
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
46 changes: 23 additions & 23 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 @@ -386,34 +386,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 on lines 388 to +402

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's fine to reformat this if it makes things more consistent, but please put it in a separate 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.

Done. I didn't even notice this. Must have been format on save while
editing the CI file.


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
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 @@ -170,6 +170,9 @@ fn main() {
// OpenHarmony uses a fork of the musl libc
let musl = target_env == "musl" || target_env == "ohos";

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

// loongarch64, hexagon, ohos and pauthtest only exist with recent musl
if target_arch == "loongarch64"
|| target_arch == "hexagon"
Expand All @@ -179,7 +182,7 @@ fn main() {
musl_v1_2 = true;
}

if musl && musl_v1_2 {
if musl && (musl_v1_2 || time64) {
set_cfg("musl_v1_2");
if target_ptr_width == "32" {
set_cfg("musl32_time64");
Expand All @@ -191,7 +194,7 @@ fn main() {
}

let uclibc_use_time64 = env_flag("CARGO_CFG_LIBC_UNSTABLE_UCLIBC_TIME64");
if target_env == "uclibc" && uclibc_use_time64 {
if target_env == "uclibc" && (uclibc_use_time64 || time64) {
set_cfg("linux_time_bits64");
}

Expand Down Expand Up @@ -231,7 +234,7 @@ fn main() {
}
};

if timebits == "64" {
if timebits == "64" || time64 {
set_cfg("linux_time_bits64");
set_cfg("gnu_file_offset_bits64");
set_cfg("gnu_time_bits64");
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
11 changes: 4 additions & 7 deletions ci/verify-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,13 +409,10 @@ 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:
# Global toggle for _TIME_BITS=64 on glibc, and musl breaking changes
# concerning 64-bit time_t.
run(cmd, rustflags=f"{rustflags} --cfg=libc_unstable_time64")

# Test again without default features, i.e. without `std`
run([*cmd, "--no-default-features"], rustflags=rustflags)
Expand Down
12 changes: 8 additions & 4 deletions libc-test/build/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@ fn test_windows(t: &Target) {
}
cfg.define("_WIN32_WINNT", Some("0x8000"));

let time64 = env_flag("CARGO_CFG_LIBC_UNSTABLE_TIME64");
let 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,
Expand All @@ -745,7 +746,7 @@ fn test_windows(t: &Target) {
// Needed for the Windows `time_t` test.
println!("cargo::rustc-check-cfg=cfg(gnu_time_bits64)");

if x86_32 && gnu && win_gnu_x86_time64 {
if x86_32 && gnu && (win_gnu_x86_time64 || time64) {
cfg.cfg("gnu_time_bits64", None);
println!("cargo::rustc-cfg=gnu_time_bits64");
}
Expand Down Expand Up @@ -3855,6 +3856,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 @@ -3883,7 +3885,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 @@ -3948,6 +3950,8 @@ 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);
Expand All @@ -3962,7 +3966,7 @@ fn test_linux(t: &Target) {

let mut cfg = ctest_cfg();

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

let uclibc_use_time64 = env_flag("CARGO_CFG_LIBC_UNSTABLE_UCLIBC_TIME64");
if uclibc && uclibc_use_time64 {
if uclibc && (uclibc_use_time64 || time64) {
cfg.cfg("linux_time_bits64", None);
}
cfg.define("_GNU_SOURCE", None)
Expand Down