rust icon indicating copy to clipboard operation
rust copied to clipboard

Add new `function_casts_as_integer` lint

Open GuillaumeGomez opened this issue 7 months ago • 37 comments

The function_casts_as_integer lint detects cases where users cast a function pointer into an integer.

warn-by-default

Example

fn foo() {}
let x = foo as usize;
warning: casting a function into an integer implicitly
  --> $DIR/function_casts_as_integer.rs:9:17
   |
LL |     let x = foo as usize;
   |                 ^^^^^^^^
   |
help: add `fn() as usize`
   |
LL |     let x = foo as fn() as usize;
   |                 +++++++

Explanation

You should never cast a function directly into an integer but go through a cast as fn first to make it obvious what's going on. It also allows to prevent confusion with (associated) constants.

Related to https://github.com/rust-lang/rust/issues/81686 and https://stackoverflow.com/questions/68701177/whats-the-meaning-of-casting-a-rust-enum-variant-to-a-numeric-data-type

r? @urgau

GuillaumeGomez avatar May 23 '25 20:05 GuillaumeGomez

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++ \
---

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.948   Building wheel for reuse (pyproject.toml): finished with status 'done'
#12 2.949   Created wheel for reuse: filename=reuse-4.0.3-cp310-cp310-manylinux_2_35_x86_64.whl size=132719 sha256=d2a2565e7037ad3883fb9337653f2e25bbb588534fbef3697286cbc26d1bf634
#12 2.949   Stored in directory: /tmp/pip-ephem-wheel-cache-5tw3siaj/wheels/3d/8d/0a/e0fc6aba4494b28a967ab5eaf951c121d9c677958714e34532
#12 2.951 Successfully built reuse
#12 2.952 Installing collected packages: boolean-py, binaryornot, tomlkit, reuse, python-debian, markupsafe, license-expression, jinja2, chardet, attrs
#12 3.349 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.350 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.883 Collecting virtualenv
#12 3.929   Downloading virtualenv-20.31.2-py3-none-any.whl (6.1 MB)
#12 4.061      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.1/6.1 MB 46.7 MB/s eta 0:00:00
#12 4.121 Collecting filelock<4,>=3.12.2
#12 4.126   Downloading filelock-3.18.0-py3-none-any.whl (16 kB)
#12 4.143 Collecting distlib<1,>=0.3.7
#12 4.148   Downloading distlib-0.3.9-py2.py3-none-any.whl (468 kB)
#12 4.155      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 469.0/469.0 KB 81.1 MB/s eta 0:00:00
#12 4.189 Collecting platformdirs<5,>=3.9.1
#12 4.194   Downloading platformdirs-4.3.8-py3-none-any.whl (18 kB)
#12 4.275 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#12 4.466 Successfully installed distlib-0.3.9 filelock-3.18.0 platformdirs-4.3.8 virtualenv-20.31.2
#12 4.466 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:      153536 kB
DirectMap2M:    10332160 kB
DirectMap1G:     8388608 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`.
downloading https://static.rust-lang.org/dist/2025-05-12/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz
---
fmt check
fmt: checked 6023 files
tidy check
tidy: Skipping binary file check, read-only filesystem
##[error]tidy error: /checkout/compiler/rustc_lint/src/function_cast_as_integer.rs:10: 18-line comment block with odd number of backticks
removing old virtual environment
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'venv'
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'virtualenv'
Requirement already satisfied: pip in ./build/venv/lib/python3.10/site-packages (25.1.1)
linting python files
All checks passed!
checking python file formatting
26 files already formatted
checking C++ file formatting
some tidy checks failed
Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:01:42
  local time: Fri May 23 20:48:36 UTC 2025
  network time: Fri, 23 May 2025 20:48:36 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

rust-log-analyzer avatar May 23 '25 20:05 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++ \
---

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.976 Building wheels for collected packages: reuse
#12 2.977   Building wheel for reuse (pyproject.toml): started
#12 3.192   Building wheel for reuse (pyproject.toml): finished with status 'done'
#12 3.193   Created wheel for reuse: filename=reuse-4.0.3-cp310-cp310-manylinux_2_35_x86_64.whl size=132719 sha256=d2a2565e7037ad3883fb9337653f2e25bbb588534fbef3697286cbc26d1bf634
#12 3.193   Stored in directory: /tmp/pip-ephem-wheel-cache-ffstbxhz/wheels/3d/8d/0a/e0fc6aba4494b28a967ab5eaf951c121d9c677958714e34532
#12 3.195 Successfully built reuse
#12 3.196 Installing collected packages: boolean-py, binaryornot, tomlkit, reuse, python-debian, markupsafe, license-expression, jinja2, chardet, attrs
#12 3.600 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.600 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.152 Collecting virtualenv
#12 4.207   Downloading virtualenv-20.31.2-py3-none-any.whl (6.1 MB)
#12 4.392      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.1/6.1 MB 33.2 MB/s eta 0:00:00
#12 4.459 Collecting filelock<4,>=3.12.2
#12 4.467   Downloading filelock-3.18.0-py3-none-any.whl (16 kB)
#12 4.507 Collecting platformdirs<5,>=3.9.1
#12 4.515   Downloading platformdirs-4.3.8-py3-none-any.whl (18 kB)
#12 4.537 Collecting distlib<1,>=0.3.7
#12 4.545   Downloading distlib-0.3.9-py2.py3-none-any.whl (468 kB)
#12 4.557      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 469.0/469.0 KB 47.3 MB/s eta 0:00:00
#12 4.639 Installing collected packages: distlib, platformdirs, filelock, virtualenv
#12 4.835 Successfully installed distlib-0.3.9 filelock-3.18.0 platformdirs-4.3.8 virtualenv-20.31.2
#12 4.835 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:      143296 kB
DirectMap2M:     5099520 kB
DirectMap1G:    13631488 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`.
downloading https://static.rust-lang.org/dist/2025-05-12/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz
---
fmt check
fmt: checked 6023 files
tidy check
tidy: Skipping binary file check, read-only filesystem
##[error]tidy error: /checkout/compiler/rustc_lint/src/function_cast_as_integer.rs:10: 17-line comment block with odd number of backticks
removing old virtual environment
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'venv'
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'virtualenv'
Requirement already satisfied: pip in ./build/venv/lib/python3.10/site-packages (25.1.1)
linting python files
All checks passed!
checking python file formatting
26 files already formatted
checking C++ file formatting
some tidy checks failed
Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:01:45
  local time: Fri May 23 21:03:54 UTC 2025
  network time: Fri, 23 May 2025 21:03:55 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

rust-log-analyzer avatar May 23 '25 21:05 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)
#18 exporting to docker image format
#18 sending tarball 20.5s done
#18 DONE 27.0s
##[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', '--set', 'gcc.download-ci-gcc=true', '--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

rust-log-analyzer avatar May 24 '25 10:05 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)
   Compiling rustc_driver_impl v0.0.0 (/checkout/compiler/rustc_driver_impl)
error: direct cast of function item into an integer
   --> compiler/rustc_driver_impl/src/signal_handler.rs:155:45
    |
155 |         sa.sa_sigaction = print_stack_trace as libc::sighandler_t;
    |                                             ^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D function-casts-as-integer` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
help: first cast to a function pointer `unsafe extern "C" fn(i32)`
    |
155 |         sa.sa_sigaction = print_stack_trace as unsafe extern "C" fn(i32) as libc::sighandler_t;
    |                                             ++++++++++++++++++++++++++++

[RUSTC-TIMING] rustc_driver_impl test:false 1.746
error: could not compile `rustc_driver_impl` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

rust-log-analyzer avatar May 24 '25 19:05 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)
tests/ui/ref_option/ref_option.all.fixed ... ok
tests/ui/non_std_lazy_static/non_std_lazy_static_fixable.fixed ... ok

FAILED TEST: tests/ui/cast_enum_constructor.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-ed51451f318df95b.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-b7cb526cfdda36e3.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c2c4ea31f913b142.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-5a7156af45221746.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-d11c9c2ffe481e38.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-3e76c5e4cf3f0bdf.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-e095505c7235a9a3.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libquote-c8178baeef41ae19.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libregex-cb003e5d2ad3f3b6.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libserde-a43a28edafb16747.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libserde_derive-9780bbb027e4cda0.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-e6d09ab535c31563.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-51bd107334be98ff.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui_test/0/tests/ui" "tests/ui/cast_enum_constructor.rs" "--edition" "2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/cast_enum_constructor.stderr` to the actual output
--- tests/ui/cast_enum_constructor.stderr
+++ <stderr output>
---
+   = note: `-D function-casts-as-integer` implied by `-D warnings`
+   = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
+help: first cast to a function pointer `fn(u32) -> main::Foo`
+   |
+LL |     let _ = Foo::Y as fn(u32) -> main::Foo as usize;
+   |                    +++++++++++++++++++++++
 
+error: direct cast of function item into an integer
+  --> tests/ui/cast_enum_constructor.rs:16:20
+   |
+LL |     let _ = Foo::Y as isize;
+   |                    ^^^^^^^^
+   |
+help: first cast to a function pointer `fn(u32) -> main::Foo`
+   |
+LL |     let _ = Foo::Y as fn(u32) -> main::Foo as isize;
+   |                    +++++++++++++++++++++++
+
+error: aborting due to 4 previous errors
+

---
   = note: `-D function-casts-as-integer` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
help: first cast to a function pointer `fn(u32) -> main::Foo`
   |
LL |     let _ = Foo::Y as fn(u32) -> main::Foo as usize;
   |                    +++++++++++++++++++++++

error: direct cast of function item into an integer
##[error]  --> tests/ui/cast_enum_constructor.rs:16:20
   |
LL |     let _ = Foo::Y as isize;
   |                    ^^^^^^^^
   |
help: first cast to a function pointer `fn(u32) -> main::Foo`
   |
LL |     let _ = Foo::Y as fn(u32) -> main::Foo as isize;
   |                    +++++++++++++++++++++++

error: aborting due to 4 previous errors



error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/cast_enum_constructor.rs:13:20
   |
13 |     let _ = Foo::Y as usize;
   |                    ^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/cast_enum_constructor.rs:16:20
   |
16 |     let _ = Foo::Y as isize;
   |                    ^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

full stderr:
error: cast of an enum tuple constructor to an integer
##[error]  --> tests/ui/cast_enum_constructor.rs:13:13
---
   = note: `-D function-casts-as-integer` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
help: first cast to a function pointer `fn(u32) -> main::Foo`
   |
LL |     let _ = Foo::Y as fn(u32) -> main::Foo as usize;
   |                    +++++++++++++++++++++++

error: direct cast of function item into an integer
##[error]  --> tests/ui/cast_enum_constructor.rs:16:20
   |
LL |     let _ = Foo::Y as isize;
   |                    ^^^^^^^^
   |
help: first cast to a function pointer `fn(u32) -> main::Foo`
   |
LL |     let _ = Foo::Y as fn(u32) -> main::Foo as isize;
   |                    +++++++++++++++++++++++

error: aborting due to 4 previous errors


full stdout:



