rust icon indicating copy to clipboard operation
rust copied to clipboard

Add Duration from nanos u128

Open omanirudh opened this issue 9 months ago • 35 comments

What does this PR do?

This draft PR adds the Duration::from_nanos_u128 function to handle durations that exceed the range of u64, allowing for time spans greater than ~584 years.

Motivation

The current Duration API does not support creating durations from nanoseconds represented as u128. This addition addresses that limitation.

Tracking Issue

Fixes #139201

Details

  • Introduced Duration::from_nanos_u128 as a const fn similar to other functions in the file.

  • Ensured safety by validating the nanoseconds before using unsafe code.

  • To do : complete the documentation and examples for the new function.

    r? @RalfJung

omanirudh avatar Apr 02 '25 08:04 omanirudh

r? @tgross35

rustbot has assigned @tgross35. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

rustbot avatar Apr 02 '25 08:04 rustbot

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] build_script_build test:false 0.295
error: associated function has missing stability attribute
   --> library/core/src/time.rs:324:5
    |
324 | /     pub const fn from_nanos_u128(nanos: u128) -> Duration {
325 | |         const NANOS_PER_SEC: u128 = self::NANOS_PER_SEC as u128;
326 | |         let secs = nanos / NANOS_PER_SEC;
327 | |         let subsec_nanos = (nanos % NANOS_PER_SEC) as u32;
...   |
331 | |         Duration { secs, nanos: subsec_nanos }
332 | |     }
    | |_____^

error: associated function has missing const stability attribute
   --> library/core/src/time.rs:324:5
    |
324 | /     pub const fn from_nanos_u128(nanos: u128) -> Duration {
325 | |         const NANOS_PER_SEC: u128 = self::NANOS_PER_SEC as u128;
326 | |         let secs = nanos / NANOS_PER_SEC;
327 | |         let subsec_nanos = (nanos % NANOS_PER_SEC) as u32;
...   |
331 | |         Duration { secs, nanos: subsec_nanos }
332 | |     }
    | |_____^

error[E0308]: mismatched types
   --> library/core/src/time.rs:331:20
    |
331 |         Duration { secs, nanos: subsec_nanos }
    |                    ^^^^ expected `u64`, found `u128`

For more information about this error, try `rustc --explain E0308`.
[RUSTC-TIMING] core test:false 7.216
error: could not compile `core` (lib) due to 3 previous errors
Build completed unsuccessfully in 0:00:41

rust-log-analyzer avatar Apr 02 '25 08:04 rust-log-analyzer

The job x86_64-gnu-llvm-18 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#20 exporting to docker image format
#20 sending tarball 19.7s done
#20 DONE 25.4s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-18]
[CI_JOB_NAME=x86_64-gnu-llvm-18]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Listening on address 127.0.0.1:4226
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-18', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'build.print-step-timings', '--enable-verbose-tests', '--set', 'build.metrics', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: build.build          := x86_64-unknown-linux-gnu
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-18/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
[RUSTC-TIMING] build_script_build test:false 0.281
error[E0308]: mismatched types
   --> library/core/src/time.rs:332:20
    |
332 |         Duration { secs, nanos: subsec_nanos }
    |                    ^^^^ expected `u64`, found `u128`

For more information about this error, try `rustc --explain E0308`.
[RUSTC-TIMING] core test:false 7.269
error: could not compile `core` (lib) due to 1 previous error
Build completed unsuccessfully in 0:00:22

rust-log-analyzer avatar Apr 02 '25 10:04 rust-log-analyzer

Thanks for taking this over! However, this needs a libs reviewer. I just proposed the API. :)

r? libs

RalfJung avatar Apr 02 '25 12:04 RalfJung

Thanks for taking this over! However, this needs a libs reviewer. I just proposed the API. :)

r? libs

Happy to take this up. noted.

omanirudh avatar Apr 02 '25 15:04 omanirudh

@rustbot author

tgross35 avatar Apr 02 '25 18:04 tgross35

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

rustbot avatar Apr 02 '25 18:04 rustbot

The job x86_64-gnu-llvm-18 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#19 exporting to docker image format
#19 sending tarball 21.3s done
#19 DONE 34.3s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-18]
[CI_JOB_NAME=x86_64-gnu-llvm-18]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Listening on address 127.0.0.1:4226
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-18', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'build.print-step-timings', '--enable-verbose-tests', '--set', 'build.metrics', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: build.build          := x86_64-unknown-linux-gnu
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-18/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
[RUSTC-TIMING] build_script_build test:false 0.284
error: crate-level attribute should be in the root module
 --> library/core/src/time.rs:2:1
  |
2 | #![feature(duration_from_nanos_u128)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `-D unused-attributes` implied by `-D warnings`
  = help: to override `-D warnings` add `#[allow(unused_attributes)]`

error[E0308]: mismatched types
   --> library/core/src/time.rs:332:20
    |
332 |         Duration { secs, nanos: subsec_nanos }
    |                    ^^^^ expected `u64`, found `u128`

For more information about this error, try `rustc --explain E0308`.
[RUSTC-TIMING] core test:false 7.214
error: could not compile `core` (lib) due to 2 previous errors
Build completed unsuccessfully in 0:00:23

rust-log-analyzer avatar Apr 03 '25 06:04 rust-log-analyzer

The job x86_64-gnu-llvm-18 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#20 exporting to docker image format
#20 sending tarball 19.7s done
#20 DONE 24.9s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-18]
[CI_JOB_NAME=x86_64-gnu-llvm-18]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Listening on address 127.0.0.1:4226
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-18', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'build.print-step-timings', '--enable-verbose-tests', '--set', 'build.metrics', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: build.build          := x86_64-unknown-linux-gnu
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-18/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
[RUSTC-TIMING] build_script_build test:false 0.277
error: crate-level attribute should be in the root module
 --> library/core/src/time.rs:2:1
  |
2 | #![feature(duration_from_nanos_u128)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `-D unused-attributes` implied by `-D warnings`
  = help: to override `-D warnings` add `#[allow(unused_attributes)]`

error[E0308]: mismatched types
   --> library/core/src/time.rs:333:20
    |
333 |         Duration { secs, nanos: subsec_nanos }
    |                    ^^^^ expected `u64`, found `u128`

For more information about this error, try `rustc --explain E0308`.
[RUSTC-TIMING] core test:false 7.237
error: could not compile `core` (lib) due to 2 previous errors
Build completed unsuccessfully in 0:00:22

rust-log-analyzer avatar Apr 03 '25 11:04 rust-log-analyzer

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] build_script_build test:false 0.309
error[E0308]: mismatched types
   --> library/core/src/time.rs:332:20
    |
332 |         Duration { secs, nanos: subsec_nanos }
    |                    ^^^^ expected `u64`, found `u128`

For more information about this error, try `rustc --explain E0308`.
[RUSTC-TIMING] core test:false 7.379
error: could not compile `core` (lib) due to 1 previous error
Build completed unsuccessfully in 0:00:42

rust-log-analyzer avatar Apr 03 '25 11:04 rust-log-analyzer

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] build_script_build test:false 0.172
[RUSTC-TIMING] cc test:false 0.572
   Compiling compiler_builtins v0.1.152
[RUSTC-TIMING] build_script_build test:false 0.279
error[E0015]: cannot call non-const associated function `<u64 as TryFrom<u128>>::try_from` in constant functions
   --> library/core/src/time.rs:327:20
    |
327 |         let secs = u64::try_from(nanos / NANOS_PER_SEC).unwrap_or(u64::MAX);
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants

error[E0015]: cannot call non-const method `result::Result::<u64, TryFromIntError>::unwrap_or` in constant functions
   --> library/core/src/time.rs:327:57
    |
327 |         let secs = u64::try_from(nanos / NANOS_PER_SEC).unwrap_or(u64::MAX);
    |                                                         ^^^^^^^^^^^^^^^^^^^
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants

For more information about this error, try `rustc --explain E0015`.

rust-log-analyzer avatar Apr 03 '25 12:04 rust-log-analyzer

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
info: removing rustup binaries
info: rustup is uninstalled
##[group]Image checksum input
mingw-check-tidy
# We use the ghcr base image because ghcr doesn't have a rate limit
# and the mingw-check-tidy job doesn't cache docker images in CI.
FROM ghcr.io/rust-lang/ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
  g++ \
  make \
---

COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/

# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \
           --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---
#12 4.166   Downloading virtualenv-20.30.0-py3-none-any.whl (4.3 MB)
#12 4.319      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.3/4.3 MB 28.9 MB/s eta 0:00:00
#12 4.383 Collecting filelock<4,>=3.12.2
#12 4.390   Downloading filelock-3.18.0-py3-none-any.whl (16 kB)
#12 4.429 Collecting platformdirs<5,>=3.9.1
#12 4.436   Downloading platformdirs-4.3.7-py3-none-any.whl (18 kB)
#12 4.458 Collecting distlib<1,>=0.3.7
#12 4.466   Downloading distlib-0.3.9-py2.py3-none-any.whl (468 kB)
#12 4.478      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 469.0/469.0 KB 47.6 MB/s eta 0:00:00
#12 4.560 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#12 4.747 Successfully installed distlib-0.3.9 filelock-3.18.0 platformdirs-4.3.7 virtualenv-20.30.0
#12 4.747 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#12 DONE 4.8s

#13 [7/8] COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
#13 DONE 0.0s
---
DirectMap4k:      131008 kB
DirectMap2M:     6160384 kB
DirectMap1G:    12582912 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 python2.7 ../x.py test            --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
+ TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.05s
##[endgroup]
WARN: currently no CI rustc builds have rustc debug assertions enabled. Please either set `rust.debug-assertions` to `false` if you want to use download CI rustc or set `rust.download-rustc` to `false`.
[TIMING] core::build_steps::tool::LibcxxVersionTool { target: x86_64-unknown-linux-gnu } -- 0.218
---
##[endgroup]
[TIMING] core::build_steps::tool::ToolBuild { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu, tool: "tidy", path: "src/tools/tidy", mode: ToolBootstrap, source_type: InTree, extra_features: [], allow_features: "", cargo_args: [], artifact_kind: Binary } -- 36.734
[TIMING] core::build_steps::tool::Tidy { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu } -- 0.000
fmt check
Diff in /checkout/library/core/src/time.rs:307:
         Duration { secs, nanos: subsec_nanos }
     }
 
-
     /// Creates a new Duration from the specified number of nanoseconds.
-    /// 
-    /// # Panics 
     ///
+    /// # Panics
+    ///
     /// Panics if the given number of weeks overflows the `Duration` size.
-    /// Use this function if you need to specify time greater than what can fit in u64 
+    /// Use this function if you need to specify time greater than what can fit in u64
     /// (around 584 years).
-    /// 
-    /// # Examples 
-    /// 
+    ///
+    /// # Examples
+    ///
     /// ```
     /// #![feature(duration_from_nanos_u128)]
     /// use std::time::Duration;
Diff in /checkout/library/core/src/time.rs:327:
     #[unstable(feature = "duration_from_nanos_u128", issue = "139201")]
     pub const fn from_nanos_u128(nanos: u128) -> Duration {
         const NANOS_PER_SEC: u128 = self::NANOS_PER_SEC as u128;
-        let secs : u64 = (nanos/ NANOS_PER_SEC) as u64 ;
+        let secs: u64 = (nanos / NANOS_PER_SEC) as u64;
         let subsec_nanos = (nanos % NANOS_PER_SEC) as u32;
         // SAFETY: x % 1_000_000_000 < 1_000_000_000
         let subsec_nanos = unsafe { Nanoseconds::new_unchecked(subsec_nanos) };
Diff in /checkout/library/core/src/time.rs:334:
 
         Duration { secs, nanos: subsec_nanos }
     }