FAILED TEST: tests/ui/confusing_method_to_numeric_cast.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-ed51451f318df95b.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-b7cb526cfdda36e3.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c2c4ea31f913b142.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-5a7156af45221746.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-d11c9c2ffe481e38.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-3e76c5e4cf3f0bdf.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-e095505c7235a9a3.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libquote-c8178baeef41ae19.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libregex-cb003e5d2ad3f3b6.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libserde-a43a28edafb16747.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libserde_derive-9780bbb027e4cda0.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-e6d09ab535c31563.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-51bd107334be98ff.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui_test/0/tests/ui" "tests/ui/confusing_method_to_numeric_cast.rs" "--edition" "2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/confusing_method_to_numeric_cast.stderr` to the actual output
--- tests/ui/confusing_method_to_numeric_cast.stderr
+++ <stderr output>
---
+   = note: `-D function-casts-as-integer` implied by `-D warnings`
+   = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
+help: first cast to a function pointer `fn(u16, u16) -> u16`
+   |
+LL |     let _ = u16::max as fn(u16, u16) -> u16 as usize;
+   |                      ++++++++++++++++++++++
 
+error: direct cast of function item into an integer
+  --> tests/ui/confusing_method_to_numeric_cast.rs:6:22
+   |
+LL |     let _ = u16::min as usize;
+   |                      ^^^^^^^^
+   |
+help: first cast to a function pointer `fn(u16, u16) -> u16`
+   |
+LL |     let _ = u16::min as fn(u16, u16) -> u16 as usize;
+   |                      ++++++++++++++++++++++
+
+error: direct cast of function item into an integer
+  --> tests/ui/confusing_method_to_numeric_cast.rs:7:28
+   |
---
+   |
+LL |     let _ = f32::maximum as usize;
+   |                          ^^^^^^^^
+   |
+help: first cast to a function pointer `fn(f32, f32) -> f32`
+   |
+LL |     let _ = f32::maximum as fn(f32, f32) -> f32 as usize;
+   |                          ++++++++++++++++++++++
+
+error: direct cast of function item into an integer
+  --> tests/ui/confusing_method_to_numeric_cast.rs:11:22
+   |
+LL |     let _ = f32::max as usize;
+   |                      ^^^^^^^^
+   |
+help: first cast to a function pointer `fn(f32, f32) -> f32`
+   |
+LL |     let _ = f32::max as fn(f32, f32) -> f32 as usize;
+   |                      ++++++++++++++++++++++
+
+error: direct cast of function item into an integer
+  --> tests/ui/confusing_method_to_numeric_cast.rs:12:26
+   |
+LL |     let _ = f32::minimum as usize;
+   |                          ^^^^^^^^
+   |
+help: first cast to a function pointer `fn(f32, f32) -> f32`
+   |
+LL |     let _ = f32::minimum as fn(f32, f32) -> f32 as usize;
+   |                          ++++++++++++++++++++++
+
+error: direct cast of function item into an integer
+  --> tests/ui/confusing_method_to_numeric_cast.rs:13:22
+   |
+LL |     let _ = f32::min as usize;
+   |                      ^^^^^^^^
+   |
+help: first cast to a function pointer `fn(f32, f32) -> f32`
+   |
+LL |     let _ = f32::min as fn(f32, f32) -> f32 as usize;
+   |                      ++++++++++++++++++++++
+
+error: aborting due to 16 previous errors
+

---
LL -     let _ = u16::min_value as usize;
LL +     let _ = u16::MIN as usize;
   |

error: casting function pointer `f32::maximum` to `usize`
##[error]  --> tests/ui/confusing_method_to_numeric_cast.rs:10:13
   |
LL |     let _ = f32::maximum as usize;
   |             ^^^^^^^^^^^^^^^^^^^^^
   |
---
LL -     let _ = f32::max as usize;
LL +     let _ = f32::MAX as usize;
   |

error: casting function pointer `f32::minimum` to `usize`
##[error]  --> tests/ui/confusing_method_to_numeric_cast.rs:12:13
   |
LL |     let _ = f32::minimum as usize;
   |             ^^^^^^^^^^^^^^^^^^^^^
   |
---
   = note: `-D function-casts-as-integer` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
help: first cast to a function pointer `fn(u16, u16) -> u16`
   |
LL |     let _ = u16::max as fn(u16, u16) -> u16 as usize;
   |                      ++++++++++++++++++++++

error: direct cast of function item into an integer
##[error]  --> tests/ui/confusing_method_to_numeric_cast.rs:6:22
   |
LL |     let _ = u16::min as usize;
   |                      ^^^^^^^^
   |
help: first cast to a function pointer `fn(u16, u16) -> u16`
   |
LL |     let _ = u16::min as fn(u16, u16) -> u16 as usize;
   |                      ++++++++++++++++++++++

error: direct cast of function item into an integer
##[error]  --> tests/ui/confusing_method_to_numeric_cast.rs:7:28
   |
---
   |
LL |     let _ = f32::maximum as usize;
   |                          ^^^^^^^^
   |
help: first cast to a function pointer `fn(f32, f32) -> f32`
   |
LL |     let _ = f32::maximum as fn(f32, f32) -> f32 as usize;
   |                          ++++++++++++++++++++++

error: direct cast of function item into an integer
##[error]  --> tests/ui/confusing_method_to_numeric_cast.rs:11:22
   |
LL |     let _ = f32::max as usize;
   |                      ^^^^^^^^
   |
help: first cast to a function pointer `fn(f32, f32) -> f32`
   |
LL |     let _ = f32::max as fn(f32, f32) -> f32 as usize;
   |                      ++++++++++++++++++++++

error: direct cast of function item into an integer
##[error]  --> tests/ui/confusing_method_to_numeric_cast.rs:12:26
   |
LL |     let _ = f32::minimum as usize;
   |                          ^^^^^^^^
   |
help: first cast to a function pointer `fn(f32, f32) -> f32`
   |
LL |     let _ = f32::minimum as fn(f32, f32) -> f32 as usize;
   |                          ++++++++++++++++++++++

error: direct cast of function item into an integer
##[error]  --> tests/ui/confusing_method_to_numeric_cast.rs:13:22
   |
LL |     let _ = f32::min as usize;
   |                      ^^^^^^^^
   |
help: first cast to a function pointer `fn(f32, f32) -> f32`
   |
LL |     let _ = f32::min as fn(f32, f32) -> f32 as usize;
   |                      ++++++++++++++++++++++

error: aborting due to 16 previous errors



error: there were 1 unmatched diagnostics
##[error] --> tests/ui/confusing_method_to_numeric_cast.rs:5:22
  |
5 |     let _ = u16::max as usize; //~ confusing_method_to_numeric_cast
  |                      ^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
  |

error: there were 1 unmatched diagnostics
##[error] --> tests/ui/confusing_method_to_numeric_cast.rs:6:22
  |
6 |     let _ = u16::min as usize; //~ confusing_method_to_numeric_cast
  |                      ^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
  |

error: there were 1 unmatched diagnostics
##[error] --> tests/ui/confusing_method_to_numeric_cast.rs:7:28
  |
7 |     let _ = u16::max_value as usize; //~ confusing_method_to_numeric_cast
  |                            ^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
  |

error: there were 1 unmatched diagnostics
##[error] --> tests/ui/confusing_method_to_numeric_cast.rs:8:28
  |
8 |     let _ = u16::min_value as usize; //~ confusing_method_to_numeric_cast
  |                            ^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
  |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/confusing_method_to_numeric_cast.rs:10:26
   |
10 |     let _ = f32::maximum as usize; //~ confusing_method_to_numeric_cast
   |                          ^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/confusing_method_to_numeric_cast.rs:11:22
   |
11 |     let _ = f32::max as usize; //~ confusing_method_to_numeric_cast
   |                      ^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/confusing_method_to_numeric_cast.rs:12:26
   |
12 |     let _ = f32::minimum as usize; //~ confusing_method_to_numeric_cast
   |                          ^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/confusing_method_to_numeric_cast.rs:13:22
   |
13 |     let _ = f32::min as usize; //~ confusing_method_to_numeric_cast
   |                      ^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

full stderr:
error: casting function pointer `u16::max` to `usize`
##[error]  --> tests/ui/confusing_method_to_numeric_cast.rs:5:13
---
LL -     let _ = u16::min_value as usize;
LL +     let _ = u16::MIN as usize;
   |

error: casting function pointer `f32::maximum` to `usize`
##[error]  --> tests/ui/confusing_method_to_numeric_cast.rs:10:13
   |
LL |     let _ = f32::maximum as usize;
   |             ^^^^^^^^^^^^^^^^^^^^^
   |
---
LL -     let _ = f32::max as usize;
LL +     let _ = f32::MAX as usize;
   |

error: casting function pointer `f32::minimum` to `usize`
##[error]  --> tests/ui/confusing_method_to_numeric_cast.rs:12:13
   |
LL |     let _ = f32::minimum as usize;
   |             ^^^^^^^^^^^^^^^^^^^^^
   |
---
   = note: `-D function-casts-as-integer` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
help: first cast to a function pointer `fn(u16, u16) -> u16`
   |
LL |     let _ = u16::max as fn(u16, u16) -> u16 as usize;
   |                      ++++++++++++++++++++++

error: direct cast of function item into an integer
##[error]  --> tests/ui/confusing_method_to_numeric_cast.rs:6:22
   |
LL |     let _ = u16::min as usize;
   |                      ^^^^^^^^
   |
help: first cast to a function pointer `fn(u16, u16) -> u16`
   |
LL |     let _ = u16::min as fn(u16, u16) -> u16 as usize;
   |                      ++++++++++++++++++++++

error: direct cast of function item into an integer
##[error]  --> tests/ui/confusing_method_to_numeric_cast.rs:7:28
   |
---
   |
LL |     let _ = f32::maximum as usize;
   |                          ^^^^^^^^
   |
help: first cast to a function pointer `fn(f32, f32) -> f32`
   |
LL |     let _ = f32::maximum as fn(f32, f32) -> f32 as usize;
   |                          ++++++++++++++++++++++

error: direct cast of function item into an integer
##[error]  --> tests/ui/confusing_method_to_numeric_cast.rs:11:22
   |
LL |     let _ = f32::max as usize;
   |                      ^^^^^^^^
   |
help: first cast to a function pointer `fn(f32, f32) -> f32`
   |
LL |     let _ = f32::max as fn(f32, f32) -> f32 as usize;
   |                      ++++++++++++++++++++++

error: direct cast of function item into an integer
##[error]  --> tests/ui/confusing_method_to_numeric_cast.rs:12:26
   |
LL |     let _ = f32::minimum as usize;
   |                          ^^^^^^^^
   |
help: first cast to a function pointer `fn(f32, f32) -> f32`
   |
LL |     let _ = f32::minimum as fn(f32, f32) -> f32 as usize;
   |                          ++++++++++++++++++++++

error: direct cast of function item into an integer
##[error]  --> tests/ui/confusing_method_to_numeric_cast.rs:13:22
   |
LL |     let _ = f32::min as usize;
   |                      ^^^^^^^^
   |
help: first cast to a function pointer `fn(f32, f32) -> f32`
   |
LL |     let _ = f32::min as fn(f32, f32) -> f32 as usize;
   |                      ++++++++++++++++++++++

error: aborting due to 16 previous errors


full stdout:



FAILED TEST: tests/ui/fn_to_numeric_cast_any.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-ed51451f318df95b.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-b7cb526cfdda36e3.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c2c4ea31f913b142.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-5a7156af45221746.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-d11c9c2ffe481e38.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-3e76c5e4cf3f0bdf.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-e095505c7235a9a3.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libquote-c8178baeef41ae19.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libregex-cb003e5d2ad3f3b6.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libserde-a43a28edafb16747.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libserde_derive-9780bbb027e4cda0.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-e6d09ab535c31563.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-51bd107334be98ff.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui_test/0/tests/ui" "tests/ui/fn_to_numeric_cast_any.rs" "--edition" "2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/fn_to_numeric_cast_any.stderr` to the actual output
--- tests/ui/fn_to_numeric_cast_any.stderr
+++ <stderr output>
---
   |
LL |     f() as usize
   |      ++

error: casting function pointer `T::static_method` to `usize`
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:71:5
   |
LL |     T::static_method as usize
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: did you mean to invoke the function?
   |
LL |     T::static_method() as usize
   |                     ++

error: casting function pointer `(clos as fn(u32) -> u32)` to `usize`
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:78:13
   |
LL |     let _ = (clos as fn(u32) -> u32) as usize;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: did you mean to invoke the function?
   |
LL |     let _ = (clos as fn(u32) -> u32)() as usize;
   |                                     ++

error: casting function pointer `foo` to `*const ()`
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:83:13
   |
---

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:23:17
   |
23 |     let _ = foo as i8;
   |                 ^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:26:17
   |
26 |     let _ = foo as i16;
   |                 ^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:29:17
   |
29 |     let _ = foo as i32;
   |                 ^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:32:17
   |
32 |     let _ = foo as i64;
   |                 ^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:35:17
   |
35 |     let _ = foo as i128;
   |                 ^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:38:17
   |
38 |     let _ = foo as isize;
   |                 ^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:41:17
   |
41 |     let _ = foo as u8;
   |                 ^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:44:17
   |
44 |     let _ = foo as u16;
   |                 ^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:47:17
   |
47 |     let _ = foo as u32;
   |                 ^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:50:17
   |
50 |     let _ = foo as u64;
   |                 ^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:53:17
   |
53 |     let _ = foo as u128;
   |                 ^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:56:17
   |
56 |     let _ = foo as usize;
   |                 ^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:61:35
   |
61 |     let _ = Struct::static_method as usize;
   |                                   ^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:71:22
   |
71 |     T::static_method as usize
   |                      ^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:83:17
   |
83 |     let _ = foo as *const ();
   |                 ^^^^^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

full stderr:
error: casting function pointer `foo` to `i8`
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:23:13
---
   |
LL |     f() as usize
   |      ++

error: casting function pointer `T::static_method` to `usize`
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:71:5
   |
LL |     T::static_method as usize
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: did you mean to invoke the function?
   |
LL |     T::static_method() as usize
   |                     ++

error: casting function pointer `(clos as fn(u32) -> u32)` to `usize`
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:78:13
   |
LL |     let _ = (clos as fn(u32) -> u32) as usize;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: did you mean to invoke the function?
   |
LL |     let _ = (clos as fn(u32) -> u32)() as usize;
   |                                     ++

error: casting function pointer `foo` to `*const ()`
##[error]  --> tests/ui/fn_to_numeric_cast_any.rs:83:13
   |
---



FAILED TEST: tests/ui/fn_to_numeric_cast.rs (revision `64bit`)
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-ed51451f318df95b.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-b7cb526cfdda36e3.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c2c4ea31f913b142.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-5a7156af45221746.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-d11c9c2ffe481e38.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-3e76c5e4cf3f0bdf.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-e095505c7235a9a3.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libquote-c8178baeef41ae19.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libregex-cb003e5d2ad3f3b6.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libserde-a43a28edafb16747.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libserde_derive-9780bbb027e4cda0.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-e6d09ab535c31563.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-51bd107334be98ff.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui_test/0/tests/ui" "tests/ui/fn_to_numeric_cast.rs" "--edition" "2024" "--cfg=64bit" "-Cextra-filename=64bit"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/fn_to_numeric_cast.64bit.stderr` to the actual output
--- tests/ui/fn_to_numeric_cast.64bit.stderr
+++ <stderr output>
---
   |
LL |     let _ = foo as u128;
   |             ^^^^^^^^^^^ help: try: `foo as usize`

error: casting function pointer `abc` to `i8`, which truncates the value
##[error]  --> tests/ui/fn_to_numeric_cast.rs:49:13
   |
LL |     let _ = abc as i8;
   |             ^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `i16`, which truncates the value
##[error]  --> tests/ui/fn_to_numeric_cast.rs:51:13
   |
LL |     let _ = abc as i16;
   |             ^^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `i32`, which truncates the value
##[error]  --> tests/ui/fn_to_numeric_cast.rs:53:13
   |
LL |     let _ = abc as i32;
   |             ^^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `i64`
##[error]  --> tests/ui/fn_to_numeric_cast.rs:56:13
   |
LL |     let _ = abc as i64;
   |             ^^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `i128`
##[error]  --> tests/ui/fn_to_numeric_cast.rs:58:13
   |
LL |     let _ = abc as i128;
   |             ^^^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `isize`
##[error]  --> tests/ui/fn_to_numeric_cast.rs:60:13
   |
LL |     let _ = abc as isize;
   |             ^^^^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `u8`, which truncates the value
##[error]  --> tests/ui/fn_to_numeric_cast.rs:63:13
   |
LL |     let _ = abc as u8;
   |             ^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `u16`, which truncates the value
##[error]  --> tests/ui/fn_to_numeric_cast.rs:65:13
   |
LL |     let _ = abc as u16;
   |             ^^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `u32`, which truncates the value
##[error]  --> tests/ui/fn_to_numeric_cast.rs:67:13
   |
LL |     let _ = abc as u32;
   |             ^^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `u64`
##[error]  --> tests/ui/fn_to_numeric_cast.rs:70:13
   |
LL |     let _ = abc as u64;
   |             ^^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `u128`
##[error]  --> tests/ui/fn_to_numeric_cast.rs:72:13
   |
LL |     let _ = abc as u128;
   |             ^^^^^^^^^^^ help: try: `abc as usize`

---

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast.rs:12:17
   |
12 |     let _ = foo as i8;
   |                 ^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast.rs:14:17
   |
14 |     let _ = foo as i16;
   |                 ^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast.rs:16:17
   |
16 |     let _ = foo as i32;
   |                 ^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast.rs:19:17
   |
19 |     let _ = foo as i64;
   |                 ^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast.rs:21:17
   |
21 |     let _ = foo as i128;
   |                 ^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast.rs:23:17
   |
23 |     let _ = foo as isize;
   |                 ^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast.rs:26:17
   |
26 |     let _ = foo as u8;
   |                 ^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast.rs:28:17
   |
28 |     let _ = foo as u16;
   |                 ^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast.rs:30:17
   |
30 |     let _ = foo as u32;
   |                 ^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast.rs:33:17
   |
33 |     let _ = foo as u64;
   |                 ^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast.rs:35:17
   |
35 |     let _ = foo as u128;
   |                 ^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/fn_to_numeric_cast.rs:39:17
   |
39 |     let _ = foo as usize;
   |                 ^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

full stderr:
error: casting function pointer `foo` to `i8`, which truncates the value
##[error]  --> tests/ui/fn_to_numeric_cast.rs:12:13
---
   |
LL |     let _ = foo as u128;
   |             ^^^^^^^^^^^ help: try: `foo as usize`

error: casting function pointer `abc` to `i8`, which truncates the value
##[error]  --> tests/ui/fn_to_numeric_cast.rs:49:13
   |
LL |     let _ = abc as i8;
   |             ^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `i16`, which truncates the value
##[error]  --> tests/ui/fn_to_numeric_cast.rs:51:13
   |
LL |     let _ = abc as i16;
   |             ^^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `i32`, which truncates the value
##[error]  --> tests/ui/fn_to_numeric_cast.rs:53:13
   |
LL |     let _ = abc as i32;
   |             ^^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `i64`
##[error]  --> tests/ui/fn_to_numeric_cast.rs:56:13
   |
LL |     let _ = abc as i64;
   |             ^^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `i128`
##[error]  --> tests/ui/fn_to_numeric_cast.rs:58:13
   |
LL |     let _ = abc as i128;
   |             ^^^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `isize`
##[error]  --> tests/ui/fn_to_numeric_cast.rs:60:13
   |
LL |     let _ = abc as isize;
   |             ^^^^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `u8`, which truncates the value
##[error]  --> tests/ui/fn_to_numeric_cast.rs:63:13
   |
LL |     let _ = abc as u8;
   |             ^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `u16`, which truncates the value
##[error]  --> tests/ui/fn_to_numeric_cast.rs:65:13
   |
LL |     let _ = abc as u16;
   |             ^^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `u32`, which truncates the value
##[error]  --> tests/ui/fn_to_numeric_cast.rs:67:13
   |
LL |     let _ = abc as u32;
   |             ^^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `u64`
##[error]  --> tests/ui/fn_to_numeric_cast.rs:70:13
   |
LL |     let _ = abc as u64;
   |             ^^^^^^^^^^ help: try: `abc as usize`

error: casting function pointer `abc` to `u128`
##[error]  --> tests/ui/fn_to_numeric_cast.rs:72:13
   |
LL |     let _ = abc as u128;
   |             ^^^^^^^^^^^ help: try: `abc as usize`

---



FAILED TEST: tests/ui/ptr_eq.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-ed51451f318df95b.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-b7cb526cfdda36e3.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c2c4ea31f913b142.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-5a7156af45221746.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-d11c9c2ffe481e38.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-3e76c5e4cf3f0bdf.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-e095505c7235a9a3.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libquote-c8178baeef41ae19.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libregex-cb003e5d2ad3f3b6.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libserde-a43a28edafb16747.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libserde_derive-9780bbb027e4cda0.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-e6d09ab535c31563.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-51bd107334be98ff.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui_test/0/tests/ui" "tests/ui/ptr_eq.rs" "--edition" "2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/ptr_eq.stderr` to the actual output
--- tests/ui/ptr_eq.stderr
+++ <stderr output>
 error: use `std::ptr::eq` when comparing raw pointers
   --> tests/ui/ptr_eq.rs:22:13
... 35 lines skipped ...
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(mac!(cast a), mac!(cast b))`
 
-error: aborting due to 6 previous errors
+error: direct cast of function item into an integer
+  --> tests/ui/ptr_eq.rs:58:28
+   |
+LL |     let _issue14337 = main as *const () == main as *const ();
+   |                            ^^^^^^^^^^^^
+   |
+   = note: `-D function-casts-as-integer` implied by `-D warnings`
+   = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
+help: first cast to a function pointer `fn()`
+   |
+LL |     let _issue14337 = main as fn() as *const () == main as *const ();
+   |                            +++++++
 
+error: direct cast of function item into an integer
+  --> tests/ui/ptr_eq.rs:58:49
+   |
+LL |     let _issue14337 = main as *const () == main as *const ();
+   |                                                 ^^^^^^^^^^^^
+   |
+help: first cast to a function pointer `fn()`
+   |
+LL |     let _issue14337 = main as *const () == main as fn() as *const ();
+   |                                                 +++++++
+
+error: aborting due to 8 previous errors
+

Full unnormalized output:
error: use `std::ptr::eq` when comparing raw pointers
##[error]  --> tests/ui/ptr_eq.rs:22:13
   |
LL |     let _ = a as *const _ as usize == b as *const _ as usize;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(a, b)`
   |
   = note: `-D clippy::ptr-eq` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::ptr_eq)]`

error: use `std::ptr::eq` when comparing raw pointers
##[error]  --> tests/ui/ptr_eq.rs:24:13
   |