-    
+
     /// Creates a new `Duration` from the specified number of weeks.
     ///
     /// # Panics
fmt: checked 5954 files
Build completed unsuccessfully in 0:01:17
  local time: Thu Apr 10 10:20:21 UTC 2025

rust-log-analyzer avatar Apr 10 '25 10:04 rust-log-analyzer

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
info: removing rustup binaries
info: rustup is uninstalled
##[group]Image checksum input
mingw-check-tidy
# We use the ghcr base image because ghcr doesn't have a rate limit
# and the mingw-check-tidy job doesn't cache docker images in CI.
FROM ghcr.io/rust-lang/ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
  g++ \
  make \
---

COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/

# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \
           --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---
#12 2.972 Building wheels for collected packages: reuse
#12 2.973   Building wheel for reuse (pyproject.toml): started
#12 3.189   Building wheel for reuse (pyproject.toml): finished with status 'done'
#12 3.190   Created wheel for reuse: filename=reuse-4.0.3-cp310-cp310-manylinux_2_35_x86_64.whl size=132719 sha256=5bb60f62728aaedff7162745ce743c7f2f55069b3e7f82e6a37d70df455797cc
#12 3.190   Stored in directory: /tmp/pip-ephem-wheel-cache-csrx3d50/wheels/3d/8d/0a/e0fc6aba4494b28a967ab5eaf951c121d9c677958714e34532
#12 3.192 Successfully built reuse
#12 3.193 Installing collected packages: boolean-py, binaryornot, tomlkit, reuse, python-debian, markupsafe, license-expression, jinja2, chardet, attrs
#12 3.592 Successfully installed attrs-23.2.0 binaryornot-0.4.4 boolean-py-4.0 chardet-5.2.0 jinja2-3.1.4 license-expression-30.3.0 markupsafe-2.1.5 python-debian-0.1.49 reuse-4.0.3 tomlkit-0.13.0
#12 3.592 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#12 4.140 Collecting virtualenv
#12 4.194   Downloading virtualenv-20.30.0-py3-none-any.whl (4.3 MB)
#12 4.429      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.3/4.3 MB 18.6 MB/s eta 0:00:00
#12 4.493 Collecting filelock<4,>=3.12.2
#12 4.503   Downloading filelock-3.18.0-py3-none-any.whl (16 kB)
#12 4.544 Collecting platformdirs<5,>=3.9.1
#12 4.554   Downloading platformdirs-4.3.7-py3-none-any.whl (18 kB)
#12 4.577 Collecting distlib<1,>=0.3.7
#12 4.587   Downloading distlib-0.3.9-py2.py3-none-any.whl (468 kB)
#12 4.604      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 469.0/469.0 KB 30.6 MB/s eta 0:00:00
#12 4.685 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#12 4.871 Successfully installed distlib-0.3.9 filelock-3.18.0 platformdirs-4.3.7 virtualenv-20.30.0
#12 4.871 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#12 DONE 4.9s

#13 [7/8] COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
#13 DONE 0.0s
---
DirectMap4k:      124864 kB
DirectMap2M:     8263680 kB
DirectMap1G:    10485760 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 python2.7 ../x.py test            --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
+ TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.05s
##[endgroup]
WARN: currently no CI rustc builds have rustc debug assertions enabled. Please either set `rust.debug-assertions` to `false` if you want to use download CI rustc or set `rust.download-rustc` to `false`.
[TIMING] core::build_steps::tool::LibcxxVersionTool { target: x86_64-unknown-linux-gnu } -- 0.216
---
##[endgroup]
[TIMING] core::build_steps::tool::ToolBuild { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu, tool: "tidy", path: "src/tools/tidy", mode: ToolBootstrap, source_type: InTree, extra_features: [], allow_features: "", cargo_args: [], artifact_kind: Binary } -- 36.085
[TIMING] core::build_steps::tool::Tidy { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu } -- 0.000
fmt check
Diff in /checkout/library/core/src/time.rs:307:
         Duration { secs, nanos: subsec_nanos }
     }
 
-
     /// Creates a new Duration from the specified number of nanoseconds.
-    /// 
-    /// # Panics 
     ///
+    /// # Panics
+    ///
     /// Panics if the given number of weeks overflows the `Duration` size.
-    /// Use this function if you need to specify time greater than what can fit in u64 
+    /// Use this function if you need to specify time greater than what can fit in u64
     /// (around 584 years).
-    /// 
-    /// # Examples 
-    /// 
+    ///
+    /// # Examples
+    ///
     /// ```
     /// #![feature(duration_from_nanos_u128)]
     /// use std::time::Duration;
Diff in /checkout/library/core/src/time.rs:329:
     #[inline]
     pub const fn from_nanos_u128(nanos: u128) -> Duration {
         const NANOS_PER_SEC: u128 = self::NANOS_PER_SEC as u128;
-        let secs : u64 = (nanos/ NANOS_PER_SEC) as u64 ;
+        let secs: u64 = (nanos / NANOS_PER_SEC) as u64;
         let subsec_nanos = (nanos % NANOS_PER_SEC) as u32;
         // SAFETY: x % 1_000_000_000 < 1_000_000_000
         let subsec_nanos = unsafe { Nanoseconds::new_unchecked(subsec_nanos) };
Diff in /checkout/library/core/src/time.rs:336:
 
         Duration { secs, nanos: subsec_nanos }
     }
-    
+
     /// Creates a new `Duration` from the specified number of weeks.
     ///
     /// # Panics
fmt: checked 5954 files
Build completed unsuccessfully in 0:01:16
  local time: Thu Apr 10 13:39:43 UTC 2025

rust-log-analyzer avatar Apr 10 '25 13:04 rust-log-analyzer

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
info: removing rustup binaries
info: rustup is uninstalled
##[group]Image checksum input
mingw-check-tidy
# We use the ghcr base image because ghcr doesn't have a rate limit
# and the mingw-check-tidy job doesn't cache docker images in CI.
FROM ghcr.io/rust-lang/ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
  g++ \
  make \
---

COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/

# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \
           --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---
#12 2.814 Building wheels for collected packages: reuse
#12 2.815   Building wheel for reuse (pyproject.toml): started
#12 3.041   Building wheel for reuse (pyproject.toml): finished with status 'done'
#12 3.042   Created wheel for reuse: filename=reuse-4.0.3-cp310-cp310-manylinux_2_35_x86_64.whl size=132719 sha256=5bb60f62728aaedff7162745ce743c7f2f55069b3e7f82e6a37d70df455797cc
#12 3.042   Stored in directory: /tmp/pip-ephem-wheel-cache-ubl4u_lu/wheels/3d/8d/0a/e0fc6aba4494b28a967ab5eaf951c121d9c677958714e34532
#12 3.044 Successfully built reuse
#12 3.045 Installing collected packages: boolean-py, binaryornot, tomlkit, reuse, python-debian, markupsafe, license-expression, jinja2, chardet, attrs
#12 3.452 Successfully installed attrs-23.2.0 binaryornot-0.4.4 boolean-py-4.0 chardet-5.2.0 jinja2-3.1.4 license-expression-30.3.0 markupsafe-2.1.5 python-debian-0.1.49 reuse-4.0.3 tomlkit-0.13.0
#12 3.452 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#12 4.031 Collecting virtualenv
#12 4.074   Downloading virtualenv-20.30.0-py3-none-any.whl (4.3 MB)
#12 4.139      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.3/4.3 MB 70.3 MB/s eta 0:00:00
#12 4.197 Collecting platformdirs<5,>=3.9.1
#12 4.201   Downloading platformdirs-4.3.7-py3-none-any.whl (18 kB)
#12 4.221 Collecting distlib<1,>=0.3.7
#12 4.225   Downloading distlib-0.3.9-py2.py3-none-any.whl (468 kB)
#12 4.234      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 469.0/469.0 KB 79.2 MB/s eta 0:00:00
#12 4.270 Collecting filelock<4,>=3.12.2
#12 4.274   Downloading filelock-3.18.0-py3-none-any.whl (16 kB)
#12 4.359 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#12 4.550 Successfully installed distlib-0.3.9 filelock-3.18.0 platformdirs-4.3.7 virtualenv-20.30.0
#12 4.551 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#12 DONE 4.7s

#13 [7/8] COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
#13 DONE 0.0s
---
DirectMap4k:      137152 kB
DirectMap2M:     9299968 kB
DirectMap1G:     9437184 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 python2.7 ../x.py test            --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
+ TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.05s
##[endgroup]
WARN: currently no CI rustc builds have rustc debug assertions enabled. Please either set `rust.debug-assertions` to `false` if you want to use download CI rustc or set `rust.download-rustc` to `false`.
[TIMING] core::build_steps::tool::LibcxxVersionTool { target: x86_64-unknown-linux-gnu } -- 0.225
---
##[endgroup]
[TIMING] core::build_steps::tool::ToolBuild { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu, tool: "tidy", path: "src/tools/tidy", mode: ToolBootstrap, source_type: InTree, extra_features: [], allow_features: "", cargo_args: [], artifact_kind: Binary } -- 37.298
[TIMING] core::build_steps::tool::Tidy { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu } -- 0.000
fmt check
Diff in /checkout/library/core/src/time.rs:307:
         Duration { secs, nanos: subsec_nanos }
     }
 
-
     /// Creates a new Duration from the specified number of nanoseconds.
-    /// 
-    /// # Panics 
     ///
+    /// # Panics
+    ///
     /// Panics if the given number of weeks overflows the `Duration` size.
-    /// Use this function if you need to specify time greater than what can fit in u64 
+    /// Use this function if you need to specify time greater than what can fit in u64
     /// (around 584 years).
-    /// 
-    /// # Examples 
-    /// 
+    ///
+    /// # Examples
+    ///
     /// ```
     /// #![feature(duration_from_nanos_u128)]
     /// use std::time::Duration;
Diff in /checkout/library/core/src/time.rs:329:
     #[inline]
     pub const fn from_nanos_u128(nanos: u128) -> Duration {
         const NANOS_PER_SEC: u128 = self::NANOS_PER_SEC as u128;
-        let secs : u64 = (nanos/ NANOS_PER_SEC) as u64 ;
+        let secs: u64 = (nanos / NANOS_PER_SEC) as u64;
         let subsec_nanos = (nanos % NANOS_PER_SEC) as u32;
         // SAFETY: x % 1_000_000_000 < 1_000_000_000
         let subsec_nanos = unsafe { Nanoseconds::new_unchecked(subsec_nanos) };
Diff in /checkout/library/core/src/time.rs:336:
 
         Duration { secs, nanos: subsec_nanos }
     }
-    
+
     /// Creates a new `Duration` from the specified number of weeks.
     ///
     /// # Panics
fmt: checked 5954 files
Build completed unsuccessfully in 0:01:18
  local time: Thu Apr 10 14:02:35 UTC 2025

rust-log-analyzer avatar Apr 10 '25 14:04 rust-log-analyzer

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
info: removing rustup binaries
info: rustup is uninstalled
##[group]Image checksum input
mingw-check-tidy
# We use the ghcr base image because ghcr doesn't have a rate limit
# and the mingw-check-tidy job doesn't cache docker images in CI.
FROM ghcr.io/rust-lang/ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
  g++ \
  make \
---

COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/

# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \
           --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---