LL |     let _ = a as *const _ == b as *const _;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(a, b)`

error: use `std::ptr::eq` when comparing raw pointers
##[error]  --> tests/ui/ptr_eq.rs:50:13
   |
LL |     let _ = x as *const u32 == y as *mut u32 as *const u32;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(x, y)`

error: use `std::ptr::eq` when comparing raw pointers
##[error]  --> tests/ui/ptr_eq.rs:53:13
   |
LL |     let _ = x as *const u32 != y as *mut u32 as *const u32;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!std::ptr::eq(x, y)`

error: use `std::ptr::eq` when comparing raw pointers
##[error]  --> tests/ui/ptr_eq.rs:61:13
   |
LL |     let _ = mac!(cast a) as *const _ == mac!(cast b) as *const _;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(mac!(cast a), mac!(cast b))`

error: use `std::ptr::eq` when comparing raw pointers
##[error]  --> tests/ui/ptr_eq.rs:65:13
   |
LL |     let _ = mac!(cast a) as *const _ == mac!(cast b) as *const _;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(mac!(cast a), mac!(cast b))`

error: direct cast of function item into an integer
##[error]  --> tests/ui/ptr_eq.rs:58:28
   |
LL |     let _issue14337 = main as *const () == main as *const ();
   |                            ^^^^^^^^^^^^
   |
   = note: `-D function-casts-as-integer` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
help: first cast to a function pointer `fn()`
   |
LL |     let _issue14337 = main as fn() as *const () == main as *const ();
   |                            +++++++

error: direct cast of function item into an integer
##[error]  --> tests/ui/ptr_eq.rs:58:49
   |
LL |     let _issue14337 = main as *const () == main as *const ();
   |                                                 ^^^^^^^^^^^^
   |
help: first cast to a function pointer `fn()`
   |
LL |     let _issue14337 = main as *const () == main as fn() as *const ();
   |                                                 +++++++

error: aborting due to 8 previous errors



error: there were 2 unmatched diagnostics
##[error]  --> tests/ui/ptr_eq.rs:58:28
   |
58 |     let _issue14337 = main as *const () == main as *const ();
   |                            ^^^^^^^^^^^^         ^^^^^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |                            |
   |                            Error[function_casts_as_integer]: direct cast of function item into an integer
   |

full stderr:
error: use `std::ptr::eq` when comparing raw pointers
##[error]  --> tests/ui/ptr_eq.rs:22:13
   |
LL |     let _ = a as *const _ as usize == b as *const _ as usize;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(a, b)`
   |
   = note: `-D clippy::ptr-eq` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::ptr_eq)]`

error: use `std::ptr::eq` when comparing raw pointers
##[error]  --> tests/ui/ptr_eq.rs:24:13
   |
LL |     let _ = a as *const _ == b as *const _;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(a, b)`

error: use `std::ptr::eq` when comparing raw pointers
##[error]  --> tests/ui/ptr_eq.rs:50:13
   |
LL |     let _ = x as *const u32 == y as *mut u32 as *const u32;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(x, y)`

error: use `std::ptr::eq` when comparing raw pointers
##[error]  --> tests/ui/ptr_eq.rs:53:13
   |
LL |     let _ = x as *const u32 != y as *mut u32 as *const u32;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!std::ptr::eq(x, y)`

error: use `std::ptr::eq` when comparing raw pointers
##[error]  --> tests/ui/ptr_eq.rs:61:13
   |
LL |     let _ = mac!(cast a) as *const _ == mac!(cast b) as *const _;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(mac!(cast a), mac!(cast b))`

error: use `std::ptr::eq` when comparing raw pointers
##[error]  --> tests/ui/ptr_eq.rs:65:13
   |
LL |     let _ = mac!(cast a) as *const _ == mac!(cast b) as *const _;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::ptr::eq(mac!(cast a), mac!(cast b))`

error: direct cast of function item into an integer
##[error]  --> tests/ui/ptr_eq.rs:58:28
   |
LL |     let _issue14337 = main as *const () == main as *const ();
   |                            ^^^^^^^^^^^^
   |
   = note: `-D function-casts-as-integer` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
help: first cast to a function pointer `fn()`
   |
LL |     let _issue14337 = main as fn() as *const () == main as *const ();
   |                            +++++++

error: direct cast of function item into an integer
##[error]  --> tests/ui/ptr_eq.rs:58:49
   |
LL |     let _issue14337 = main as *const () == main as *const ();
   |                                                 ^^^^^^^^^^^^
   |
help: first cast to a function pointer `fn()`
   |
LL |     let _issue14337 = main as *const () == main as fn() as *const ();
   |                                                 +++++++

error: aborting due to 8 previous errors


full stdout:



FAILED TEST: tests/ui/transmutes_expressible_as_ptr_casts.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-ed51451f318df95b.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-b7cb526cfdda36e3.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c2c4ea31f913b142.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-5a7156af45221746.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-d11c9c2ffe481e38.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-3e76c5e4cf3f0bdf.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-e095505c7235a9a3.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libquote-c8178baeef41ae19.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libregex-cb003e5d2ad3f3b6.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libserde-a43a28edafb16747.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libserde_derive-9780bbb027e4cda0.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-e6d09ab535c31563.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-51bd107334be98ff.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui_test/0/tests/ui" "tests/ui/transmutes_expressible_as_ptr_casts.rs" "--edition" "2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/transmutes_expressible_as_ptr_casts.stderr` to the actual output
--- tests/ui/transmutes_expressible_as_ptr_casts.stderr
+++ <stderr output>
 error: transmute from an integer to a pointer
   --> tests/ui/transmutes_expressible_as_ptr_casts.rs:17:39
... 76 lines skipped ...
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(f as *const u8)`
 
-error: aborting due to 10 previous errors
+error: direct cast of function item into an integer
+  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:54:36
+   |
+LL |     let _usize_ptr_transmute = foo as *const usize;
+   |                                    ^^^^^^^^^^^^^^^
+   |
+   = note: `-D function-casts-as-integer` implied by `-D warnings`
+   = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
+help: first cast to a function pointer `fn(usize) -> u8`
+   |
+LL |     let _usize_ptr_transmute = foo as fn(usize) -> u8 as *const usize;
+   |                                    ++++++++++++++++++
 
+error: direct cast of function item into an integer
+  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:59:34
+   |
+LL |     let _usize_from_fn_ptr = foo as *const usize;
+   |                                  ^^^^^^^^^^^^^^^
+   |
+help: first cast to a function pointer `fn(usize) -> u8`
+   |
+LL |     let _usize_from_fn_ptr = foo as fn(usize) -> u8 as *const usize;
+   |                                  ++++++++++++++++++
+
+error: aborting due to 12 previous errors
+

Full unnormalized output:
error: transmute from an integer to a pointer
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:17:39
   |
LL |     let _ptr_i32_transmute = unsafe { transmute::<usize, *const i32>(usize::MAX) };
   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `usize::MAX as *const i32`
   |
   = note: `-D clippy::useless-transmute` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::useless_transmute)]`

error: transmute from a pointer to a pointer
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:22:38
   |
LL |     let _ptr_i8_transmute = unsafe { transmute::<*const i32, *const i8>(ptr_i32) };
   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D clippy::transmute-ptr-to-ptr` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::transmute_ptr_to_ptr)]`
help: use `pointer::cast` instead
   |
LL -     let _ptr_i8_transmute = unsafe { transmute::<*const i32, *const i8>(ptr_i32) };
LL +     let _ptr_i8_transmute = unsafe { ptr_i32.cast::<i8>() };
   |

error: transmute from a pointer to a pointer
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:29:46
   |
LL |     let _ptr_to_unsized_transmute = unsafe { transmute::<*const [i32], *const [u32]>(slice_ptr) };
   |                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: use an `as` cast instead
   |
LL -     let _ptr_to_unsized_transmute = unsafe { transmute::<*const [i32], *const [u32]>(slice_ptr) };
LL +     let _ptr_to_unsized_transmute = unsafe { slice_ptr as *const [u32] };
   |

error: transmute from `*const i32` to `usize` which could be expressed as a pointer cast instead
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:36:50
   |
LL |     let _usize_from_int_ptr_transmute = unsafe { transmute::<*const i32, usize>(ptr_i32) };
   |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr_i32 as usize`
   |
   = note: `-D clippy::transmutes-expressible-as-ptr-casts` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::transmutes_expressible_as_ptr_casts)]`

error: transmute from a reference to a pointer
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:43:41
   |
LL |     let _array_ptr_transmute = unsafe { transmute::<&[i32; 4], *const [i32; 4]>(array_ref) };
   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `array_ref as *const [i32; 4]`

error: transmute from `fn(usize) -> u8` to `*const usize` which could be expressed as a pointer cast instead
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:52:41
   |
LL |     let _usize_ptr_transmute = unsafe { transmute::<fn(usize) -> u8, *const usize>(foo) };
   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `foo as *const usize`

error: transmute from `fn(usize) -> u8` to `usize` which could be expressed as a pointer cast instead
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:57:49
   |
LL |     let _usize_from_fn_ptr_transmute = unsafe { transmute::<fn(usize) -> u8, usize>(foo) };
   |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `foo as usize`

error: transmute from `*const u32` to `usize` which could be expressed as a pointer cast instead
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:61:36
   |
LL |     let _usize_from_ref = unsafe { transmute::<*const u32, usize>(&1u32) };
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&1u32 as *const u32 as usize`

error: transmute from a reference to a pointer
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:73:14
   |