#12 3.535 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#12 4.094 Collecting virtualenv
#12 4.143   Downloading virtualenv-20.30.0-py3-none-any.whl (4.3 MB)
#12 4.340      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.3/4.3 MB 22.4 MB/s eta 0:00:00
#12 4.400 Collecting platformdirs<5,>=3.9.1
#12 4.408   Downloading platformdirs-4.3.7-py3-none-any.whl (18 kB)
#12 4.432 Collecting distlib<1,>=0.3.7
#12 4.440   Downloading distlib-0.3.9-py2.py3-none-any.whl (468 kB)
#12 4.453      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 469.0/469.0 KB 40.6 MB/s eta 0:00:00
#12 4.494 Collecting filelock<4,>=3.12.2
#12 4.502   Downloading filelock-3.18.0-py3-none-any.whl (16 kB)
#12 4.585 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#12 4.772 Successfully installed distlib-0.3.9 filelock-3.18.0 platformdirs-4.3.7 virtualenv-20.30.0
#12 4.773 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#12 DONE 4.9s

#13 [7/8] COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
#13 DONE 0.0s
---
DirectMap4k:      133056 kB
DirectMap2M:     8255488 kB
DirectMap1G:    10485760 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 python2.7 ../x.py test            --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
+ TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.05s
##[endgroup]
WARN: currently no CI rustc builds have rustc debug assertions enabled. Please either set `rust.debug-assertions` to `false` if you want to use download CI rustc or set `rust.download-rustc` to `false`.
[TIMING] core::build_steps::tool::LibcxxVersionTool { target: x86_64-unknown-linux-gnu } -- 0.218
---
##[endgroup]
[TIMING] core::build_steps::tool::ToolBuild { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu, tool: "tidy", path: "src/tools/tidy", mode: ToolBootstrap, source_type: InTree, extra_features: [], allow_features: "", cargo_args: [], artifact_kind: Binary } -- 35.716
[TIMING] core::build_steps::tool::Tidy { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu } -- 0.000
fmt check
Diff in /checkout/library/core/src/time.rs:307:
         Duration { secs, nanos: subsec_nanos }
     }
 
-
     /// Creates a new Duration from the specified number of nanoseconds.
-    /// 
-    /// # Panics 
     ///
+    /// # Panics
+    ///
     /// Panics if the given number of weeks overflows the `Duration` size.
-    /// Use this function if you need to specify time greater than what can fit in u64 
+    /// Use this function if you need to specify time greater than what can fit in u64
     /// (around 584 years).
-    /// 
-    /// # Examples 
-    /// 
+    ///
+    /// # Examples
+    ///
     /// ```
     /// #![feature(duration_from_nanos_u128)]
     /// use std::time::Duration;
Diff in /checkout/library/core/src/time.rs:329:
     #[inline]
     pub const fn from_nanos_u128(nanos: u128) -> Duration {
         const NANOS_PER_SEC: u128 = self::NANOS_PER_SEC as u128;
-        let secs : u64 = (nanos/ NANOS_PER_SEC) as u64 ;
+        let secs: u64 = (nanos / NANOS_PER_SEC) as u64;
         let subsec_nanos = (nanos % NANOS_PER_SEC) as u32;
         // SAFETY: x % 1_000_000_000 < 1_000_000_000
         let subsec_nanos = unsafe { Nanoseconds::new_unchecked(subsec_nanos) };
Diff in /checkout/library/core/src/time.rs:336:
 
         Duration { secs, nanos: subsec_nanos }
     }
-    
+
     /// Creates a new `Duration` from the specified number of weeks.
     ///
     /// # Panics
fmt: checked 5954 files
Build completed unsuccessfully in 0:01:16
  local time: Thu Apr 10 14:17:01 UTC 2025

rust-log-analyzer avatar Apr 10 '25 14:04 rust-log-analyzer

There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

You can start a rebase with the following commands:

$ # rebase
$ git pull --rebase https://github.com/rust-lang/rust.git master
$ git push --force-with-lease

The following commits are merge commits:

  • d6bbb93cfea15e2a3efd135c35dab5aa40690eb8
  • 3f6301d7b9c17638db4e287c28df44586ea99f52

rustbot avatar Apr 10 '25 15:04 rustbot

There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

You can start a rebase with the following commands:

$ # rebase
$ git pull --rebase https://github.com/rust-lang/rust.git master
$ git push --force-with-lease

The following commits are merge commits (since this message was last posted):

  • 6600cdf1c99be897a709d8d6f271758831a34baa

rustbot avatar Apr 11 '25 06:04 rustbot

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
info: removing rustup binaries
info: rustup is uninstalled
##[group]Image checksum input
mingw-check-tidy
# We use the ghcr base image because ghcr doesn't have a rate limit
# and the mingw-check-tidy job doesn't cache docker images in CI.
FROM ghcr.io/rust-lang/ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
  g++ \
  make \
---

COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/

# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \
           --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---
#12 2.981 Building wheels for collected packages: reuse
#12 2.982   Building wheel for reuse (pyproject.toml): started
#12 3.193   Building wheel for reuse (pyproject.toml): finished with status 'done'
#12 3.194   Created wheel for reuse: filename=reuse-4.0.3-cp310-cp310-manylinux_2_35_x86_64.whl size=132719 sha256=5bb60f62728aaedff7162745ce743c7f2f55069b3e7f82e6a37d70df455797cc
#12 3.194   Stored in directory: /tmp/pip-ephem-wheel-cache-xtxe__jw/wheels/3d/8d/0a/e0fc6aba4494b28a967ab5eaf951c121d9c677958714e34532
#12 3.197 Successfully built reuse
#12 3.197 Installing collected packages: boolean-py, binaryornot, tomlkit, reuse, python-debian, markupsafe, license-expression, jinja2, chardet, attrs
#12 3.596 Successfully installed attrs-23.2.0 binaryornot-0.4.4 boolean-py-4.0 chardet-5.2.0 jinja2-3.1.4 license-expression-30.3.0 markupsafe-2.1.5 python-debian-0.1.49 reuse-4.0.3 tomlkit-0.13.0
#12 3.596 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#12 4.123 Collecting virtualenv
#12 4.162   Downloading virtualenv-20.30.0-py3-none-any.whl (4.3 MB)
#12 4.260      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.3/4.3 MB 45.1 MB/s eta 0:00:00
#12 4.319 Collecting filelock<4,>=3.12.2
#12 4.323   Downloading filelock-3.18.0-py3-none-any.whl (16 kB)
#12 4.341 Collecting distlib<1,>=0.3.7
#12 4.344   Downloading distlib-0.3.9-py2.py3-none-any.whl (468 kB)
#12 4.353      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 469.0/469.0 KB 68.2 MB/s eta 0:00:00
#12 4.386 Collecting platformdirs<5,>=3.9.1
#12 4.389   Downloading platformdirs-4.3.7-py3-none-any.whl (18 kB)
#12 4.471 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#12 4.657 Successfully installed distlib-0.3.9 filelock-3.18.0 platformdirs-4.3.7 virtualenv-20.30.0
#12 4.657 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#12 DONE 4.7s

#13 [7/8] COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
#13 DONE 0.0s
---
DirectMap4k:      131008 kB
DirectMap2M:     7208960 kB
DirectMap1G:    11534336 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 python2.7 ../x.py test            --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
+ TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.05s
##[endgroup]
WARN: currently no CI rustc builds have rustc debug assertions enabled. Please either set `rust.debug-assertions` to `false` if you want to use download CI rustc or set `rust.download-rustc` to `false`.
[TIMING] core::build_steps::tool::LibcxxVersionTool { target: x86_64-unknown-linux-gnu } -- 0.214
---
##[endgroup]
[TIMING] core::build_steps::tool::ToolBuild { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu, tool: "tidy", path: "src/tools/tidy", mode: ToolBootstrap, source_type: InTree, extra_features: [], allow_features: "", cargo_args: [], artifact_kind: Binary } -- 36.384
[TIMING] core::build_steps::tool::Tidy { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu } -- 0.000
fmt check
Diff in /checkout/library/core/src/time.rs:307:
         Duration { secs, nanos: subsec_nanos }
     }
 
-
     /// Creates a new Duration from the specified number of nanoseconds.
-    /// 
-    /// # Panics 
     ///
+    /// # Panics
+    ///
     /// Panics if the given number of weeks overflows the `Duration` size.
-    /// Use this function if you need to specify time greater than what can fit in u64 
+    /// Use this function if you need to specify time greater than what can fit in u64
     /// (around 584 years).
-    /// 
-    /// # Examples 
-    /// 
+    ///
+    /// # Examples
+    ///
     /// ```
     /// #![feature(duration_from_nanos_u128)]
     /// use std::time::Duration;
Diff in /checkout/library/core/src/time.rs:329:
     #[inline]
     pub const fn from_nanos_u128(nanos: u128) -> Duration {
         const NANOS_PER_SEC: u128 = self::NANOS_PER_SEC as u128;
-        let secs : u64 = (nanos/ NANOS_PER_SEC) as u64 ;
+        let secs: u64 = (nanos / NANOS_PER_SEC) as u64;
         let subsec_nanos = (nanos % NANOS_PER_SEC) as u32;
         // SAFETY: x % 1_000_000_000 < 1_000_000_000
         let subsec_nanos = unsafe { Nanoseconds::new_unchecked(subsec_nanos) };
Diff in /checkout/library/core/src/time.rs:336:
 
         Duration { secs, nanos: subsec_nanos }
     }
-    
+
     /// Creates a new `Duration` from the specified number of weeks.
     ///
     /// # Panics
fmt: checked 5956 files
Build completed unsuccessfully in 0:01:16
  local time: Fri Apr 11 06:26:15 UTC 2025

rust-log-analyzer avatar Apr 11 '25 06:04 rust-log-analyzer

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged. Otherwise, you can ignore this comment.

rustbot avatar Apr 11 '25 08:04 rustbot

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
info: removing rustup binaries
info: rustup is uninstalled
##[group]Image checksum input
mingw-check-tidy
# We use the ghcr base image because ghcr doesn't have a rate limit
# and the mingw-check-tidy job doesn't cache docker images in CI.
FROM ghcr.io/rust-lang/ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
  g++ \
  make \
---

COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/

# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \
           --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---
#12 2.732 Building wheels for collected packages: reuse
#12 2.733   Building wheel for reuse (pyproject.toml): started
#12 2.951   Building wheel for reuse (pyproject.toml): finished with status 'done'
#12 2.952   Created wheel for reuse: filename=reuse-4.0.3-cp310-cp310-manylinux_2_35_x86_64.whl size=132719 sha256=5bb60f62728aaedff7162745ce743c7f2f55069b3e7f82e6a37d70df455797cc
#12 2.952   Stored in directory: /tmp/pip-ephem-wheel-cache-yqa_upm2/wheels/3d/8d/0a/e0fc6aba4494b28a967ab5eaf951c121d9c677958714e34532
#12 2.954 Successfully built reuse
#12 2.955 Installing collected packages: boolean-py, binaryornot, tomlkit, reuse, python-debian, markupsafe, license-expression, jinja2, chardet, attrs
#12 3.356 Successfully installed attrs-23.2.0 binaryornot-0.4.4 boolean-py-4.0 chardet-5.2.0 jinja2-3.1.4 license-expression-30.3.0 markupsafe-2.1.5 python-debian-0.1.49 reuse-4.0.3 tomlkit-0.13.0
#12 3.356 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#12 3.889 Collecting virtualenv
#12 3.928   Downloading virtualenv-20.30.0-py3-none-any.whl (4.3 MB)
#12 3.989      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.3/4.3 MB 73.7 MB/s eta 0:00:00
#12 4.029 Collecting distlib<1,>=0.3.7
#12 4.032   Downloading distlib-0.3.9-py2.py3-none-any.whl (468 kB)
#12 4.041      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 469.0/469.0 KB 65.8 MB/s eta 0:00:00
#12 4.072 Collecting platformdirs<5,>=3.9.1
#12 4.076   Downloading platformdirs-4.3.7-py3-none-any.whl (18 kB)
#12 4.117 Collecting filelock<4,>=3.12.2
#12 4.120   Downloading filelock-3.18.0-py3-none-any.whl (16 kB)
#12 4.204 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#12 4.388 Successfully installed distlib-0.3.9 filelock-3.18.0 platformdirs-4.3.7 virtualenv-20.30.0
#12 4.389 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#12 DONE 4.5s