LL |     unsafe { transmute::<&[i32; 1], *const u8>(in_param) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `in_param as *const [i32; 1] as *const u8`

error: transmute from `fn()` to `*const u8` which could be expressed as a pointer cast instead
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:92:28
   |
LL |     let _x: u8 = unsafe { *std::mem::transmute::<fn(), *const u8>(f) };
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(f as *const u8)`

error: direct cast of function item into an integer
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:54:36
   |
LL |     let _usize_ptr_transmute = foo as *const usize;
   |                                    ^^^^^^^^^^^^^^^
   |
   = note: `-D function-casts-as-integer` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
help: first cast to a function pointer `fn(usize) -> u8`
   |
LL |     let _usize_ptr_transmute = foo as fn(usize) -> u8 as *const usize;
   |                                    ++++++++++++++++++

error: direct cast of function item into an integer
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:59:34
   |
LL |     let _usize_from_fn_ptr = foo as *const usize;
   |                                  ^^^^^^^^^^^^^^^
   |
help: first cast to a function pointer `fn(usize) -> u8`
   |
LL |     let _usize_from_fn_ptr = foo as fn(usize) -> u8 as *const usize;
   |                                  ++++++++++++++++++

error: aborting due to 12 previous errors



error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:54:36
   |
54 |     let _usize_ptr_transmute = foo as *const usize;
   |                                    ^^^^^^^^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

error: there were 1 unmatched diagnostics
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:59:34
   |
59 |     let _usize_from_fn_ptr = foo as *const usize;
   |                                  ^^^^^^^^^^^^^^^ Error[function_casts_as_integer]: direct cast of function item into an integer
   |

full stderr:
error: transmute from an integer to a pointer
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:17:39
   |
LL |     let _ptr_i32_transmute = unsafe { transmute::<usize, *const i32>(usize::MAX) };
   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `usize::MAX as *const i32`
   |
   = note: `-D clippy::useless-transmute` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::useless_transmute)]`

error: transmute from a pointer to a pointer
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:22:38
   |
LL |     let _ptr_i8_transmute = unsafe { transmute::<*const i32, *const i8>(ptr_i32) };
   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D clippy::transmute-ptr-to-ptr` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::transmute_ptr_to_ptr)]`
help: use `pointer::cast` instead
   |
LL -     let _ptr_i8_transmute = unsafe { transmute::<*const i32, *const i8>(ptr_i32) };
LL +     let _ptr_i8_transmute = unsafe { ptr_i32.cast::<i8>() };
   |

error: transmute from a pointer to a pointer
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:29:46
   |
LL |     let _ptr_to_unsized_transmute = unsafe { transmute::<*const [i32], *const [u32]>(slice_ptr) };
   |                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: use an `as` cast instead
   |
LL -     let _ptr_to_unsized_transmute = unsafe { transmute::<*const [i32], *const [u32]>(slice_ptr) };
LL +     let _ptr_to_unsized_transmute = unsafe { slice_ptr as *const [u32] };
   |

error: transmute from `*const i32` to `usize` which could be expressed as a pointer cast instead
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:36:50
   |
LL |     let _usize_from_int_ptr_transmute = unsafe { transmute::<*const i32, usize>(ptr_i32) };
   |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `ptr_i32 as usize`
   |
   = note: `-D clippy::transmutes-expressible-as-ptr-casts` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::transmutes_expressible_as_ptr_casts)]`

error: transmute from a reference to a pointer
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:43:41
   |
LL |     let _array_ptr_transmute = unsafe { transmute::<&[i32; 4], *const [i32; 4]>(array_ref) };
   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `array_ref as *const [i32; 4]`

error: transmute from `fn(usize) -> u8` to `*const usize` which could be expressed as a pointer cast instead
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:52:41
   |
LL |     let _usize_ptr_transmute = unsafe { transmute::<fn(usize) -> u8, *const usize>(foo) };
   |                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `foo as *const usize`

error: transmute from `fn(usize) -> u8` to `usize` which could be expressed as a pointer cast instead
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:57:49
   |
LL |     let _usize_from_fn_ptr_transmute = unsafe { transmute::<fn(usize) -> u8, usize>(foo) };
   |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `foo as usize`

error: transmute from `*const u32` to `usize` which could be expressed as a pointer cast instead
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:61:36
   |
LL |     let _usize_from_ref = unsafe { transmute::<*const u32, usize>(&1u32) };
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&1u32 as *const u32 as usize`

error: transmute from a reference to a pointer
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:73:14
   |
LL |     unsafe { transmute::<&[i32; 1], *const u8>(in_param) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `in_param as *const [i32; 1] as *const u8`

error: transmute from `fn()` to `*const u8` which could be expressed as a pointer cast instead
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:92:28
   |
LL |     let _x: u8 = unsafe { *std::mem::transmute::<fn(), *const u8>(f) };
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(f as *const u8)`

error: direct cast of function item into an integer
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:54:36
   |
LL |     let _usize_ptr_transmute = foo as *const usize;
   |                                    ^^^^^^^^^^^^^^^
   |
   = note: `-D function-casts-as-integer` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
help: first cast to a function pointer `fn(usize) -> u8`
   |
LL |     let _usize_ptr_transmute = foo as fn(usize) -> u8 as *const usize;
   |                                    ++++++++++++++++++

error: direct cast of function item into an integer
##[error]  --> tests/ui/transmutes_expressible_as_ptr_casts.rs:59:34
   |
LL |     let _usize_from_fn_ptr = foo as *const usize;
   |                                  ^^^^^^^^^^^^^^^
   |
help: first cast to a function pointer `fn(usize) -> u8`
   |
LL |     let _usize_from_fn_ptr = foo as fn(usize) -> u8 as *const usize;
   |                                  ++++++++++++++++++

error: aborting due to 12 previous errors


rust-log-analyzer avatar May 24 '25 19:05 rust-log-analyzer

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

rustbot avatar May 24 '25 22:05 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)
tests/pass/float_nan.rs ... ok
tests/pass/0weak_memory_consistency_sc.rs ... ok

FAILED TEST: tests/pass/fn_align.rs
command: MIRI_ENV_VAR_TEST="0" MIRI_TEMP="/tmp/miri-uitest-VLMRt6" RUST_BACKTRACE="1" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/miri" "--error-format=json" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/miri-sysroot" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/tmp/miri_ui/0/tests/pass" "tests/pass/fn_align.rs" "-Zmin-function-alignment=8" "--edition" "2021"

error: test got exit status: 1, but expected 0
 = note: compilation failed, but was expected to succeed

error: no output was expected
Execute `./miri test --bless` to update `tests/pass/fn_align.stderr` to the actual output
+++ <stderr output>
error: direct cast of function item into an integer
##[error]  --> tests/pass/fn_align.rs:16:18
   |
LL |     assert!((foo as usize).is_multiple_of(256));
   |                  ^^^^^^^^
   |
   = note: `-D function-casts-as-integer` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
help: first cast to a function pointer `fn()`
   |
LL |     assert!((foo as fn() as usize).is_multiple_of(256));
   |                  +++++++

error: direct cast of function item into an integer
##[error]  --> tests/pass/fn_align.rs:17:18
   |
LL |     assert!((bar as usize).is_multiple_of(16));
   |                  ^^^^^^^^
   |
help: first cast to a function pointer `fn()`
   |
LL |     assert!((bar as fn() as usize).is_multiple_of(16));
   |                  +++++++

error: direct cast of function item into an integer
##[error]  --> tests/pass/fn_align.rs:20:18
   |
LL |     assert!((baz as usize).is_multiple_of(8));
   |                  ^^^^^^^^
   |
help: first cast to a function pointer `fn()`
   |
LL |     assert!((baz as fn() as usize).is_multiple_of(8));
   |                  +++++++

error: miri cannot be run on programs that fail compilation

error: aborting due to 4 previous errors



full stderr:
error: direct cast of function item into an integer
##[error]  --> tests/pass/fn_align.rs:16:18
   |
LL |     assert!((foo as usize).is_multiple_of(256));
   |                  ^^^^^^^^
   |
   = note: `-D function-casts-as-integer` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
help: first cast to a function pointer `fn()`
   |
LL |     assert!((foo as fn() as usize).is_multiple_of(256));
   |                  +++++++

error: direct cast of function item into an integer
##[error]  --> tests/pass/fn_align.rs:17:18
   |
LL |     assert!((bar as usize).is_multiple_of(16));
   |                  ^^^^^^^^
   |
help: first cast to a function pointer `fn()`
   |
LL |     assert!((bar as fn() as usize).is_multiple_of(16));
   |                  +++++++

error: direct cast of function item into an integer
##[error]  --> tests/pass/fn_align.rs:20:18
   |
LL |     assert!((baz as usize).is_multiple_of(8));
   |                  ^^^^^^^^
   |
help: first cast to a function pointer `fn()`
   |
LL |     assert!((baz as fn() as usize).is_multiple_of(8));
   |                  +++++++

error: miri cannot be run on programs that fail compilation

error: aborting due to 4 previous errors


full stdout:



FAILED TEST: tests/pass/backtrace/backtrace-api-v1.rs
command: MIRI_ENV_VAR_TEST="0" MIRI_TEMP="/tmp/miri-uitest-VLMRt6" RUST_BACKTRACE="1" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/miri" "--error-format=json" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/miri-sysroot" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/tmp/miri_ui/0/tests/pass/backtrace" "tests/pass/backtrace/backtrace-api-v1.rs" "--edition" "2021"

error: test got exit status: 1, but expected 0
 = note: compilation failed, but was expected to succeed

error: actual output differed from expected
---
-RUSTLIB/std/src/rt.rs:LL:CC (std::rt::lang_start)
+error: direct cast of function item into an integer
+  --> tests/pass/backtrace/backtrace-api-v1.rs:LL:CC
+   |
+LL |             assert_eq!(func_a as *mut (), miri_frame.fn_ptr);
+   |                               ^^^^^^^^^^
+   |
+   = note: `-D function-casts-as-integer` implied by `-D warnings`
+   = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
+help: first cast to a function pointer `fn() -> std::boxed::Box<[*mut ()]>`
+   |
+LL |             assert_eq!(func_a as fn() -> std::boxed::Box<[*mut ()]> as *mut (), miri_frame.fn_ptr);
+   |                               +++++++++++++++++++++++++++++++++++++
+
+error: miri cannot be run on programs that fail compilation
+
+error: aborting due to 2 previous errors
+

Full unnormalized output:
error: direct cast of function item into an integer
##[error]  --> tests/pass/backtrace/backtrace-api-v1.rs:49:31
   |
LL |             assert_eq!(func_a as *mut (), miri_frame.fn_ptr);
   |                               ^^^^^^^^^^
   |
   = note: `-D function-casts-as-integer` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
help: first cast to a function pointer `fn() -> std::boxed::Box<[*mut ()]>`
   |
LL |             assert_eq!(func_a as fn() -> std::boxed::Box<[*mut ()]> as *mut (), miri_frame.fn_ptr);
   |                               +++++++++++++++++++++++++++++++++++++

error: miri cannot be run on programs that fail compilation

error: aborting due to 2 previous errors
---
full stderr:
error: direct cast of function item into an integer
##[error]  --> tests/pass/backtrace/backtrace-api-v1.rs:49:31
   |
LL |             assert_eq!(func_a as *mut (), miri_frame.fn_ptr);
   |                               ^^^^^^^^^^
   |
   = note: `-D function-casts-as-integer` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
help: first cast to a function pointer `fn() -> std::boxed::Box<[*mut ()]>`
   |
LL |             assert_eq!(func_a as fn() -> std::boxed::Box<[*mut ()]> as *mut (), miri_frame.fn_ptr);
   |                               +++++++++++++++++++++++++++++++++++++

error: miri cannot be run on programs that fail compilation

error: aborting due to 2 previous errors
---

Location:
   /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ui_test-0.29.2/src/lib.rs:369

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
error: test failed, to rerun pass `--test ui`

Caused by:
  process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/ui-5a4f22761d8182b7` (exit status: 1)
Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:03:51
  local time: Sat May 24 23:18:23 UTC 2025
  network time: Sat, 24 May 2025 23:18:24 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

rust-log-analyzer avatar May 24 '25 23:05 rust-log-analyzer

The Miri subtree was changed

cc @rust-lang/miri

rustbot avatar May 27 '25 14:05 rustbot

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#2 transferring dockerfile: 2.62kB done
#2 DONE 0.0s

#3 [internal] load metadata for docker.io/library/ubuntu:22.04
#3 ERROR: failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/ubuntu/manifests/sha256:67cadaff1dca187079fce41360d5a7eb6f7dcd3745e53c79ad5efd8563118240: 429 Too Many Requests - Server message: toomanyrequests: You have reached your unauthenticated pull rate limit. https://www.docker.com/increase-rate-limit
------
 > [internal] load metadata for docker.io/library/ubuntu:22.04:
------
Dockerfile:1
--------------------
   1 | >>> FROM ubuntu:22.04
   2 |     
   3 |     ARG DEBIAN_FRONTEND=noninteractive
--------------------
ERROR: failed to solve: ubuntu:22.04: failed to resolve source metadata for docker.io/library/ubuntu:22.04: failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/ubuntu/manifests/sha256:67cadaff1dca187079fce41360d5a7eb6f7dcd3745e53c79ad5efd8563118240: 429 Too Many Requests - Server message: toomanyrequests: You have reached your unauthenticated pull rate limit. https://www.docker.com/increase-rate-limit
Command failed. Attempt 2/5:
#0 building with "nostalgic_kilby" instance using docker-container driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 2.62kB done
#1 DONE 0.0s

#2 [internal] load metadata for docker.io/library/ubuntu:22.04
#2 ERROR: failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/ubuntu/manifests/sha256:899ec23064539c814a4dbbf98d4baf0e384e4394ebc8638bea7bbe4cb8ef4e12: 429 Too Many Requests - Server message: toomanyrequests: You have reached your unauthenticated pull rate limit. https://www.docker.com/increase-rate-limit
------
 > [internal] load metadata for docker.io/library/ubuntu:22.04:
------
Dockerfile:1
--------------------
   1 | >>> FROM ubuntu:22.04
   2 |     
   3 |     ARG DEBIAN_FRONTEND=noninteractive
--------------------
ERROR: failed to solve: ubuntu:22.04: failed to resolve source metadata for docker.io/library/ubuntu:22.04: failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/ubuntu/manifests/sha256:899ec23064539c814a4dbbf98d4baf0e384e4394ebc8638bea7bbe4cb8ef4e12: 429 Too Many Requests - Server message: toomanyrequests: You have reached your unauthenticated pull rate limit. https://www.docker.com/increase-rate-limit
Command failed. Attempt 3/5:
#0 building with "nostalgic_kilby" instance using docker-container driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 2.62kB done
#1 DONE 0.0s

#2 [internal] load metadata for docker.io/library/ubuntu:22.04
#2 ERROR: failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/ubuntu/manifests/sha256:899ec23064539c814a4dbbf98d4baf0e384e4394ebc8638bea7bbe4cb8ef4e12: 429 Too Many Requests - Server message: toomanyrequests: You have reached your unauthenticated pull rate limit. https://www.docker.com/increase-rate-limit
------
 > [internal] load metadata for docker.io/library/ubuntu:22.04:
------
Dockerfile:1
--------------------
   1 | >>> FROM ubuntu:22.04
   2 |     
   3 |     ARG DEBIAN_FRONTEND=noninteractive
--------------------
ERROR: failed to solve: ubuntu:22.04: failed to resolve source metadata for docker.io/library/ubuntu:22.04: failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/ubuntu/manifests/sha256:899ec23064539c814a4dbbf98d4baf0e384e4394ebc8638bea7bbe4cb8ef4e12: 429 Too Many Requests - Server message: toomanyrequests: You have reached your unauthenticated pull rate limit. https://www.docker.com/increase-rate-limit
Command failed. Attempt 4/5:
#0 building with "nostalgic_kilby" instance using docker-container driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 2.62kB done
#1 DONE 0.0s

#2 [internal] load metadata for docker.io/library/ubuntu:22.04
#2 ERROR: failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/ubuntu/manifests/sha256:899ec23064539c814a4dbbf98d4baf0e384e4394ebc8638bea7bbe4cb8ef4e12: 429 Too Many Requests - Server message: toomanyrequests: You have reached your unauthenticated pull rate limit. https://www.docker.com/increase-rate-limit
------
 > [internal] load metadata for docker.io/library/ubuntu:22.04:
------
Dockerfile:1
--------------------
   1 | >>> FROM ubuntu:22.04
   2 |     
   3 |     ARG DEBIAN_FRONTEND=noninteractive
--------------------
ERROR: failed to solve: ubuntu:22.04: failed to resolve source metadata for docker.io/library/ubuntu:22.04: failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/ubuntu/manifests/sha256:899ec23064539c814a4dbbf98d4baf0e384e4394ebc8638bea7bbe4cb8ef4e12: 429 Too Many Requests - Server message: toomanyrequests: You have reached your unauthenticated pull rate limit. https://www.docker.com/increase-rate-limit
Command failed. Attempt 5/5:
#0 building with "nostalgic_kilby" instance using docker-container driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 2.62kB done
#1 DONE 0.0s

#2 [internal] load metadata for docker.io/library/ubuntu:22.04
#2 ERROR: failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/ubuntu/manifests/sha256:899ec23064539c814a4dbbf98d4baf0e384e4394ebc8638bea7bbe4cb8ef4e12: 429 Too Many Requests - Server message: toomanyrequests: You have reached your unauthenticated pull rate limit. https://www.docker.com/increase-rate-limit
------
 > [internal] load metadata for docker.io/library/ubuntu:22.04:
------
Dockerfile:1
--------------------
   1 | >>> FROM ubuntu:22.04
   2 |     
   3 |     ARG DEBIAN_FRONTEND=noninteractive
--------------------
ERROR: failed to solve: ubuntu:22.04: failed to resolve source metadata for docker.io/library/ubuntu:22.04: failed to copy: httpReadSeeker: failed open: unexpected status code https://registry-1.docker.io/v2/library/ubuntu/manifests/sha256:899ec23064539c814a4dbbf98d4baf0e384e4394ebc8638bea7bbe4cb8ef4e12: 429 Too Many Requests - Server message: toomanyrequests: You have reached your unauthenticated pull rate limit. https://www.docker.com/increase-rate-limit
The command has failed after 5 attempts.
##[error]Process completed with exit code 1.
Post job cleanup.

rust-log-analyzer avatar May 27 '25 14:05 rust-log-analyzer

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

Click to see the possible cause of the failure (guessed by this bot)

rust-log-analyzer avatar May 27 '25 15:05 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)
#18 exporting to docker image format
#18 sending tarball 20.1s done
#18 DONE 27.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-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', '--set', 'gcc.download-ci-gcc=true', '--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
---
[RUSTC-TIMING] proc_macro test:false 5.493
[RUSTC-TIMING] test test:false 9.134
    Finished `release` profile [optimized] target(s) in 1m 19s
##[endgroup]
[TIMING] core::build_steps::compile::Std { target: x86_64-unknown-linux-gnu, compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu, forced_compiler: true }, crates: [], force_recompile: false, extra_rust_args: ["-Csymbol-mangling-version=v0", "-Cpanic=abort"], is_for_mir_opt_tests: false } -- 79.639
Testing GCC stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
 Downloading crates ...
  Downloaded boml v0.3.1
   Compiling boml v0.3.1