#13 [7/8] COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
#13 DONE 0.0s
---
DirectMap4k:      131008 kB
DirectMap2M:     8257536 kB
DirectMap1G:    10485760 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 python2.7 ../x.py test            --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
+ TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.05s
##[endgroup]
WARN: currently no CI rustc builds have rustc debug assertions enabled. Please either set `rust.debug-assertions` to `false` if you want to use download CI rustc or set `rust.download-rustc` to `false`.
[TIMING] core::build_steps::tool::LibcxxVersionTool { target: x86_64-unknown-linux-gnu } -- 0.215
---
##[endgroup]
[TIMING] core::build_steps::tool::ToolBuild { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu, tool: "tidy", path: "src/tools/tidy", mode: ToolBootstrap, source_type: InTree, extra_features: [], allow_features: "", cargo_args: [], artifact_kind: Binary } -- 37.204
[TIMING] core::build_steps::tool::Tidy { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu } -- 0.000
fmt check
Diff in /checkout/library/core/src/time.rs:307:
         Duration { secs, nanos: subsec_nanos }
     }
 
-
     /// Creates a new Duration from the specified number of nanoseconds.
-    /// 
-    /// # Panics 
     ///
+    /// # Panics
+    ///
     /// Panics if the given number of weeks overflows the `Duration` size.
-    /// Use this function if you need to specify time greater than what can fit in u64 
+    /// Use this function if you need to specify time greater than what can fit in u64
     /// (around 584 years).
-    /// 
-    /// # Examples 
-    /// 
+    ///
+    /// # Examples
+    ///
     /// ```
     /// #![feature(duration_from_nanos_u128)]
     /// use std::time::Duration;
Diff in /checkout/library/core/src/time.rs:329:
     #[inline]
     pub const fn from_nanos_u128(nanos: u128) -> Duration {
         const NANOS_PER_SEC: u128 = self::NANOS_PER_SEC as u128;
-        let secs : u64 = (nanos/ NANOS_PER_SEC) as u64 ;
+        let secs: u64 = (nanos / NANOS_PER_SEC) as u64;
         let subsec_nanos = (nanos % NANOS_PER_SEC) as u32;
         // SAFETY: x % 1_000_000_000 < 1_000_000_000
         let subsec_nanos = unsafe { Nanoseconds::new_unchecked(subsec_nanos) };
Diff in /checkout/library/core/src/time.rs:336:
 
         Duration { secs, nanos: subsec_nanos }
     }
-    
+
     /// Creates a new `Duration` from the specified number of weeks.
     ///
     /// # Panics
fmt: checked 5957 files
Build completed unsuccessfully in 0:01:17
  local time: Fri Apr 11 08:19:06 UTC 2025

rust-log-analyzer avatar Apr 11 '25 08:04 rust-log-analyzer

@rustbot ready r? @tgross35 apologies for the many commits. too many errors.

omanirudh avatar Apr 11 '25 12:04 omanirudh

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] build_script_build test:false 0.303
error: unnecessary parentheses around assigned value
   --> library/core/src/time.rs:331:26
    |