[RUSTC-TIMING] boml test:false 0.776
   Compiling y v0.1.0 (/checkout/compiler/rustc_codegen_gcc/build_system)
[RUSTC-TIMING] y test:false 2.950
    Finished `release` profile [optimized] target(s) in 4.11s
     Running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-codegen/x86_64-unknown-linux-gnu/release/y test --use-backend gcc --gcc-path /checkout/obj/build/x86_64-unknown-linux-gnu/ci-gcc/lib --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc --release --mini-tests --std-tests`
`--gcc-path` was provided, ignoring config file. Using `/checkout/obj/build/x86_64-unknown-linux-gnu/ci-gcc/lib` as path for libgccjit
[BUILD] mini_core
[RUSTC-TIMING] mini_core test:false 0.206
[BUILD] example
[AOT] mini_core_hello_world
[RUSTC-TIMING] mini_core_hello_world test:false 0.183

rust-log-analyzer avatar May 27 '25 19:05 rust-log-analyzer

Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter gets adapted for the changes, if necessary.

cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr

rustbot avatar May 27 '25 19:05 rustbot

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)
#18 exporting to docker image format
#18 sending tarball 19.4s done
#18 DONE 32.6s
##[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', '--set', 'gcc.download-ci-gcc=true', '--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
---
[RUSTC-TIMING] proc_macro test:false 5.540
[RUSTC-TIMING] test test:false 9.524
    Finished `release` profile [optimized] target(s) in 1m 20s
##[endgroup]
[TIMING] core::build_steps::compile::Std { target: x86_64-unknown-linux-gnu, compiler: Compiler { stage: 1, host: x86_64-unknown-linux-gnu, forced_compiler: true }, crates: [], force_recompile: false, extra_rust_args: ["-Csymbol-mangling-version=v0", "-Cpanic=abort"], is_for_mir_opt_tests: false } -- 80.394
Testing GCC stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
 Downloading crates ...
  Downloaded boml v0.3.1
   Compiling boml v0.3.1
[RUSTC-TIMING] boml test:false 0.770
   Compiling y v0.1.0 (/checkout/compiler/rustc_codegen_gcc/build_system)
[RUSTC-TIMING] y test:false 2.924
    Finished `release` profile [optimized] target(s) in 4.16s
     Running `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-codegen/x86_64-unknown-linux-gnu/release/y test --use-backend gcc --gcc-path /checkout/obj/build/x86_64-unknown-linux-gnu/ci-gcc/lib --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/cg_gcc --release --mini-tests --std-tests`
`--gcc-path` was provided, ignoring config file. Using `/checkout/obj/build/x86_64-unknown-linux-gnu/ci-gcc/lib` as path for libgccjit
[BUILD] mini_core
[RUSTC-TIMING] mini_core test:false 0.206
[BUILD] example
[AOT] mini_core_hello_world
[RUSTC-TIMING] mini_core_hello_world test:false 0.181
---
[TIMING] core::build_steps::test::BookTest { compiler: Compiler { stage: 2, host: x86_64-unknown-linux-gnu, forced_compiler: false }, path: "src/doc/rustc", name: "rustc", is_ext_doc: false, dependencies: [] } -- 3.134
[TIMING] core::build_steps::test::RustcBook { compiler: Compiler { stage: 2, host: x86_64-unknown-linux-gnu, forced_compiler: false } } -- 0.000
Generating lint docs (x86_64-unknown-linux-gnu)
##[group]Running stage2 lint-docs (x86_64-unknown-linux-gnu)
error: failed to test example in lint docs for `function_casts_as_integer` in /checkout/compiler/rustc_lint/src/function_cast_as_integer.rs:9: lint docs should start with the text "The `function_casts_as_integer` lint" to introduce the lint

This error was generated by the lint-docs tool.
This tool extracts documentation for lints from the source code and places
them in the rustc book. See the declare_lint! documentation
https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint_defs/macro.declare_lint.html
for an example of the format of documentation this tool expects.

To re-run these tests, run: ./x.py test --keep-stage=0 src/tools/lint-docs
The --keep-stage flag should be used if you have already built the compiler
and are only modifying the doc comments to avoid rebuilding the compiler.

Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:40:19
  local time: Tue May 27 20:25:00 UTC 2025
  network time: Tue, 27 May 2025 20:25:00 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

rust-log-analyzer avatar May 27 '25 20:05 rust-log-analyzer

:umbrella: The latest upstream changes (presumably #141668) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar May 28 '25 05:05 bors

CI finally passed. \o/

GuillaumeGomez avatar May 28 '25 13:05 GuillaumeGomez

:umbrella: The latest upstream changes (presumably #141753) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar May 30 '25 09:05 bors

Applied suggestions. About enum variants: they have been updated, so now casting unit-line variants into integers is completely ok, and other variants casting into integer throw an error. So all good there. :)

GuillaumeGomez avatar Jun 04 '25 16:06 GuillaumeGomez

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

Click to see the possible cause of the failure (guessed by this bot)
error: direct cast of function item into an integer
   --> library/std/src/sys/pal/windows/compat.rs:158:67
    |
135 |  / macro_rules! compat_fn_with_fallback {
136 |  |     (pub static $module:ident: &CStr = $name:expr; $(
137 |  |         $(#[$meta:meta])*
138 |  |         $vis:vis fn $symbol:ident($($argname:ident: $argtype:ty),*) -> $rettype:ty $fallback_body:block
...    |
158 |  |             static PTR: Atomic<*mut c_void> = AtomicPtr::new(load as *mut _);
    |  |                                                                   ^^^^^^^^^
...    |
196 |  |     )*)
197 |  | }
    |  |_- in this expansion of `compat_fn_with_fallback!`
    |
   ::: library/std/src/sys/pal/windows/c.rs:124:1
    |
124 | /  compat_fn_with_fallback! {
125 | |      pub static KERNEL32: &CStr = c"kernel32";
...   |
151 | |  }
    | |__- in this macro invocation
    |
    = note: `-D function-casts-as-integer` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
help: first cast to a function pointer `unsafe extern "system" fn(*mut libc::c_void, *const u16) -> i32`
    |
158 |             static PTR: Atomic<*mut c_void> = AtomicPtr::new(load as unsafe extern "system" fn(*mut libc::c_void, *const u16) -> i32 as *mut _);
    |                                                                   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

error: direct cast of function item into an integer
   --> library/std/src/sys/pal/windows/compat.rs:174:44
    |
135 |  / macro_rules! compat_fn_with_fallback {
136 |  |     (pub static $module:ident: &CStr = $name:expr; $(
137 |  |         $(#[$meta:meta])*
138 |  |         $vis:vis fn $symbol:ident($($argname:ident: $argtype:ty),*) -> $rettype:ty $fallback_body:block
...    |
174 |  |                         PTR.store(fallback as *mut _, Ordering::Relaxed);
    |  |                                            ^^^^^^^^^
...    |
196 |  |     )*)
197 |  | }
    |  |_- in this expansion of `compat_fn_with_fallback!`
    |
   ::: library/std/src/sys/pal/windows/c.rs:124:1
    |
124 | /  compat_fn_with_fallback! {
125 | |      pub static KERNEL32: &CStr = c"kernel32";
...   |
151 | |  }
    | |__- in this macro invocation
    |
help: first cast to a function pointer `unsafe extern "system" fn(*mut libc::c_void, *const u16) -> i32`
    |
174 |                         PTR.store(fallback as unsafe extern "system" fn(*mut libc::c_void, *const u16) -> i32 as *mut _, Ordering::Relaxed);
    |                                            ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

error: direct cast of function item into an integer
   --> library/std/src/sys/pal/windows/compat.rs:158:67
    |
135 |  / macro_rules! compat_fn_with_fallback {
136 |  |     (pub static $module:ident: &CStr = $name:expr; $(
137 |  |         $(#[$meta:meta])*
138 |  |         $vis:vis fn $symbol:ident($($argname:ident: $argtype:ty),*) -> $rettype:ty $fallback_body:block
...    |
158 |  |             static PTR: Atomic<*mut c_void> = AtomicPtr::new(load as *mut _);
    |  |                                                                   ^^^^^^^^^
...    |
196 |  |     )*)
197 |  | }
    |  |_- in this expansion of `compat_fn_with_fallback!`
    |
   ::: library/std/src/sys/pal/windows/c.rs:124:1
    |
124 | /  compat_fn_with_fallback! {
125 | |      pub static KERNEL32: &CStr = c"kernel32";
...   |
151 | |  }
    | |__- in this macro invocation
    |
help: first cast to a function pointer `unsafe extern "system" fn(*mut libc::c_void, *mut *mut u16) -> i32`
    |
158 |             static PTR: Atomic<*mut c_void> = AtomicPtr::new(load as unsafe extern "system" fn(*mut libc::c_void, *mut *mut u16) -> i32 as *mut _);
    |                                                                   +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

error: direct cast of function item into an integer
   --> library/std/src/sys/pal/windows/compat.rs:174:44
    |
135 |  / macro_rules! compat_fn_with_fallback {
136 |  |     (pub static $module:ident: &CStr = $name:expr; $(
137 |  |         $(#[$meta:meta])*
138 |  |         $vis:vis fn $symbol:ident($($argname:ident: $argtype:ty),*) -> $rettype:ty $fallback_body:block
...    |
174 |  |                         PTR.store(fallback as *mut _, Ordering::Relaxed);
    |  |                                            ^^^^^^^^^
...    |
196 |  |     )*)
197 |  | }
    |  |_- in this expansion of `compat_fn_with_fallback!`
    |
   ::: library/std/src/sys/pal/windows/c.rs:124:1
    |
124 | /  compat_fn_with_fallback! {
125 | |      pub static KERNEL32: &CStr = c"kernel32";
...   |
151 | |  }
    | |__- in this macro invocation
    |
help: first cast to a function pointer `unsafe extern "system" fn(*mut libc::c_void, *mut *mut u16) -> i32`
    |
174 |                         PTR.store(fallback as unsafe extern "system" fn(*mut libc::c_void, *mut *mut u16) -> i32 as *mut _, Ordering::Relaxed);
    |                                            +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

error: direct cast of function item into an integer
   --> library/std/src/sys/pal/windows/compat.rs:158:67
    |
135 |  / macro_rules! compat_fn_with_fallback {
136 |  |     (pub static $module:ident: &CStr = $name:expr; $(
137 |  |         $(#[$meta:meta])*
138 |  |         $vis:vis fn $symbol:ident($($argname:ident: $argtype:ty),*) -> $rettype:ty $fallback_body:block
...    |
158 |  |             static PTR: Atomic<*mut c_void> = AtomicPtr::new(load as *mut _);
    |  |                                                                   ^^^^^^^^^
...    |
196 |  |     )*)
197 |  | }
    |  |_- in this expansion of `compat_fn_with_fallback!`
    |
   ::: library/std/src/sys/pal/windows/c.rs:124:1
    |
124 | /  compat_fn_with_fallback! {
125 | |      pub static KERNEL32: &CStr = c"kernel32";
...   |
151 | |  }
    | |__- in this macro invocation
    |
help: first cast to a function pointer `unsafe extern "system" fn(u32, *mut u16) -> u32`
    |
158 |             static PTR: Atomic<*mut c_void> = AtomicPtr::new(load as unsafe extern "system" fn(u32, *mut u16) -> u32 as *mut _);
    |                                                                   ++++++++++++++++++++++++++++++++++++++++++++++++++

error: direct cast of function item into an integer
   --> library/std/src/sys/pal/windows/compat.rs:174:44
    |
135 |  / macro_rules! compat_fn_with_fallback {
136 |  |     (pub static $module:ident: &CStr = $name:expr; $(
137 |  |         $(#[$meta:meta])*
138 |  |         $vis:vis fn $symbol:ident($($argname:ident: $argtype:ty),*) -> $rettype:ty $fallback_body:block
...    |
174 |  |                         PTR.store(fallback as *mut _, Ordering::Relaxed);
    |  |                                            ^^^^^^^^^
...    |
196 |  |     )*)
197 |  | }
    |  |_- in this expansion of `compat_fn_with_fallback!`
    |
   ::: library/std/src/sys/pal/windows/c.rs:124:1
    |
124 | /  compat_fn_with_fallback! {
125 | |      pub static KERNEL32: &CStr = c"kernel32";
...   |
151 | |  }
    | |__- in this macro invocation
    |
help: first cast to a function pointer `unsafe extern "system" fn(u32, *mut u16) -> u32`
    |
174 |                         PTR.store(fallback as unsafe extern "system" fn(u32, *mut u16) -> u32 as *mut _, Ordering::Relaxed);
    |                                            ++++++++++++++++++++++++++++++++++++++++++++++++++

[RUSTC-TIMING] std test:false 7.645
error: could not compile `std` (lib) due to 6 previous errors
Build completed unsuccessfully in 0:11:13

rust-log-analyzer avatar Jun 04 '25 17:06 rust-log-analyzer

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

Click to see the possible cause of the failure (guessed by this bot)
   Compiling addr2line v0.24.2
[RUSTC-TIMING] gimli test:false 7.410
[RUSTC-TIMING] addr2line test:false 1.129
[RUSTC-TIMING] object test:false 10.979
error[E0605]: non-primitive cast: `unsafe extern "system" fn(*mut libc::c_void, *mut *mut u16) -> i32 {GetThreadDescription::load}` as `unsafe extern "system" fn(*mut libc::c_void, *const u16) -> i32`
   --> library/std/src/sys/pal/windows/compat.rs:158:62
    |
135 |  / macro_rules! compat_fn_with_fallback {
136 |  |     (pub static $module:ident: &CStr = $name:expr; $(
137 |  |         $(#[$meta:meta])*
138 |  |         $vis:vis fn $symbol:ident($($argname:ident: $argtype:ty),*) -> $rettype:ty $fallback_body:block
...    |
158 |  |             static PTR: Atomic<*mut c_void> = AtomicPtr::new(load as unsafe extern "system" fn(*mut libc::c_void, *const u16) -> i32 as *...
    |  |                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid cast
...    |
196 |  |     )*)
197 |  | }
    |  |_- in this expansion of `compat_fn_with_fallback!`
    |
   ::: library/std/src/sys/pal/windows/c.rs:124:1
    |
124 | /  compat_fn_with_fallback! {
125 | |      pub static KERNEL32: &CStr = c"kernel32";
...   |
151 | |  }
    | |__- in this macro invocation

error[E0605]: non-primitive cast: `unsafe extern "system" fn(*mut libc::c_void, *mut *mut u16) -> i32 {GetThreadDescription::fallback}` as `unsafe extern "system" fn(*mut libc::c_void, *const u16) -> i32`
   --> library/std/src/sys/pal/windows/compat.rs:174:35
    |
135 |  / macro_rules! compat_fn_with_fallback {
136 |  |     (pub static $module:ident: &CStr = $name:expr; $(
137 |  |         $(#[$meta:meta])*
138 |  |         $vis:vis fn $symbol:ident($($argname:ident: $argtype:ty),*) -> $rettype:ty $fallback_body:block
...    |
174 |  |                         PTR.store(fallback as unsafe extern "system" fn(*mut libc::c_void, *const u16) -> i32 as *mut _, Ordering::Relaxed);
    |  |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid cast
...    |
196 |  |     )*)
197 |  | }
    |  |_- in this expansion of `compat_fn_with_fallback!`
    |
   ::: library/std/src/sys/pal/windows/c.rs:124:1
    |
124 | /  compat_fn_with_fallback! {
125 | |      pub static KERNEL32: &CStr = c"kernel32";
...   |
151 | |  }
    | |__- in this macro invocation

error[E0605]: non-primitive cast: `unsafe extern "system" fn(u32, *mut u16) -> u32 {GetTempPath2W::load}` as `unsafe extern "system" fn(*mut libc::c_void, *const u16) -> i32`
   --> library/std/src/sys/pal/windows/compat.rs:158:62
    |
135 |  / macro_rules! compat_fn_with_fallback {
136 |  |     (pub static $module:ident: &CStr = $name:expr; $(
137 |  |         $(#[$meta:meta])*
138 |  |         $vis:vis fn $symbol:ident($($argname:ident: $argtype:ty),*) -> $rettype:ty $fallback_body:block
...    |
158 |  |             static PTR: Atomic<*mut c_void> = AtomicPtr::new(load as unsafe extern "system" fn(*mut libc::c_void, *const u16) -> i32 as *...
    |  |                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid cast
...    |
196 |  |     )*)
197 |  | }
    |  |_- in this expansion of `compat_fn_with_fallback!`
    |
   ::: library/std/src/sys/pal/windows/c.rs:124:1
    |
124 | /  compat_fn_with_fallback! {
125 | |      pub static KERNEL32: &CStr = c"kernel32";
...   |
151 | |  }
    | |__- in this macro invocation

error[E0605]: non-primitive cast: `unsafe extern "system" fn(u32, *mut u16) -> u32 {GetTempPath2W::fallback}` as `unsafe extern "system" fn(*mut libc::c_void, *const u16) -> i32`
   --> library/std/src/sys/pal/windows/compat.rs:174:35
    |
135 |  / macro_rules! compat_fn_with_fallback {
136 |  |     (pub static $module:ident: &CStr = $name:expr; $(
137 |  |         $(#[$meta:meta])*
138 |  |         $vis:vis fn $symbol:ident($($argname:ident: $argtype:ty),*) -> $rettype:ty $fallback_body:block
...    |
174 |  |                         PTR.store(fallback as unsafe extern "system" fn(*mut libc::c_void, *const u16) -> i32 as *mut _, Ordering::Relaxed);
    |  |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid cast
...    |
196 |  |     )*)
197 |  | }
    |  |_- in this expansion of `compat_fn_with_fallback!`
    |
   ::: library/std/src/sys/pal/windows/c.rs:124:1
    |
124 | /  compat_fn_with_fallback! {
125 | |      pub static KERNEL32: &CStr = c"kernel32";
...   |
151 | |  }
    | |__- in this macro invocation

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

rust-log-analyzer avatar Jun 04 '25 18:06 rust-log-analyzer

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

Click to see the possible cause of the failure (guessed by this bot)
   Compiling addr2line v0.24.2
[RUSTC-TIMING] gimli test:false 7.105
[RUSTC-TIMING] addr2line test:false 1.099
[RUSTC-TIMING] object test:false 10.905
error[E0605]: non-primitive cast: `unsafe extern "system" fn(*mut libc::c_void, *mut *mut u16) -> i32 {GetThreadDescription::fallback}` as `unsafe extern "system" fn(*mut libc::c_void, *const u16) -> i32`
   --> library/std/src/sys/pal/windows/compat.rs:174:35
    |
135 |  / macro_rules! compat_fn_with_fallback {
136 |  |     (pub static $module:ident: &CStr = $name:expr; $(
137 |  |         $(#[$meta:meta])*
138 |  |         $vis:vis fn $symbol:ident($($argname:ident: $argtype:ty),*) -> $rettype:ty $fallback_body:block
...    |
174 |  |                         PTR.store(fallback as unsafe extern "system" fn(*mut libc::c_void, *const u16) -> i32 as *mut _, Ordering::Relaxed);
    |  |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid cast
...    |
196 |  |     )*)
197 |  | }
    |  |_- in this expansion of `compat_fn_with_fallback!`
    |
   ::: library/std/src/sys/pal/windows/c.rs:124:1
    |
124 | /  compat_fn_with_fallback! {
125 | |      pub static KERNEL32: &CStr = c"kernel32";
...   |
151 | |  }
    | |__- in this macro invocation

error[E0605]: non-primitive cast: `unsafe extern "system" fn(u32, *mut u16) -> u32 {GetTempPath2W::fallback}` as `unsafe extern "system" fn(*mut libc::c_void, *const u16) -> i32`
   --> library/std/src/sys/pal/windows/compat.rs:174:35
    |
135 |  / macro_rules! compat_fn_with_fallback {
136 |  |     (pub static $module:ident: &CStr = $name:expr; $(
137 |  |         $(#[$meta:meta])*
138 |  |         $vis:vis fn $symbol:ident($($argname:ident: $argtype:ty),*) -> $rettype:ty $fallback_body:block
...    |
174 |  |                         PTR.store(fallback as unsafe extern "system" fn(*mut libc::c_void, *const u16) -> i32 as *mut _, Ordering::Relaxed);
    |  |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid cast
...    |
196 |  |     )*)
197 |  | }
    |  |_- in this expansion of `compat_fn_with_fallback!`
    |
   ::: library/std/src/sys/pal/windows/c.rs:124:1
    |
124 | /  compat_fn_with_fallback! {
125 | |      pub static KERNEL32: &CStr = c"kernel32";
...   |
151 | |  }
    | |__- in this macro invocation

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

rust-log-analyzer avatar Jun 04 '25 19:06 rust-log-analyzer

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

Click to see the possible cause of the failure (guessed by this bot)
    Checking windows-sys v0.52.0
error: direct cast of function item into an integer
   --> compiler/rustc_session/src/filesearch.rs:155:37
    |
155 |             PCWSTR(current_dll_path as *mut u16),
    |                                     ^^^^^^^^^^^
    |
    = note: `-D function-casts-as-integer` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
help: first cast to a function pointer `fn() -> Result<std::path::PathBuf, std::string::String>`
    |
155 |             PCWSTR(current_dll_path as fn() -> Result<std::path::PathBuf, std::string::String> as *mut u16),
    |                                     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[RUSTC-TIMING] rustc_session test:false 4.030
error: could not compile `rustc_session` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

rust-log-analyzer avatar Jun 04 '25 19:06 rust-log-analyzer

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

Click to see the possible cause of the failure (guessed by this bot)
    Checking std_detect v0.1.5 (/checkout/library/stdarch/crates/std_detect)
error: direct cast of function item into an integer
   --> library/panic_unwind/src/seh.rs:330:42
    |
330 |             ptr_t::new(exception_cleanup as *mut u8).raw(),
    |                                          ^^^^^^^^^^
    |
    = note: `-D function-casts-as-integer` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
help: first cast to a function pointer `unsafe extern "thiscall" fn(*mut Exception)`
    |
330 |             ptr_t::new(exception_cleanup as unsafe extern "thiscall" fn(*mut Exception) as *mut u8).raw(),
    |                                          ++++++++++++++++++++++++++++++++++++++++++++++

error: direct cast of function item into an integer
   --> library/panic_unwind/src/seh.rs:346:39
    |
346 |             ptr_t::new(exception_copy as *mut u8).raw(),
    |                                       ^^^^^^^^^^
    |
help: first cast to a function pointer `unsafe extern "thiscall-unwind" fn(*mut Exception, *mut Exception) -> *mut Exception`
    |
346 |             ptr_t::new(exception_copy as unsafe extern "thiscall-unwind" fn(*mut Exception, *mut Exception) -> *mut Exception as *mut u8).raw(),
    |                                       +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[RUSTC-TIMING] panic_unwind test:false 0.088
error: could not compile `panic_unwind` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

rust-log-analyzer avatar Jun 04 '25 20:06 rust-log-analyzer

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

Click to see the possible cause of the failure (guessed by this bot)
    Checking hashbrown v0.15.3
error: the calling convention "thiscall" is not supported on this target
   --> library/panic_unwind/src/seh.rs:330:45
    |
330 |             ptr_t::new(exception_cleanup as unsafe extern "thiscall" fn(*mut Exception) as *mut u8)
    |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
    = note: `-D unsupported-fn-ptr-calling-conventions` implied by `-D warnings`
---
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>

error[E0605]: non-primitive cast: `unsafe extern "C" fn(*mut Exception) {exception_cleanup}` as `unsafe extern "thiscall" fn(*mut Exception)`
   --> library/panic_unwind/src/seh.rs:330:24
    |
330 |             ptr_t::new(exception_cleanup as unsafe extern "thiscall" fn(*mut Exception) as *mut u8)
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid cast

error[E0605]: non-primitive cast: `unsafe extern "C-unwind" fn(*mut Exception, *mut Exception) -> *mut Exception {exception_copy}` as `unsafe extern "thiscall-unwind" fn(*mut Exception, *mut Exception) -> *mut Exception`
   --> library/panic_unwind/src/seh.rs:348:17
    |
348 | /                 exception_copy
349 | |                     as unsafe extern "thiscall-unwind" fn(
350 | |                         *mut Exception,
351 | |                         *mut Exception,

rust-log-analyzer avatar Jun 05 '25 09:06 rust-log-analyzer

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

Click to see the possible cause of the failure (guessed by this bot)
    Checking panic_unwind v0.0.0 (/checkout/library/panic_unwind)
[RUSTC-TIMING] rustc_std_workspace_alloc test:false 0.029
    Checking std_detect v0.1.5 (/checkout/library/stdarch/crates/std_detect)
    Checking hashbrown v0.15.3
error[E0605]: non-primitive cast: `unsafe extern "thiscall" fn(*mut Exception) {exception_cleanup}` as `unsafe extern "C" fn(*mut Exception)`
   --> library/panic_unwind/src/seh.rs:331:13
    |
331 |             exception_cleanup as unsafe extern "C" fn(*mut Exception) as *mut u8
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid cast

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

rust-log-analyzer avatar Jun 05 '25 10:06 rust-log-analyzer

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

Click to see the possible cause of the failure (guessed by this bot)
    Checking std_detect v0.1.5 (/checkout/library/stdarch/crates/std_detect)
error: unknown lint: `function_casts_as_integer_lint`
   --> library/panic_unwind/src/seh.rs:328:17
    |
328 |         #[allow(function_casts_as_integer_lint)]
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `function_casts_as_integer`
    |
    = note: `-D unknown-lints` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unknown_lints)]`