331 |         let secs: u128 = (nanos / NANOS_PER_SEC);
    |                          ^                     ^
    |
    = note: `-D unused-parens` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unused_parens)]`
help: remove these parentheses
    |
331 -         let secs: u128 = (nanos / NANOS_PER_SEC);
331 +         let secs: u128 = nanos / NANOS_PER_SEC;
    |

error: unnecessary parentheses around `if` condition
   --> library/core/src/time.rs:332:12
    |
---
332 -         if (secs > u64::MAX.into()) {
332 +         if secs > u64::MAX.into() {
    |

error[E0015]: cannot call non-const method `<u64 as convert::Into<u128>>::into` in constant functions
   --> library/core/src/time.rs:332:29
    |
332 |         if (secs > u64::MAX.into()) {
    |                             ^^^^^^
    |

rust-log-analyzer avatar Apr 11 '25 16:04 rust-log-analyzer

The job x86_64-gnu-llvm-19 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#20 exporting to docker image format
#20 sending tarball 20.1s done
#20 DONE 26.8s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-19]
[CI_JOB_NAME=x86_64-gnu-llvm-19]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Listening on address 127.0.0.1:4226
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-19', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'build.print-step-timings', '--enable-verbose-tests', '--set', 'build.metrics', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: build.build          := x86_64-unknown-linux-gnu
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-19/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
332 -         if (secs > u64::MAX.into()) {
332 +         if secs > u64::MAX.into() {
    |

error[E0015]: cannot call non-const method `<u64 as convert::Into<u128>>::into` in constant functions
   --> library/core/src/time.rs:332:29
    |
332 |         if (secs > u64::MAX.into()) {
    |                             ^^^^^^
    |

rust-log-analyzer avatar Apr 11 '25 16:04 rust-log-analyzer

Rest of the code looks good to me, amazing work!

Only need to make small changes on the documentation side of things (along with @Skgland 's review about panicking on overflow instead of truncating on overflow).

Do await a review from someone from the libs team too.

madhav-madhusoodanan avatar Apr 11 '25 17:04 madhav-madhusoodanan

About the commit history (this is completely upto you)

You can use git rebase -i HEAD~<number of commits>. This opens up an interactive window using which you can reorganize and meld related commits together.

This is a related thread on zulip on the concerns behind squashing vs merging commits.

madhav-madhusoodanan avatar Apr 11 '25 17:04 madhav-madhusoodanan

@rustbot author , @madhav-madhusoodanan left some good review here.

tgross35 avatar Apr 15 '25 00:04 tgross35

The job mingw-check-tidy failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
info: removing rustup binaries
info: rustup is uninstalled
##[group]Image checksum input
mingw-check-tidy
# We use the ghcr base image because ghcr doesn't have a rate limit
# and the mingw-check-tidy job doesn't cache docker images in CI.
FROM ghcr.io/rust-lang/ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
  g++ \
  make \
---

COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/

# NOTE: intentionally uses python2 for x.py so we can test it still works.
# validate-toolstate only runs in our CI, so it's ok for it to only support python3.
ENV SCRIPT TIDY_PRINT_DIFF=1 python2.7 ../x.py test \
           --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
#    pip-compile --allow-unsafe --generate-hashes reuse-requirements.in
---
#12 2.914 Building wheels for collected packages: reuse
#12 2.916   Building wheel for reuse (pyproject.toml): started
#12 3.129   Building wheel for reuse (pyproject.toml): finished with status 'done'
#12 3.130   Created wheel for reuse: filename=reuse-4.0.3-cp310-cp310-manylinux_2_35_x86_64.whl size=132719 sha256=5bb60f62728aaedff7162745ce743c7f2f55069b3e7f82e6a37d70df455797cc
#12 3.130   Stored in directory: /tmp/pip-ephem-wheel-cache-_qcs345q/wheels/3d/8d/0a/e0fc6aba4494b28a967ab5eaf951c121d9c677958714e34532
#12 3.133 Successfully built reuse
#12 3.133 Installing collected packages: boolean-py, binaryornot, tomlkit, reuse, python-debian, markupsafe, license-expression, jinja2, chardet, attrs
#12 3.533 Successfully installed attrs-23.2.0 binaryornot-0.4.4 boolean-py-4.0 chardet-5.2.0 jinja2-3.1.4 license-expression-30.3.0 markupsafe-2.1.5 python-debian-0.1.49 reuse-4.0.3 tomlkit-0.13.0
#12 3.533 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#12 4.081 Collecting virtualenv
#12 4.136   Downloading virtualenv-20.30.0-py3-none-any.whl (4.3 MB)
#12 4.285      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.3/4.3 MB 29.8 MB/s eta 0:00:00
#12 4.345 Collecting filelock<4,>=3.12.2
#12 4.353   Downloading filelock-3.18.0-py3-none-any.whl (16 kB)
#12 4.390 Collecting platformdirs<5,>=3.9.1
#12 4.397   Downloading platformdirs-4.3.7-py3-none-any.whl (18 kB)
#12 4.418 Collecting distlib<1,>=0.3.7
#12 4.426   Downloading distlib-0.3.9-py2.py3-none-any.whl (468 kB)
#12 4.437      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 469.0/469.0 KB 50.6 MB/s eta 0:00:00
#12 4.518 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#12 4.699 Successfully installed distlib-0.3.9 filelock-3.18.0 platformdirs-4.3.7 virtualenv-20.30.0
#12 4.699 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#12 DONE 4.8s

#13 [7/8] COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
#13 DONE 0.0s
---
DirectMap4k:      143296 kB
DirectMap2M:     7196672 kB
DirectMap1G:    11534336 kB
##[endgroup]
Executing TIDY_PRINT_DIFF=1 python2.7 ../x.py test            --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
+ TIDY_PRINT_DIFF=1 python2.7 ../x.py test --stage 0 src/tools/tidy tidyselftest --extra-checks=py,cpp
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.05s
##[endgroup]
WARN: currently no CI rustc builds have rustc debug assertions enabled. Please either set `rust.debug-assertions` to `false` if you want to use download CI rustc or set `rust.download-rustc` to `false`.
[TIMING] core::build_steps::tool::LibcxxVersionTool { target: x86_64-unknown-linux-gnu } -- 0.219
---
Diff in /checkout/library/core/src/time.rs:311:
     ///
     /// # Panics
     ///
-    /// Panics if the given number of nanoseconds is greater than what Duration can handle, 
+    /// Panics if the given number of nanoseconds is greater than what Duration can handle,
     /// which is `(u64::MAX * NANOS_PER_SEC) + NANOS_PER_SEC - 1`
     /// Use this function if you need to specify time greater than what can fit in u64
     /// (around 584 years).
fmt: checked 5984 files
Build completed unsuccessfully in 0:01:18
  local time: Sun Apr 20 15:03:55 UTC 2025
  network time: Sun, 20 Apr 2025 15:03:55 GMT
##[error]Process completed with exit code 1.

rust-log-analyzer avatar Apr 20 '25 15:04 rust-log-analyzer

@rustbot ready

omanirudh avatar Apr 21 '25 08:04 omanirudh

About the commit history (this is completely upto you)

You can use git rebase -i HEAD~<number of commits>. This opens up an interactive window using which you can reorganize and meld related commits together.

This is a related thread on zulip on the concerns behind squashing vs merging commits.

I looked into it. This PR now has just one commit. I preserved the commit messages of earlier commits though.

omanirudh avatar Apr 21 '25 15:04 omanirudh

I looked into it. This PR now has just one commit. I preserved the commit messages of earlier commits though.

Also fyi - pedantically, there is no need to preserve the messages unless they are still meaningful. It's best if the message describes the contained change, it's not really useful to rust's forever history that you had "dummy commit" and "remove parentheses" at some point :)

tgross35 avatar Apr 27 '25 00:04 tgross35