error: direct cast of function item into an integer
   --> library/panic_unwind/src/seh.rs:331:42
    |
331 |             ptr_t::new(exception_cleanup as *mut u8).raw(),
    |                                          ^^^^^^^^^^
    |
    = note: `-D function-casts-as-integer` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(function_casts_as_integer)]`
help: first cast to a function pointer `unsafe extern "thiscall" fn(*mut Exception)`
    |
331 |             ptr_t::new(exception_cleanup as unsafe extern "thiscall" fn(*mut Exception) as *mut u8).raw(),
    |                                          ++++++++++++++++++++++++++++++++++++++++++++++

[RUSTC-TIMING] panic_unwind test:false 0.113
error: could not compile `panic_unwind` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

rust-log-analyzer avatar Jun 05 '25 13:06 rust-log-analyzer

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

Click to see the possible cause of the failure (guessed by this bot)
    = note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
    = note: `-D unsupported-fn-ptr-calling-conventions` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unsupported_fn_ptr_calling_conventions)]`

error[E0605]: non-primitive cast: `unsafe extern "C-unwind" fn(*mut Exception, *mut Exception) -> *mut Exception {exception_copy}` as `unsafe extern "thiscall-unwind" fn(*mut Exception, *mut Exception) -> *mut Exception`
   --> library/panic_unwind/src/seh.rs:348:17
    |
348 | /                 exception_copy
349 | |                     as unsafe extern "thiscall-unwind" fn(
350 | |                         *mut Exception,
351 | |                         *mut Exception,

rust-log-analyzer avatar Jun 05 '25 13:06 rust-log-analyzer

CI finally passed again!

GuillaumeGomez avatar Jun 05 '25 21:06 GuillaumeGomez

:umbrella: The latest upstream changes (presumably #138677) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Jun 05 '25 23:06 bors

Oh no. T_T

GuillaumeGomez avatar Jun 06 '25 09:06 GuillaumeGomez

CI passed. :)

GuillaumeGomez avatar Jun 06 '25 11:06 GuillaumeGomez