From 980b31646f38b123ba3667607508bf52b0845e85 Mon Sep 17 00:00:00 2001 From: Camille Gillot Date: Wed, 15 Oct 2025 23:08:15 +0000 Subject: [PATCH 01/41] Remove ShallowInitBox. --- src/base.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/base.rs b/src/base.rs index 1a916c876824..e4865ece63b6 100644 --- a/src/base.rs +++ b/src/base.rs @@ -902,7 +902,6 @@ fn is_wide_ptr<'tcx>(fx: &FunctionCx<'_, '_, 'tcx>, ty: Ty<'tcx>) -> bool { lval.write_cvalue_transmute(fx, operand); } Rvalue::CopyForDeref(_) => bug!("`CopyForDeref` in codegen"), - Rvalue::ShallowInitBox(..) => bug!("`ShallowInitBox` in codegen"), } } StatementKind::StorageLive(_) From 9ddb7fc60a596492db05b3ed846c0dc5f1ebbf23 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Wed, 18 Feb 2026 15:02:27 +0000 Subject: [PATCH 02/41] Merge commit 'abdb98ad4b47117ee3be17b1e43fab34f18f5805' into sync_cg_clif-2026-02-18 --- .github/scripts/free-disk-space.sh | 259 ++++++++++++++++++ .github/workflows/abi-cafe.yml | 6 + .github/workflows/audit.yml | 2 +- Cargo.lock | 108 ++++---- Cargo.toml | 24 +- build_system/build_backend.rs | 2 + build_system/build_sysroot.rs | 9 +- config.txt | 2 +- ...esn-t-get-emitted-unless-VaList-is-a.patch | 25 ++ rust-toolchain.toml | 2 +- scripts/jit-helpers.py | 52 ++++ scripts/setup_rust_fork.sh | 44 ++- scripts/test_rustc_tests.sh | 38 +-- src/abi/mod.rs | 6 +- 14 files changed, 472 insertions(+), 107 deletions(-) create mode 100755 .github/scripts/free-disk-space.sh create mode 100644 patches/0028-stdlib-Ensure-va_end-doesn-t-get-emitted-unless-VaList-is-a.patch create mode 100644 scripts/jit-helpers.py diff --git a/.github/scripts/free-disk-space.sh b/.github/scripts/free-disk-space.sh new file mode 100755 index 000000000000..06afdaad619f --- /dev/null +++ b/.github/scripts/free-disk-space.sh @@ -0,0 +1,259 @@ +#!/bin/bash +# Ported from rust-lang/rust commit d29e4783dff30f9526eeba3929ebfe86c00c9dad in src/ci/scripts/free-disk-space-linux.sh +set -euo pipefail + +# Script inspired by https://github.com/jlumbroso/free-disk-space +isX86() { + local arch + arch=$(uname -m) + if [ "$arch" = "x86_64" ]; then + return 0 + else + return 1 + fi +} + +# In aws codebuild, the variable RUNNER_ENVIRONMENT is "self-hosted". +isGitHubRunner() { + # `:-` means "use the value of RUNNER_ENVIRONMENT if it exists, otherwise use an empty string". + if [[ "${RUNNER_ENVIRONMENT:-}" == "github-hosted" ]]; then + return 0 + else + return 1 + fi +} + +# print a line of the specified character +printSeparationLine() { + for ((i = 0; i < 80; i++)); do + printf "%s" "$1" + done + printf "\n" +} + +# REF: https://stackoverflow.com/a/450821/408734 +getAvailableSpace() { + df -a | awk 'NR > 1 {avail+=$4} END {print avail}' +} + +# REF: https://unix.stackexchange.com/a/44087/60849 +formatByteCount() { + numfmt --to=iec-i --suffix=B --padding=7 "${1}000" +} + +# macro to output saved space +printSavedSpace() { + # Disk space before the operation + local before=${1} + local title=${2:-} + + local after + after=$(getAvailableSpace) + local saved=$((after - before)) + + if [ "$saved" -lt 0 ]; then + echo "::warning::Saved space is negative: $saved. Using '0' as saved space." + saved=0 + fi + + echo "" + printSeparationLine "*" + if [ -n "${title}" ]; then + echo "=> ${title}: Saved $(formatByteCount "$saved")" + else + echo "=> Saved $(formatByteCount "$saved")" + fi + printSeparationLine "*" + echo "" +} + +# macro to print output of df with caption +printDF() { + local caption=${1} + + printSeparationLine "=" + echo "${caption}" + echo "" + echo "$ df -h" + echo "" + df -h + printSeparationLine "=" +} + +removeUnusedFilesAndDirs() { + local to_remove=( + "/usr/share/java" + ) + + if isGitHubRunner; then + to_remove+=( + "/usr/local/aws-sam-cli" + "/usr/local/doc/cmake" + "/usr/local/julia"* + "/usr/local/lib/android" + "/usr/local/share/chromedriver-"* + "/usr/local/share/chromium" + "/usr/local/share/cmake-"* + "/usr/local/share/edge_driver" + "/usr/local/share/emacs" + "/usr/local/share/gecko_driver" + "/usr/local/share/icons" + "/usr/local/share/powershell" + "/usr/local/share/vcpkg" + "/usr/local/share/vim" + "/usr/share/apache-maven-"* + "/usr/share/gradle-"* + "/usr/share/kotlinc" + "/usr/share/miniconda" + "/usr/share/php" + "/usr/share/ri" + "/usr/share/swift" + + # binaries + "/usr/local/bin/azcopy" + "/usr/local/bin/bicep" + "/usr/local/bin/ccmake" + "/usr/local/bin/cmake-"* + "/usr/local/bin/cmake" + "/usr/local/bin/cpack" + "/usr/local/bin/ctest" + "/usr/local/bin/helm" + "/usr/local/bin/kind" + "/usr/local/bin/kustomize" + "/usr/local/bin/minikube" + "/usr/local/bin/packer" + "/usr/local/bin/phpunit" + "/usr/local/bin/pulumi-"* + "/usr/local/bin/pulumi" + "/usr/local/bin/stack" + + # Haskell runtime + "/usr/local/.ghcup" + + # Azure + "/opt/az" + "/usr/share/az_"* + ) + + if [ -n "${AGENT_TOOLSDIRECTORY:-}" ]; then + # Environment variable set by GitHub Actions + to_remove+=( + "${AGENT_TOOLSDIRECTORY}" + ) + else + echo "::warning::AGENT_TOOLSDIRECTORY is not set. Skipping removal." + fi + else + # Remove folders and files present in AWS CodeBuild + to_remove+=( + # binaries + "/usr/local/bin/ecs-cli" + "/usr/local/bin/eksctl" + "/usr/local/bin/kubectl" + + "${HOME}/.gradle" + "${HOME}/.dotnet" + "${HOME}/.goenv" + "${HOME}/.phpenv" + + ) + fi + + for element in "${to_remove[@]}"; do + if [ ! -e "$element" ]; then + # The file or directory doesn't exist. + # Maybe it was removed in a newer version of the runner or it's not present in a + # specific architecture (e.g. ARM). + echo "::warning::Directory or file $element does not exist, skipping." + fi + done + + # Remove all files and directories at once to save time. + sudo rm -rf "${to_remove[@]}" +} + +execAndMeasureSpaceChange() { + local operation=${1} # Function to execute + local title=${2} + + local before + before=$(getAvailableSpace) + $operation + + printSavedSpace "$before" "$title" +} + +# REF: https://github.com/apache/flink/blob/master/tools/azure-pipelines/free_disk_space.sh +cleanPackages() { + local packages=( + '^aspnetcore-.*' + '^dotnet-.*' + '^llvm-.*' + '^mongodb-.*' + 'firefox' + 'libgl1-mesa-dri' + 'mono-devel' + 'php.*' + ) + + if isGitHubRunner; then + packages+=( + azure-cli + ) + + if isX86; then + packages+=( + 'google-chrome-stable' + 'google-cloud-cli' + 'google-cloud-sdk' + 'powershell' + ) + fi + else + packages+=( + 'google-chrome-stable' + ) + fi + + WAIT_DPKG_LOCK="-o DPkg::Lock::Timeout=60" + sudo apt-get ${WAIT_DPKG_LOCK} -qq remove -y --fix-missing "${packages[@]}" + + sudo apt-get ${WAIT_DPKG_LOCK} autoremove -y \ + || echo "::warning::The command [sudo apt-get autoremove -y] failed" + sudo apt-get ${WAIT_DPKG_LOCK} clean \ + || echo "::warning::The command [sudo apt-get clean] failed" +} + +# They aren't present in ubuntu 24 runners. +cleanDocker() { + echo "=> Removing the following docker images:" + sudo docker image ls + echo "=> Removing docker images..." + sudo docker image prune --all --force || true +} + +# Remove Swap storage +cleanSwap() { + sudo swapoff -a || true + sudo rm -rf /mnt/swapfile || true + free -h +} + +# Display initial disk space stats +AVAILABLE_INITIAL=$(getAvailableSpace) + +printDF "BEFORE CLEAN-UP:" +echo "" +execAndMeasureSpaceChange cleanPackages "Unused packages" +execAndMeasureSpaceChange cleanDocker "Docker images" +execAndMeasureSpaceChange cleanSwap "Swap storage" +execAndMeasureSpaceChange removeUnusedFilesAndDirs "Unused files and directories" + +# Output saved space statistic +echo "" +printDF "AFTER CLEAN-UP:" + +echo "" +echo "" + +printSavedSpace "$AVAILABLE_INITIAL" "Total saved" diff --git a/.github/workflows/abi-cafe.yml b/.github/workflows/abi-cafe.yml index 170c7126c296..3367562f2683 100644 --- a/.github/workflows/abi-cafe.yml +++ b/.github/workflows/abi-cafe.yml @@ -49,6 +49,12 @@ jobs: if: matrix.os == 'ubuntu-latest' run: cat /proc/cpuinfo + - name: Free disk space + if: runner.os == 'Linux' + env: + RUNNER_ENVIRONMENT: github-hosted + run: .github/scripts/free-disk-space.sh + - name: Cache cargo target dir uses: actions/cache@v4 with: diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 274b9504beb0..95a4dcd3266d 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -13,6 +13,6 @@ jobs: - uses: actions/checkout@v4 - run: | sed -i 's/components.*/components = []/' rust-toolchain.toml - - uses: rustsec/audit-check@v1.4.1 + - uses: rustsec/audit-check@v2.0.0 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Cargo.lock b/Cargo.lock index 3d13b5540e19..afc1d0d0ab95 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,9 +28,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bumpalo" -version = "3.19.0" +version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" dependencies = [ "allocator-api2", ] @@ -43,42 +43,42 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "cranelift-assembler-x64" -version = "0.127.0" +version = "0.128.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bd963a645179fa33834ba61fa63353998543b07f877e208da9eb47d4a70d1e7" +checksum = "0377b13bf002a0774fcccac4f1102a10f04893d24060cf4b7350c87e4cbb647c" dependencies = [ "cranelift-assembler-x64-meta", ] [[package]] name = "cranelift-assembler-x64-meta" -version = "0.127.0" +version = "0.128.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6d5739c9dc6b5553ca758d78d87d127dd19f397f776efecf817b8ba8d0bb01" +checksum = "cfa027979140d023b25bf7509fb7ede3a54c3d3871fb5ead4673c4b633f671a2" dependencies = [ "cranelift-srcgen", ] [[package]] name = "cranelift-bforest" -version = "0.127.0" +version = "0.128.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff402c11bb1c9652b67a3e885e84b1b8d00c13472c8fd85211e06a41a63c3e03" +checksum = "618e4da87d9179a70b3c2f664451ca8898987aa6eb9f487d16988588b5d8cc40" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-bitset" -version = "0.127.0" +version = "0.128.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "769a0d88c2f5539e9c5536a93a7bf164b0dc68d91e3d00723e5b4ffc1440afdc" +checksum = "db53764b5dad233b37b8f5dc54d3caa9900c54579195e00f17ea21f03f71aaa7" [[package]] name = "cranelift-codegen" -version = "0.127.0" +version = "0.128.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4351f721fb3b26add1c180f0a75c7474bab2f903c8b777c6ca65238ded59a78" +checksum = "4ae927f1d8c0abddaa863acd201471d56e7fc6c3925104f4861ed4dc3e28b421" dependencies = [ "bumpalo", "cranelift-assembler-x64", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.127.0" +version = "0.128.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61f86c0ba5b96713643f4dd0de0df12844de9c7bb137d6829b174b706939aa74" +checksum = "d3fcf1e3e6757834bd2584f4cbff023fcc198e9279dcb5d684b4bb27a9b19f54" dependencies = [ "cranelift-assembler-x64-meta", "cranelift-codegen-shared", @@ -114,33 +114,33 @@ dependencies = [ [[package]] name = "cranelift-codegen-shared" -version = "0.127.0" +version = "0.128.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f08605eee8d51fd976a970bd5b16c9529b51b624f8af68f80649ffb172eb85a4" +checksum = "205dcb9e6ccf9d368b7466be675ff6ee54a63e36da6fe20e72d45169cf6fd254" [[package]] name = "cranelift-control" -version = "0.127.0" +version = "0.128.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "623aab0a09e40f0cf0b5d35eb7832bae4c4f13e3768228e051a6c1a60e88ef5f" +checksum = "108eca9fcfe86026054f931eceaf57b722c1b97464bf8265323a9b5877238817" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.127.0" +version = "0.128.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea0f066e07e3bcbe38884cc5c94c32c7a90267d69df80f187d9dfe421adaa7c4" +checksum = "a0d96496910065d3165f84ff8e1e393916f4c086f88ac8e1b407678bc78735aa" dependencies = [ "cranelift-bitset", ] [[package]] name = "cranelift-frontend" -version = "0.127.0" +version = "0.128.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40865b02a0e52ca8e580ad64feef530cb1d05f6bb4972b4eef05e3eaeae81701" +checksum = "e303983ad7e23c850f24d9c41fc3cb346e1b930f066d3966545e4c98dac5c9fb" dependencies = [ "cranelift-codegen", "log", @@ -150,15 +150,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.127.0" +version = "0.128.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "104b3c117ae513e9af1d90679842101193a5ccb96ac9f997966d85ea25be2852" +checksum = "24b0cf8d867d891245836cac7abafb0a5b0ea040a019d720702b3b8bcba40bfa" [[package]] name = "cranelift-jit" -version = "0.127.0" +version = "0.128.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3aa5f855cfb8e4253ed2d0dfc1a0b6ebe4912e67aa8b7ee14026ff55ca17f1fe" +checksum = "dcf1e35da6eca2448395f483eb172ce71dd7842f7dc96f44bb8923beafe43c6d" dependencies = [ "anyhow", "cranelift-codegen", @@ -176,9 +176,9 @@ dependencies = [ [[package]] name = "cranelift-module" -version = "0.127.0" +version = "0.128.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d01806b191b59f4fc4680293dd5f554caf2de5b62f95eff5beef7acb46c29c" +checksum = "792ba2a54100e34f8a36e3e329a5207cafd1f0918a031d34695db73c163fdcc7" dependencies = [ "anyhow", "cranelift-codegen", @@ -187,9 +187,9 @@ dependencies = [ [[package]] name = "cranelift-native" -version = "0.127.0" +version = "0.128.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c54e0a358bc05b48f2032e1c320e7f468da068604f2869b77052eab68eb0fe" +checksum = "e24b641e315443e27807b69c440fe766737d7e718c68beb665a2d69259c77bf3" dependencies = [ "cranelift-codegen", "libc", @@ -198,9 +198,9 @@ dependencies = [ [[package]] name = "cranelift-object" -version = "0.127.0" +version = "0.128.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d17e0216be5daabab616647c1918e06dae0708474ba5f7b7762ac24ea5eb126" +checksum = "ecba1f219a201cf946150538e631defd620c5051b62c52ecb89a0004bab263d4" dependencies = [ "anyhow", "cranelift-codegen", @@ -213,9 +213,9 @@ dependencies = [ [[package]] name = "cranelift-srcgen" -version = "0.127.0" +version = "0.128.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6f4b039f453b66c75e9f7886e5a2af96276e151f44dc19b24b58f9a0c98009" +checksum = "a4e378a54e7168a689486d67ee1f818b7e5356e54ae51a1d7a53f4f13f7f8b7a" [[package]] name = "crc32fast" @@ -257,9 +257,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.4" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ "foldhash", ] @@ -282,9 +282,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.178" +version = "0.2.180" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" [[package]] name = "libloading" @@ -298,9 +298,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "log" @@ -337,27 +337,27 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.103" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.42" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" dependencies = [ "proc-macro2", ] [[package]] name = "regalloc2" -version = "0.13.3" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e249c660440317032a71ddac302f25f1d5dff387667bcc3978d1f77aa31ac34" +checksum = "08effbc1fa53aaebff69521a5c05640523fab037b34a4a2c109506bc938246fa" dependencies = [ "allocator-api2", "bumpalo", @@ -446,9 +446,9 @@ checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "syn" -version = "2.0.111" +version = "2.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" +checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" dependencies = [ "proc-macro2", "quote", @@ -457,9 +457,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df7f62577c25e07834649fc3b39fafdc597c0a3527dc1c60129201ccfcbaa50c" +checksum = "b1dd07eb858a2067e2f3c7155d54e929265c264e6f37efe3ee7a8d1b5a1dd0ba" [[package]] name = "unicode-ident" @@ -469,9 +469,9 @@ checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] name = "wasmtime-internal-jit-icache-coherence" -version = "40.0.0" +version = "41.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0858b470463f3e7c73acd6049046049e64be17b98901c2db5047450cf83df1fe" +checksum = "bada5ca1cc47df7d14100e2254e187c2486b426df813cea2dd2553a7469f7674" dependencies = [ "anyhow", "cfg-if", @@ -481,9 +481,9 @@ dependencies = [ [[package]] name = "wasmtime-internal-math" -version = "40.0.0" +version = "41.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222e1a590ece4e898f20af1e541b61d2cb803f2557e7eaff23e6c1db5434454a" +checksum = "cf6f615d528eda9adc6eefb062135f831b5215c348f4c3ec3e143690c730605b" dependencies = [ "libm", ] diff --git a/Cargo.toml b/Cargo.toml index ee4bde477c47..a7b4664282ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,12 +8,12 @@ crate-type = ["dylib"] [dependencies] # These have to be in sync with each other -cranelift-codegen = { version = "0.127.0", default-features = false, features = ["std", "timing", "unwind", "all-native-arch"] } -cranelift-frontend = { version = "0.127.0" } -cranelift-module = { version = "0.127.0" } -cranelift-native = { version = "0.127.0" } -cranelift-jit = { version = "0.127.0", optional = true } -cranelift-object = { version = "0.127.0" } +cranelift-codegen = { version = "0.128.3", default-features = false, features = ["std", "timing", "unwind", "all-native-arch"] } +cranelift-frontend = { version = "0.128.3" } +cranelift-module = { version = "0.128.3" } +cranelift-native = { version = "0.128.3" } +cranelift-jit = { version = "0.128.3", optional = true } +cranelift-object = { version = "0.128.3" } target-lexicon = "0.13" gimli = { version = "0.32", default-features = false, features = ["write"] } object = { version = "0.37.3", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] } @@ -24,12 +24,12 @@ smallvec = "1.8.1" [patch.crates-io] # Uncomment to use an unreleased version of cranelift -#cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-40.0.0" } -#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-40.0.0" } -#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-40.0.0" } -#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-40.0.0" } -#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-40.0.0" } -#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-40.0.0" } +#cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-41.0.0" } +#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-41.0.0" } +#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-41.0.0" } +#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-41.0.0" } +#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-41.0.0" } +#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-41.0.0" } # Uncomment to use local checkout of cranelift #cranelift-codegen = { path = "../wasmtime/cranelift/codegen" } diff --git a/build_system/build_backend.rs b/build_system/build_backend.rs index c0a8cc95614f..6b14727cd153 100644 --- a/build_system/build_backend.rs +++ b/build_system/build_backend.rs @@ -43,6 +43,8 @@ pub(crate) fn build_backend( cmd.arg("--release"); + cmd.arg("-Zno-embed-metadata"); + eprintln!("[BUILD] rustc_codegen_cranelift"); crate::utils::spawn_and_wait(cmd); diff --git a/build_system/build_sysroot.rs b/build_system/build_sysroot.rs index 7b4c604580c1..5205ec1e8aaa 100644 --- a/build_system/build_sysroot.rs +++ b/build_system/build_sysroot.rs @@ -235,17 +235,14 @@ fn build_clif_sysroot_for_triple( if let Some(prefix) = env::var_os("CG_CLIF_STDLIB_REMAP_PATH_PREFIX") { rustflags.push("--remap-path-prefix".to_owned()); - rustflags.push(format!( - "{}={}", - STDLIB_SRC.to_path(dirs).to_str().unwrap(), - prefix.to_str().unwrap() - )); + rustflags.push(format!("library/={}/library", prefix.to_str().unwrap())); } compiler.rustflags.extend(rustflags); let mut build_cmd = STANDARD_LIBRARY.build(&compiler, dirs); build_cmd.arg("--release"); build_cmd.arg("--features").arg("backtrace panic-unwind"); build_cmd.arg(format!("-Zroot-dir={}", STDLIB_SRC.to_path(dirs).display())); + build_cmd.arg("-Zno-embed-metadata"); build_cmd.env("CARGO_PROFILE_RELEASE_DEBUG", "true"); build_cmd.env("__CARGO_DEFAULT_LIB_METADATA", "cg_clif"); if compiler.triple.contains("apple") { @@ -260,7 +257,7 @@ fn build_clif_sysroot_for_triple( for entry in fs::read_dir(build_dir.join("deps")).unwrap() { let entry = entry.unwrap(); if let Some(ext) = entry.path().extension() { - if ext == "rmeta" || ext == "d" || ext == "dSYM" || ext == "clif" { + if ext == "d" || ext == "dSYM" || ext == "clif" { continue; } } else { diff --git a/config.txt b/config.txt index 85748a4f8a78..72631355733c 100644 --- a/config.txt +++ b/config.txt @@ -20,7 +20,7 @@ aot.mini_core_hello_world testsuite.base_sysroot aot.arbitrary_self_types_pointers_and_wrappers -jit.std_example +#jit.std_example # FIXME(#1619) broken for some reason aot.std_example aot.dst_field_align aot.subslice-patterns-const-eval diff --git a/patches/0028-stdlib-Ensure-va_end-doesn-t-get-emitted-unless-VaList-is-a.patch b/patches/0028-stdlib-Ensure-va_end-doesn-t-get-emitted-unless-VaList-is-a.patch new file mode 100644 index 000000000000..2aa93164674f --- /dev/null +++ b/patches/0028-stdlib-Ensure-va_end-doesn-t-get-emitted-unless-VaList-is-a.patch @@ -0,0 +1,25 @@ +From 116abc64add4d617104993a7a3011f20bcf31ef2 Mon Sep 17 00:00:00 2001 +From: bjorn3 <17426603+bjorn3@users.noreply.github.com> +Date: Mon, 26 Jan 2026 16:20:58 +0000 +Subject: [PATCH] Ensure va_end doesn't get emitted unless VaList is actually + used + +--- + library/core/src/ffi/va_list.rs | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/library/core/src/ffi/va_list.rs b/library/core/src/ffi/va_list.rs +index d0f1553..75129af 100644 +--- a/library/core/src/ffi/va_list.rs ++++ b/library/core/src/ffi/va_list.rs +@@ -217,6 +217,7 @@ impl Clone for VaList<'_> { + + #[rustc_const_unstable(feature = "const_c_variadic", issue = "151787")] + impl<'f> const Drop for VaList<'f> { ++ #[inline] + fn drop(&mut self) { + // SAFETY: this variable argument list is being dropped, so won't be read from again. + unsafe { va_end(self) } +-- +2.43.0 + diff --git a/rust-toolchain.toml b/rust-toolchain.toml index b157c5879ba7..fe967c84352c 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2025-12-23" +channel = "nightly-2026-02-18" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt"] profile = "minimal" diff --git a/scripts/jit-helpers.py b/scripts/jit-helpers.py new file mode 100644 index 000000000000..1128521c0dfb --- /dev/null +++ b/scripts/jit-helpers.py @@ -0,0 +1,52 @@ +import gdb + +def jitmap_raw(): + pid = gdb.selected_inferior().pid + jitmap_file = open("/tmp/perf-%d.map" % (pid,), "r") + jitmap = jitmap_file.read() + jitmap_file.close() + return jitmap + +def jit_functions(): + jitmap = jitmap_raw() + + functions = [] + for line in jitmap.strip().split("\n"): + [addr, size, name] = line.split(" ") + functions.append((int(addr, 16), int(size, 16), name)) + + return functions + +class JitDecorator(gdb.FrameDecorator.FrameDecorator): + def __init__(self, fobj, name): + super(JitDecorator, self).__init__(fobj) + self.name = name + + def function(self): + return self.name + +class JitFilter: + """ + A backtrace filter which reads perf map files produced by cranelift-jit. + """ + + def __init__(self): + self.name = 'JitFilter' + self.enabled = True + self.priority = 0 + + gdb.current_progspace().frame_filters[self.name] = self + + # FIXME add an actual unwinder or somehow register JITed .eh_frame with gdb to avoid relying on + # gdb unwinder heuristics. + def filter(self, frame_iter): + for frame in frame_iter: + frame_addr = frame.inferior_frame().pc() + for (addr, size, name) in jit_functions(): + if frame_addr >= addr and frame_addr < addr + size: + yield JitDecorator(frame, name) + break + else: + yield frame + +JitFilter() diff --git a/scripts/setup_rust_fork.sh b/scripts/setup_rust_fork.sh index c16cb4e538fe..bb9f69b5c974 100644 --- a/scripts/setup_rust_fork.sh +++ b/scripts/setup_rust_fork.sh @@ -49,25 +49,45 @@ std-features = ["panic-unwind"] EOF cat <( - ); +@@ -2249,7 +2249,7 @@ pub fn parse_download_ci_llvm<'a>( } -- #[cfg(not(test))] + #[cfg(not(test))] - if b && dwn_ctx.is_running_on_ci && CiEnv::is_rust_lang_managed_ci_job() { -- // On rust-lang CI, we must always rebuild LLVM if there were any modifications to it -- panic!( -- "\`llvm.download-ci-llvm\` cannot be set to \`true\` on CI. Use \`if-unchanged\` instead." -- ); -- } -- - // If download-ci-llvm=true we also want to check that CI llvm is available - b && llvm::is_ci_llvm_available_for_target(&dwn_ctx.host_target, asserts) - } ++ if false && dwn_ctx.is_running_on_ci && CiEnv::is_rust_lang_managed_ci_job() { + // On rust-lang CI, we must always rebuild LLVM if there were any modifications to it + panic!( + "\`llvm.download-ci-llvm\` cannot be set to \`true\` on CI. Use \`if-unchanged\` instead." +diff --git a/src/build_helper/src/git.rs b/src/build_helper/src/git.rs +index 330fb465de..a4593ed96f 100644 +--- a/src/build_helper/src/git.rs ++++ b/src/build_helper/src/git.rs +@@ -218,7 +218,7 @@ pub fn get_closest_upstream_commit( + config: &GitConfig<'_>, + env: CiEnv, + ) -> Result, String> { +- let base = match env { ++ let base = match CiEnv::None { + CiEnv::None => "HEAD", + CiEnv::GitHubActions => { + // On CI, we should always have a non-upstream merge commit at the tip, EOF popd diff --git a/scripts/test_rustc_tests.sh b/scripts/test_rustc_tests.sh index b25269d1430a..4cad18f2a94f 100755 --- a/scripts/test_rustc_tests.sh +++ b/scripts/test_rustc_tests.sh @@ -10,11 +10,6 @@ pushd rust command -v rg >/dev/null 2>&1 || cargo install ripgrep -rm -r tests/ui/{lto/,linkage*} || true -for test in $(rg --files-with-matches "lto" tests/{codegen-units,ui,incremental}); do - rm $test -done - # should-fail tests don't work when compiletest is compiled with panic=abort for test in $(rg --files-with-matches "//@ should-fail" tests/{codegen-units,ui,incremental}); do rm $test @@ -38,6 +33,7 @@ rm tests/ui/simd/intrinsic/generic-arithmetic-pass.rs # unimplemented simd_funne rm -r tests/ui/scalable-vectors # scalable vectors are unsupported # exotic linkages +rm -r tests/ui/linkage* rm tests/incremental/hashes/function_interfaces.rs rm tests/incremental/hashes/statics.rs rm -r tests/run-make/naked-symbol-visibility @@ -45,11 +41,13 @@ rm -r tests/run-make/naked-symbol-visibility # variadic arguments rm tests/ui/abi/mir/mir_codegen_calls_variadic.rs # requires float varargs rm tests/ui/c-variadic/naked.rs # same +rm tests/ui/consts/const-eval/c-variadic.rs # same rm tests/ui/abi/variadic-ffi.rs # requires callee side vararg support rm -r tests/run-make/c-link-to-rust-va-list-fn # requires callee side vararg support rm tests/ui/c-variadic/valid.rs # same rm tests/ui/c-variadic/trait-method.rs # same rm tests/ui/c-variadic/inherent-method.rs # same +rm tests/ui/c-variadic/copy.rs # same rm tests/ui/sanitizer/kcfi-c-variadic.rs # same rm tests/ui/c-variadic/same-program-multiple-abis-x86_64.rs # variadics for calling conventions other than C unsupported rm tests/ui/delegation/fn-header.rs @@ -79,6 +77,10 @@ rm -r tests/ui/eii # EII not yet implemented rm -r tests/run-make/forced-unwind-terminate-pof # forced unwinding doesn't take precedence # requires LTO +rm -r tests/ui/lto +for test in $(rg --files-with-matches "lto" tests/{codegen-units,ui,incremental}); do + rm $test +done rm -r tests/run-make/cdylib rm -r tests/run-make/codegen-options-parsing rm -r tests/run-make/lto-* @@ -126,6 +128,14 @@ rm -r tests/run-make/notify-all-emit-artifacts rm -r tests/run-make/reset-codegen-1 rm -r tests/run-make/inline-always-many-cgu rm -r tests/run-make/intrinsic-unreachable +rm -r tests/run-make/artifact-incr-cache +rm -r tests/run-make/artifact-incr-cache-no-obj +rm -r tests/run-make/emit +rm -r tests/run-make/llvm-outputs +rm -r tests/run-make/panic-impl-transitive +rm -r tests/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo.rs +rm -r tests/ui/statics/issue-91050-1.rs +rm -r tests/ui/statics/issue-91050-2.rs # giving different but possibly correct results # ============================================= @@ -134,6 +144,7 @@ rm tests/ui/mir/mir_raw_fat_ptr.rs # same rm tests/ui/consts/issue-33537.rs # same rm tests/ui/consts/const-mut-refs-crate.rs # same rm tests/ui/abi/large-byval-align.rs # exceeds implementation limit of Cranelift +rm -r tests/run-make/short-ice # ICE backtrace begin/end marker mismatch # doesn't work due to the way the rustc test suite is invoked. # should work when using ./x.py test the way it is intended @@ -147,20 +158,15 @@ rm -r tests/run-make-cargo/panic-immediate-abort-codegen # same rm -r tests/run-make/missing-unstable-trait-bound # This disables support for unstable features, but running cg_clif needs some unstable features rm -r tests/run-make/const-trait-stable-toolchain # same rm -r tests/run-make/print-request-help-stable-unstable # same +rm -r tests/run-make/issue-149402-suggest-unresolve # same rm -r tests/run-make/incr-add-rust-src-component rm tests/ui/errors/remap-path-prefix-sysroot.rs # different sysroot source path rm -r tests/run-make/export/extern-opt # something about rustc version mismatches rm -r tests/run-make/export # same rm -r tests/ui/compiletest-self-test/compile-flags-incremental.rs # needs compiletest compiled with panic=unwind -rm tests/ui/async-await/in-trait/dont-project-to-specializable-projection.rs # something going wrong with stdlib source remapping -rm tests/ui/consts/miri_unleashed/drop.rs # same -rm tests/ui/error-emitter/multiline-removal-suggestion.rs # same -rm tests/ui/lint/lint-const-item-mutation.rs # same -rm tests/ui/lint/use-redundant/use-redundant-issue-71450.rs # same -rm tests/ui/lint/use-redundant/use-redundant-prelude-rust-2021.rs # same -rm tests/ui/specialization/const_trait_impl.rs # same -rm tests/ui/thir-print/offset_of.rs # same -rm tests/ui/traits/const-traits/const_closure-const_trait_impl-ice-113381.rs # same +rm -r tests/ui/extern/extern-types-field-offset.rs # expects /rustc/ rather than /rustc/FAKE_PREFIX +rm -r tests/ui/process/println-with-broken-pipe.rs # same +rm tests/codegen-units/item-collection/opaque-return-impls.rs # extra mono item. possibly due to other configuration # genuine bugs # ============ @@ -170,11 +176,7 @@ rm -r tests/run-make/panic-abort-eh_frame # .eh_frame emitted with panic=abort # bugs in the test suite # ====================== rm tests/ui/process/nofile-limit.rs # TODO some AArch64 linking issue -rm tests/ui/backtrace/synchronized-panic-handler.rs # missing needs-unwind annotation -rm tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rs # same -rm tests/ui/async-await/async-drop/async-drop-initial.rs # same (rust-lang/rust#140493) rm -r tests/ui/codegen/equal-pointers-unequal # make incorrect assumptions about the location of stack variables -rm -r tests/run-make-cargo/rustdoc-scrape-examples-paths # FIXME(rust-lang/rust#145580) incr comp bug rm -r tests/incremental/extern_static/issue-49153.rs # assumes reference to undefined static gets optimized away rm tests/ui/intrinsics/panic-uninitialized-zeroed.rs # really slow with unoptimized libstd diff --git a/src/abi/mod.rs b/src/abi/mod.rs index 5a46f79e2ba0..133e7e26c0de 100644 --- a/src/abi/mod.rs +++ b/src/abi/mod.rs @@ -53,8 +53,10 @@ pub(crate) fn conv_to_call_conv( default_call_conv: CallConv, ) -> CallConv { match c { - CanonAbi::Rust | CanonAbi::C => default_call_conv, - CanonAbi::RustCold => CallConv::Cold, + CanonAbi::Rust | CanonAbi::RustCold | CanonAbi::C => default_call_conv, + + // Cranelift doesn't currently have anything for this. + CanonAbi::RustPreserveNone => default_call_conv, // Cranelift doesn't currently have anything for this. CanonAbi::RustPreserveNone => default_call_conv, From 6a1537830e393dfb937caf2e97d1c2f80049620f Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Wed, 18 Feb 2026 15:10:37 +0000 Subject: [PATCH 03/41] Fix broken merge --- src/abi/mod.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/abi/mod.rs b/src/abi/mod.rs index 133e7e26c0de..97a19b8976d3 100644 --- a/src/abi/mod.rs +++ b/src/abi/mod.rs @@ -58,9 +58,6 @@ pub(crate) fn conv_to_call_conv( // Cranelift doesn't currently have anything for this. CanonAbi::RustPreserveNone => default_call_conv, - // Cranelift doesn't currently have anything for this. - CanonAbi::RustPreserveNone => default_call_conv, - // Functions with this calling convention can only be called from assembly, but it is // possible to declare an `extern "custom"` block, so the backend still needs a calling // convention for declaring foreign functions. From ee75e9b59896b2cf098935b31da4fda011503af3 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Wed, 18 Feb 2026 15:22:36 +0000 Subject: [PATCH 04/41] Format jit-helper.py --- scripts/jit-helpers.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/jit-helpers.py b/scripts/jit-helpers.py index 1128521c0dfb..4542aef7cb52 100644 --- a/scripts/jit-helpers.py +++ b/scripts/jit-helpers.py @@ -1,5 +1,6 @@ import gdb + def jitmap_raw(): pid = gdb.selected_inferior().pid jitmap_file = open("/tmp/perf-%d.map" % (pid,), "r") @@ -7,6 +8,7 @@ def jitmap_raw(): jitmap_file.close() return jitmap + def jit_functions(): jitmap = jitmap_raw() @@ -17,6 +19,7 @@ def jit_functions(): return functions + class JitDecorator(gdb.FrameDecorator.FrameDecorator): def __init__(self, fobj, name): super(JitDecorator, self).__init__(fobj) @@ -25,13 +28,14 @@ class JitDecorator(gdb.FrameDecorator.FrameDecorator): def function(self): return self.name + class JitFilter: """ A backtrace filter which reads perf map files produced by cranelift-jit. """ def __init__(self): - self.name = 'JitFilter' + self.name = "JitFilter" self.enabled = True self.priority = 0 @@ -42,11 +46,12 @@ class JitFilter: def filter(self, frame_iter): for frame in frame_iter: frame_addr = frame.inferior_frame().pc() - for (addr, size, name) in jit_functions(): + for addr, size, name in jit_functions(): if frame_addr >= addr and frame_addr < addr + size: yield JitDecorator(frame, name) break else: yield frame + JitFilter() From 11953d71f5e18701e6a9f7c10f3bb612422e726b Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 20 Feb 2026 10:48:58 +0000 Subject: [PATCH 05/41] Rustup to rustc 1.95.0-nightly (7f99507f5 2026-02-19) --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index fe967c84352c..62e07412a7f8 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2026-02-18" +channel = "nightly-2026-02-20" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt"] profile = "minimal" From 96e7213d310861698667e36b5568147c9217c84e Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 20 Feb 2026 11:01:07 +0000 Subject: [PATCH 06/41] Fix rustc test suite --- scripts/setup_rust_fork.sh | 18 +++++++++--------- scripts/test_rustc_tests.sh | 1 - 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/scripts/setup_rust_fork.sh b/scripts/setup_rust_fork.sh index bb9f69b5c974..2ca0c3cab910 100644 --- a/scripts/setup_rust_fork.sh +++ b/scripts/setup_rust_fork.sh @@ -63,18 +63,18 @@ index 2e16f2cf27..3ac3df99a8 100644 # Note that RUSTFLAGS_BOOTSTRAP should always be added to the end of # RUSTFLAGS, since that causes RUSTFLAGS_BOOTSTRAP to override RUSTFLAGS. diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs -index a656927b1f6..44fc5546fac 100644 +index bc68bfe396..00143ef3ed 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs -@@ -2249,7 +2249,7 @@ pub fn parse_download_ci_llvm<'a>( - } +@@ -2230,7 +2230,7 @@ pub fn download_ci_rustc_commit<'a>( + return None; + } - #[cfg(not(test))] -- if b && dwn_ctx.is_running_on_ci && CiEnv::is_rust_lang_managed_ci_job() { -+ if false && dwn_ctx.is_running_on_ci && CiEnv::is_rust_lang_managed_ci_job() { - // On rust-lang CI, we must always rebuild LLVM if there were any modifications to it - panic!( - "\`llvm.download-ci-llvm\` cannot be set to \`true\` on CI. Use \`if-unchanged\` instead." +- if dwn_ctx.is_running_on_ci() { ++ if false && dwn_ctx.is_running_on_ci() { + eprintln!("CI rustc commit matches with HEAD and we are in CI."); + eprintln!( + "\`rustc.download-ci\` functionality will be skipped as artifacts are not available." diff --git a/src/build_helper/src/git.rs b/src/build_helper/src/git.rs index 330fb465de..a4593ed96f 100644 --- a/src/build_helper/src/git.rs diff --git a/scripts/test_rustc_tests.sh b/scripts/test_rustc_tests.sh index 4cad18f2a94f..798bef7ba3e3 100755 --- a/scripts/test_rustc_tests.sh +++ b/scripts/test_rustc_tests.sh @@ -20,7 +20,6 @@ for test in $(rg -i --files-with-matches "//(\[\w+\])?~[^\|]*\s*ERR|//@ error-pa done git checkout -- tests/ui/issues/auxiliary/issue-3136-a.rs # contains //~ERROR, but shouldn't be removed -git checkout -- tests/ui/proc-macro/pretty-print-hack/ git checkout -- tests/ui/entry-point/auxiliary/bad_main_functions.rs # missing features From 6b1ee2c7018e97189c06a1734937da0bf1dd32a8 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Sat, 7 Feb 2026 20:42:31 +0100 Subject: [PATCH 07/41] Stabilize `cfg_select` --- patches/0027-sysroot_tests-128bit-atomic-operations.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/0027-sysroot_tests-128bit-atomic-operations.patch b/patches/0027-sysroot_tests-128bit-atomic-operations.patch index 6ed0b17f679c..7ba4475e3145 100644 --- a/patches/0027-sysroot_tests-128bit-atomic-operations.patch +++ b/patches/0027-sysroot_tests-128bit-atomic-operations.patch @@ -17,8 +17,8 @@ index 1e336bf..35e6f54 100644 @@ -2,4 +2,3 @@ // tidy-alphabetical-start -#![cfg_attr(target_has_atomic = "128", feature(integer_atomics))] - #![cfg_attr(test, feature(cfg_select))] #![feature(array_ptr_get)] + #![feature(array_try_from_fn)] diff --git a/coretests/tests/atomic.rs b/coretests/tests/atomic.rs index b735957..ea728b6 100644 --- a/coretests/tests/atomic.rs From 3282e2cb9c8c16f6d22d90a6af2515b592b2c692 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 24 Feb 2026 16:08:32 +0000 Subject: [PATCH 08/41] Rustup to rustc 1.95.0-nightly (b3869b94c 2026-02-23) --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 62e07412a7f8..85b1cf4d6117 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2026-02-20" +channel = "nightly-2026-02-24" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt"] profile = "minimal" From 890434af218987d48f092524490c9a25ff910eeb Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 24 Feb 2026 16:13:56 +0000 Subject: [PATCH 09/41] Fix rustc test suite --- scripts/test_rustc_tests.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/test_rustc_tests.sh b/scripts/test_rustc_tests.sh index 798bef7ba3e3..6dc981531be3 100755 --- a/scripts/test_rustc_tests.sh +++ b/scripts/test_rustc_tests.sh @@ -151,7 +151,6 @@ rm -r tests/run-make/short-ice # ICE backtrace begin/end marker mismatch rm -r tests/run-make/remap-path-prefix-dwarf # requires llvm-dwarfdump rm -r tests/run-make/strip # same rm -r tests/run-make-cargo/compiler-builtins # Expects lib/rustlib/src/rust to contains the standard library source -rm -r tests/run-make/translation # same rm -r tests/run-make-cargo/panic-immediate-abort-works # same rm -r tests/run-make-cargo/panic-immediate-abort-codegen # same rm -r tests/run-make/missing-unstable-trait-bound # This disables support for unstable features, but running cg_clif needs some unstable features From 8c93b88076d7f7c1957c75ba5916da98dce98078 Mon Sep 17 00:00:00 2001 From: Cathal Mullan Date: Sat, 28 Feb 2026 00:52:20 +0000 Subject: [PATCH 10/41] Extend x86 inline asm to support `ymm` and `zmm` vector registers --- example/std_example.rs | 72 ++++++++++++++++++++++++++++++++++++++++++ src/inline_asm.rs | 63 +++++++++++++++++++----------------- 2 files changed, 106 insertions(+), 29 deletions(-) diff --git a/example/std_example.rs b/example/std_example.rs index 33db75f0943a..408c9b3dad0f 100644 --- a/example/std_example.rs +++ b/example/std_example.rs @@ -9,6 +9,8 @@ )] #![allow(internal_features)] +#[cfg(target_arch = "x86_64")] +use std::arch::asm; #[cfg(target_arch = "x86_64")] use std::arch::x86_64::*; use std::hint::black_box; @@ -279,6 +281,17 @@ unsafe fn test_simd() { #[cfg(not(jit))] test_crc32(); + + #[cfg(not(jit))] + test_xmm_roundtrip(); + #[cfg(not(jit))] + if is_x86_feature_detected!("avx") { + test_ymm_roundtrip(); + } + #[cfg(not(jit))] + if is_x86_feature_detected!("avx512f") { + test_zmm_roundtrip(); + } } } @@ -576,6 +589,65 @@ unsafe fn test_mm_cvtps_ph() { assert_eq_m128i(r, e); } +#[cfg(target_arch = "x86_64")] +#[cfg(not(jit))] +unsafe fn test_xmm_roundtrip() { + unsafe { + let input = [1u8; 16]; + let mut output = [0u8; 16]; + + asm!( + "movups {xmm}, [{input}]", + "movups [{output}], {xmm}", + input = in(reg) input.as_ptr(), + output = in(reg) output.as_mut_ptr(), + xmm = out(xmm_reg) _, + ); + + assert_eq!(input, output); + } +} + +#[cfg(target_arch = "x86_64")] +#[target_feature(enable = "avx")] +#[cfg(not(jit))] +unsafe fn test_ymm_roundtrip() { + unsafe { + let input = [1u8; 32]; + let mut output = [0u8; 32]; + + asm!( + "vmovups {ymm}, [{input}]", + "vmovups [{output}], {ymm}", + input = in(reg) input.as_ptr(), + output = in(reg) output.as_mut_ptr(), + ymm = out(ymm_reg) _, + ); + + assert_eq!(input, output); + } +} + +#[cfg(target_arch = "x86_64")] +#[target_feature(enable = "avx512f")] +#[cfg(not(jit))] +unsafe fn test_zmm_roundtrip() { + unsafe { + let input = [1u8; 64]; + let mut output = [0u8; 64]; + + asm!( + "vmovups {zmm}, [{input}]", + "vmovups [{output}], {zmm}", + input = in(reg) input.as_ptr(), + output = in(reg) output.as_mut_ptr(), + zmm = out(zmm_reg) _, + ); + + assert_eq!(input, output); + } +} + fn test_checked_mul() { let u: Option = u8::from_str_radix("1000", 10).ok(); assert_eq!(u, None); diff --git a/src/inline_asm.rs b/src/inline_asm.rs index ac0da06cbb8e..8f1bb0b471e6 100644 --- a/src/inline_asm.rs +++ b/src/inline_asm.rs @@ -548,22 +548,21 @@ fn generate_asm_wrapper(&self, asm_name: &str) -> String { match self.arch { InlineAsmArch::X86_64 => match reg { InlineAsmReg::X86(reg) - if reg as u32 >= X86InlineAsmReg::xmm0 as u32 - && reg as u32 <= X86InlineAsmReg::xmm15 as u32 => + if matches!( + reg.reg_class(), + X86InlineAsmRegClass::xmm_reg + | X86InlineAsmRegClass::ymm_reg + | X86InlineAsmRegClass::zmm_reg + ) => { - // rustc emits x0 rather than xmm0 - let class = match *modifier { - None | Some('x') => "xmm", - Some('y') => "ymm", - Some('z') => "zmm", - _ => unreachable!(), - }; - write!( - generated_asm, - "{class}{}", - reg as u32 - X86InlineAsmReg::xmm0 as u32 - ) - .unwrap(); + // rustc emits x0/y0/z0 rather than xmm0/ymm0/zmm0 + let name = reg.name(); + if let Some(prefix) = modifier { + let index = &name[3..]; + write!(generated_asm, "{prefix}mm{index}").unwrap(); + } else { + write!(generated_asm, "{name}").unwrap(); + } } _ => reg .emit(&mut generated_asm, InlineAsmArch::X86_64, *modifier) @@ -716,12 +715,17 @@ fn save_register( InlineAsmArch::X86_64 => { match reg { InlineAsmReg::X86(reg) - if reg as u32 >= X86InlineAsmReg::xmm0 as u32 - && reg as u32 <= X86InlineAsmReg::xmm15 as u32 => + if matches!( + reg.reg_class(), + X86InlineAsmRegClass::xmm_reg + | X86InlineAsmRegClass::ymm_reg + | X86InlineAsmRegClass::zmm_reg + ) => { - // rustc emits x0 rather than xmm0 - write!(generated_asm, " movups [rbx+0x{:x}], ", offset.bytes()).unwrap(); - write!(generated_asm, "xmm{}", reg as u32 - X86InlineAsmReg::xmm0 as u32) + // rustc emits x0/y0/z0 rather than xmm0/ymm0/zmm0 + let name = reg.name(); + let mov = if name.starts_with("xmm") { "movups" } else { "vmovups" }; + write!(generated_asm, " {mov} [rbx+0x{:x}], {name}", offset.bytes()) .unwrap(); } _ => { @@ -761,16 +765,17 @@ fn restore_register( InlineAsmArch::X86_64 => { match reg { InlineAsmReg::X86(reg) - if reg as u32 >= X86InlineAsmReg::xmm0 as u32 - && reg as u32 <= X86InlineAsmReg::xmm15 as u32 => + if matches!( + reg.reg_class(), + X86InlineAsmRegClass::xmm_reg + | X86InlineAsmRegClass::ymm_reg + | X86InlineAsmRegClass::zmm_reg + ) => { - // rustc emits x0 rather than xmm0 - write!( - generated_asm, - " movups xmm{}", - reg as u32 - X86InlineAsmReg::xmm0 as u32 - ) - .unwrap(); + // rustc emits x0/y0/z0 rather than xmm0/ymm0/zmm0 + let name = reg.name(); + let mov = if name.starts_with("xmm") { "movups" } else { "vmovups" }; + write!(generated_asm, " {mov} {name}").unwrap(); } _ => { generated_asm.push_str(" mov "); From 022d6959d361a2cc6d5243307802d4f98ebf5780 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 27 Feb 2026 14:33:23 +0000 Subject: [PATCH 11/41] Use CompiledModules inside CodegenResults In preparation for fully replacing CodegenResults with CompiledModules. --- src/driver/aot.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/driver/aot.rs b/src/driver/aot.rs index fc5c634d9570..7a736de967d2 100644 --- a/src/driver/aot.rs +++ b/src/driver/aot.rs @@ -10,9 +10,9 @@ use cranelift_object::{ObjectBuilder, ObjectModule}; use rustc_codegen_ssa::assert_module_sources::CguReuse; -use rustc_codegen_ssa::back::write::{CompiledModules, produce_final_output_artifacts}; +use rustc_codegen_ssa::back::write::produce_final_output_artifacts; use rustc_codegen_ssa::base::determine_cgu_reuse; -use rustc_codegen_ssa::{CodegenResults, CompiledModule, CrateInfo, ModuleKind}; +use rustc_codegen_ssa::{CodegenResults, CompiledModule, CompiledModules, CrateInfo, ModuleKind}; use rustc_data_structures::profiling::SelfProfilerRef; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::{IntoDynSyncSend, par_map}; @@ -126,15 +126,7 @@ pub(crate) fn join( produce_final_output_artifacts(sess, &compiled_modules, outputs); - ( - CodegenResults { - crate_info: self.crate_info, - - modules: compiled_modules.modules, - allocator_module: compiled_modules.allocator_module, - }, - work_products, - ) + (CodegenResults { compiled_modules, crate_info: self.crate_info }, work_products) } } From 3047cffe9228d880b3720dd692d14730ff839d72 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Thu, 23 Oct 2025 15:33:06 +0000 Subject: [PATCH 12/41] Replace CodegenResults with CompiledModules This is already CodegenResults without CrateInfo. The driver can calculate the CrateInfo and pass it by-ref to the backend. Using CompiledModules makes it a bit easier to move some other things out of the backend as will be necessary for moving LTO to the link phase. --- src/driver/aot.rs | 15 +++------------ src/driver/jit.rs | 13 +++++++------ src/lib.rs | 17 +++++++++++++---- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/driver/aot.rs b/src/driver/aot.rs index 7a736de967d2..79a321456808 100644 --- a/src/driver/aot.rs +++ b/src/driver/aot.rs @@ -12,7 +12,7 @@ use rustc_codegen_ssa::assert_module_sources::CguReuse; use rustc_codegen_ssa::back::write::produce_final_output_artifacts; use rustc_codegen_ssa::base::determine_cgu_reuse; -use rustc_codegen_ssa::{CodegenResults, CompiledModule, CompiledModules, CrateInfo, ModuleKind}; +use rustc_codegen_ssa::{CompiledModule, CompiledModules, ModuleKind}; use rustc_data_structures::profiling::SelfProfilerRef; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::{IntoDynSyncSend, par_map}; @@ -54,7 +54,6 @@ fn hash_stable(&self, _: &mut HCX, _: &mut StableHasher) { pub(crate) struct OngoingCodegen { modules: Vec, allocator_module: Option, - crate_info: CrateInfo, concurrency_limiter: ConcurrencyLimiter, } @@ -63,7 +62,7 @@ pub(crate) fn join( self, sess: &Session, outputs: &OutputFilenames, - ) -> (CodegenResults, FxIndexMap) { + ) -> (CompiledModules, FxIndexMap) { let mut work_products = FxIndexMap::default(); let mut modules = vec![]; let disable_incr_cache = disable_incr_cache(); @@ -126,7 +125,7 @@ pub(crate) fn join( produce_final_output_artifacts(sess, &compiled_modules, outputs); - (CodegenResults { compiled_modules, crate_info: self.crate_info }, work_products) + (compiled_modules, work_products) } } @@ -475,13 +474,6 @@ fn emit_allocator_module(tcx: TyCtxt<'_>) -> Option { } pub(crate) fn run_aot(tcx: TyCtxt<'_>) -> Box { - // FIXME handle `-Ctarget-cpu=native` - let target_cpu = match tcx.sess.opts.cg.target_cpu { - Some(ref name) => name, - None => tcx.sess.target.cpu.as_ref(), - } - .to_owned(); - let cgus = tcx.collect_and_partition_mono_items(()).codegen_units; if tcx.dep_graph.is_fully_enabled() { @@ -541,7 +533,6 @@ pub(crate) fn run_aot(tcx: TyCtxt<'_>) -> Box { Box::new(OngoingCodegen { modules, allocator_module, - crate_info: CrateInfo::new(tcx, target_cpu), concurrency_limiter: concurrency_limiter.0, }) } diff --git a/src/driver/jit.rs b/src/driver/jit.rs index 3a8ca25a5fc0..9bbc338a8e07 100644 --- a/src/driver/jit.rs +++ b/src/driver/jit.rs @@ -16,13 +16,14 @@ use crate::prelude::*; use crate::unwind_module::UnwindModule; -fn create_jit_module(tcx: TyCtxt<'_>) -> (UnwindModule, Option) { - let crate_info = CrateInfo::new(tcx, "dummy_target_cpu".to_string()); - +fn create_jit_module( + tcx: TyCtxt<'_>, + crate_info: &CrateInfo, +) -> (UnwindModule, Option) { let isa = crate::build_isa(tcx.sess, true); let mut jit_builder = JITBuilder::with_isa(isa, cranelift_module::default_libcall_names()); crate::compiler_builtins::register_functions_for_jit(&mut jit_builder); - jit_builder.symbol_lookup_fn(dep_symbol_lookup_fn(tcx.sess, crate_info)); + jit_builder.symbol_lookup_fn(dep_symbol_lookup_fn(tcx.sess, crate_info.clone())); let mut jit_module = UnwindModule::new(JITModule::new(jit_builder), false); let cx = DebugContext::new(tcx, jit_module.isa(), false, "dummy_cgu_name"); @@ -32,14 +33,14 @@ fn create_jit_module(tcx: TyCtxt<'_>) -> (UnwindModule, Option, jit_args: Vec) -> ! { +pub(crate) fn run_jit(tcx: TyCtxt<'_>, crate_info: &CrateInfo, jit_args: Vec) -> ! { if !tcx.crate_types().contains(&rustc_session::config::CrateType::Executable) { tcx.dcx().fatal("can't jit non-executable crate"); } let output_filenames = tcx.output_filenames(()); let should_write_ir = crate::pretty_clif::should_write_ir(tcx.sess); - let (mut jit_module, mut debug_context) = create_jit_module(tcx); + let (mut jit_module, mut debug_context) = create_jit_module(tcx, crate_info); let mut cached_context = Context::new(); let cgus = tcx.collect_and_partition_mono_items(()).codegen_units; diff --git a/src/lib.rs b/src/lib.rs index 7bab07def63d..82c2e91b4b0f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -40,7 +40,7 @@ use cranelift_codegen::isa::TargetIsa; use cranelift_codegen::settings::{self, Configurable}; use rustc_codegen_ssa::traits::CodegenBackend; -use rustc_codegen_ssa::{CodegenResults, TargetConfig}; +use rustc_codegen_ssa::{CompiledModules, CrateInfo, TargetConfig}; use rustc_log::tracing::info; use rustc_middle::dep_graph::{WorkProduct, WorkProductId}; use rustc_session::Session; @@ -200,12 +200,21 @@ fn print_version(&self) { println!("Cranelift version: {}", cranelift_codegen::VERSION); } - fn codegen_crate(&self, tcx: TyCtxt<'_>) -> Box { + fn target_cpu(&self, sess: &Session) -> String { + // FIXME handle `-Ctarget-cpu=native` + match sess.opts.cg.target_cpu { + Some(ref name) => name, + None => sess.target.cpu.as_ref(), + } + .to_owned() + } + + fn codegen_crate(&self, tcx: TyCtxt<'_>, _crate_info: &CrateInfo) -> Box { info!("codegen crate {}", tcx.crate_name(LOCAL_CRATE)); let config = self.config.get().unwrap(); if config.jit_mode { #[cfg(feature = "jit")] - driver::jit::run_jit(tcx, config.jit_args.clone()); + driver::jit::run_jit(tcx, _crate_info, config.jit_args.clone()); #[cfg(not(feature = "jit"))] tcx.dcx().fatal("jit support was disabled when compiling rustc_codegen_cranelift"); @@ -219,7 +228,7 @@ fn join_codegen( ongoing_codegen: Box, sess: &Session, outputs: &OutputFilenames, - ) -> (CodegenResults, FxIndexMap) { + ) -> (CompiledModules, FxIndexMap) { ongoing_codegen.downcast::().unwrap().join(sess, outputs) } } From cf6e7bcf5946bdae784a47aebed56083c97caa6a Mon Sep 17 00:00:00 2001 From: Cathal Mullan Date: Mon, 2 Mar 2026 20:32:29 +0000 Subject: [PATCH 13/41] Add leading underscore to asm symbols on Mach-O --- src/global_asm.rs | 16 ++++++++++++++-- src/inline_asm.rs | 8 +++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/global_asm.rs b/src/global_asm.rs index 1daf428acf76..b14988577845 100644 --- a/src/global_asm.rs +++ b/src/global_asm.rs @@ -120,9 +120,15 @@ fn codegen_global_asm_inner<'tcx>( } let symbol = tcx.symbol_name(instance); + let symbol_name = if tcx.sess.target.is_like_darwin { + format!("_{}", symbol.name) + } else { + symbol.name.to_owned() + }; + // FIXME handle the case where the function was made private to the // current codegen unit - global_asm.push_str(&escape_symbol_name(tcx, symbol.name, span)); + global_asm.push_str(&escape_symbol_name(tcx, &symbol_name, span)); } GlobalAsmOperandRef::SymStatic { def_id } => { if cfg!(not(feature = "inline_asm_sym")) { @@ -134,7 +140,13 @@ fn codegen_global_asm_inner<'tcx>( let instance = Instance::mono(tcx, def_id); let symbol = tcx.symbol_name(instance); - global_asm.push_str(&escape_symbol_name(tcx, symbol.name, span)); + let symbol_name = if tcx.sess.target.is_like_darwin { + format!("_{}", symbol.name) + } else { + symbol.name.to_owned() + }; + + global_asm.push_str(&escape_symbol_name(tcx, &symbol_name, span)); } } } diff --git a/src/inline_asm.rs b/src/inline_asm.rs index 8f1bb0b471e6..044243f2c716 100644 --- a/src/inline_asm.rs +++ b/src/inline_asm.rs @@ -574,7 +574,13 @@ fn generate_asm_wrapper(&self, asm_name: &str) -> String { CInlineAsmOperand::Const { ref value } => { generated_asm.push_str(value); } - CInlineAsmOperand::Symbol { ref symbol } => generated_asm.push_str(symbol), + CInlineAsmOperand::Symbol { ref symbol } => { + if binary_format == BinaryFormat::Macho { + generated_asm.push('_'); + } + + generated_asm.push_str(symbol); + } } } } From bf69dfa024c670e0f8f6d38dd1cde385959117c9 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Wed, 4 Mar 2026 10:51:22 +0000 Subject: [PATCH 14/41] Rustup to rustc 1.96.0-nightly (d9563937f 2026-03-03) --- patches/0027-stdlib-128bit-atomic-operations.patch | 13 +------------ rust-toolchain.toml | 2 +- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/patches/0027-stdlib-128bit-atomic-operations.patch b/patches/0027-stdlib-128bit-atomic-operations.patch index 38bb43f8204b..b7276e43153b 100644 --- a/patches/0027-stdlib-128bit-atomic-operations.patch +++ b/patches/0027-stdlib-128bit-atomic-operations.patch @@ -37,16 +37,7 @@ diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs index bf2b6d59f88..d5ccce03bbf 100644 --- a/library/core/src/sync/atomic.rs +++ b/library/core/src/sync/atomic.rs -@@ -300,8 +300,6 @@ impl_atomic_primitive!(AtomicI32(i32), size("32"), align(4)); - impl_atomic_primitive!(AtomicU32(u32), size("32"), align(4)); - impl_atomic_primitive!(AtomicI64(i64), size("64"), align(8)); - impl_atomic_primitive!(AtomicU64(u64), size("64"), align(8)); --impl_atomic_primitive!(AtomicI128(i128), size("128"), align(16)); --impl_atomic_primitive!(AtomicU128(u128), size("128"), align(16)); - - #[cfg(target_pointer_width = "16")] - impl_atomic_primitive!(AtomicIsize(isize), size("ptr"), align(2)); -@@ -3585,44 +3585,6 @@ pub const fn as_ptr(&self) -> *mut $int_type { +@@ -3585,42 +3585,6 @@ pub const fn as_ptr(&self) -> *mut $int_type { 8, u64 AtomicU64 } @@ -62,7 +53,6 @@ index bf2b6d59f88..d5ccce03bbf 100644 - unstable(feature = "integer_atomics", issue = "99069"), - rustc_const_unstable(feature = "integer_atomics", issue = "99069"), - rustc_const_unstable(feature = "integer_atomics", issue = "99069"), -- rustc_diagnostic_item = "AtomicI128", - "i128", - "#![feature(integer_atomics)]\n\n", - atomic_min, atomic_max, @@ -81,7 +71,6 @@ index bf2b6d59f88..d5ccce03bbf 100644 - unstable(feature = "integer_atomics", issue = "99069"), - rustc_const_unstable(feature = "integer_atomics", issue = "99069"), - rustc_const_unstable(feature = "integer_atomics", issue = "99069"), -- rustc_diagnostic_item = "AtomicU128", - "u128", - "#![feature(integer_atomics)]\n\n", - atomic_umin, atomic_umax, diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 85b1cf4d6117..44ae84d9ac69 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2026-02-24" +channel = "nightly-2026-03-04" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt"] profile = "minimal" From 5701d13840031ed3061281e43794f631f41a44a6 Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Thu, 19 Feb 2026 18:42:24 +0100 Subject: [PATCH 15/41] refactor `PointeeInfo` Make `size`/`align` always correct rather than conditionally on the `safe` field. This makes it less error prone and easier to work with for `MaybeDangling` / potential future pointer kinds like `Aligned<_>`. --- src/base.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/base.rs b/src/base.rs index e4865ece63b6..4f483cdc5d6c 100644 --- a/src/base.rs +++ b/src/base.rs @@ -10,7 +10,7 @@ use rustc_index::IndexVec; use rustc_middle::ty::TypeVisitableExt; use rustc_middle::ty::adjustment::PointerCoercion; -use rustc_middle::ty::layout::FnAbiOf; +use rustc_middle::ty::layout::{FnAbiOf, HasTypingEnv as _}; use rustc_middle::ty::print::with_no_trimmed_paths; use rustc_session::config::OutputFilenames; use rustc_span::Symbol; @@ -924,19 +924,26 @@ fn is_wide_ptr<'tcx>(fx: &FunctionCx<'_, '_, 'tcx>, ty: Ty<'tcx>) -> bool { count, }) => { let dst = codegen_operand(fx, dst); - let pointee = dst - .layout() - .pointee_info_at(fx, rustc_abi::Size::ZERO) - .expect("Expected pointer"); + + let &ty::RawPtr(pointee, _) = dst.layout().ty.kind() else { + bug!("expected pointer") + }; + let pointee_layout = fx + .tcx + .layout_of(fx.typing_env().as_query_input(pointee)) + .expect("expected pointee to have a layout"); + let elem_size: u64 = pointee_layout.layout.size().bytes(); + let dst = dst.load_scalar(fx); let src = codegen_operand(fx, src).load_scalar(fx); let count = codegen_operand(fx, count).load_scalar(fx); - let elem_size: u64 = pointee.size.bytes(); + let bytes = if elem_size != 1 { fx.bcx.ins().imul_imm(count, elem_size as i64) } else { count }; + fx.bcx.call_memcpy(fx.target_config, dst, src, bytes); } }, From 263613601f446208ad59c6c8ae0644b64b6638a6 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 6 Mar 2026 10:12:51 +0000 Subject: [PATCH 16/41] Rustup to rustc 1.96.0-nightly (69370dc4a 2026-03-05) --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 44ae84d9ac69..bc909ed97551 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2026-03-04" +channel = "nightly-2026-03-06" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt"] profile = "minimal" From 7cbc71ed38ad63051e14b01b10959cd954b00955 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 6 Mar 2026 11:32:31 +0100 Subject: [PATCH 17/41] libcore float tests: replace macro shadowing by const-compatible macro --- .../0029-sysroot_tests-disable-f16-math.patch | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/patches/0029-sysroot_tests-disable-f16-math.patch b/patches/0029-sysroot_tests-disable-f16-math.patch index 6a0244cfde3f..340f6cc9b0e7 100644 --- a/patches/0029-sysroot_tests-disable-f16-math.patch +++ b/patches/0029-sysroot_tests-disable-f16-math.patch @@ -19,7 +19,7 @@ index c61961f8584..d7b4fa20322 100644 + f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) f128: #[cfg(all(not(miri), target_has_reliable_f128_math))], }, - test { + test { @@ -1557,7 +1557,7 @@ fn s_nan() -> Float { name: exp, attrs: { @@ -28,7 +28,7 @@ index c61961f8584..d7b4fa20322 100644 + f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) f128: #[cfg(all(not(miri), target_has_reliable_f128_math))], }, - test { + test { @@ -1578,7 +1578,7 @@ fn s_nan() -> Float { name: exp2, attrs: { @@ -37,7 +37,7 @@ index c61961f8584..d7b4fa20322 100644 + f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) f128: #[cfg(all(not(miri), target_has_reliable_f128_math))], }, - test { + test { @@ -1598,7 +1598,7 @@ fn s_nan() -> Float { name: ln, attrs: { @@ -46,7 +46,7 @@ index c61961f8584..d7b4fa20322 100644 + f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) f128: #[cfg(all(not(miri), target_has_reliable_f128_math))], }, - test { + test { @@ -1620,7 +1620,7 @@ fn s_nan() -> Float { name: log, attrs: { @@ -55,7 +55,7 @@ index c61961f8584..d7b4fa20322 100644 + f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) f128: #[cfg(all(not(miri), target_has_reliable_f128_math))], }, - test { + test { @@ -1645,7 +1645,7 @@ fn s_nan() -> Float { name: log2, attrs: { @@ -64,7 +64,7 @@ index c61961f8584..d7b4fa20322 100644 + f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) f128: #[cfg(all(not(miri), target_has_reliable_f128_math))], }, - test { + test { @@ -1668,7 +1668,7 @@ fn s_nan() -> Float { name: log10, attrs: { @@ -73,7 +73,7 @@ index c61961f8584..d7b4fa20322 100644 + f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) f128: #[cfg(all(not(miri), target_has_reliable_f128_math))], }, - test { + test { @@ -1692,7 +1692,7 @@ fn s_nan() -> Float { name: asinh, attrs: { @@ -82,7 +82,7 @@ index c61961f8584..d7b4fa20322 100644 + f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) f128: #[cfg(all(not(miri), target_has_reliable_f128_math))], }, - test { + test { @@ -1725,7 +1725,7 @@ fn s_nan() -> Float { name: acosh, attrs: { @@ -91,7 +91,7 @@ index c61961f8584..d7b4fa20322 100644 + f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) f128: #[cfg(all(not(miri), target_has_reliable_f128_math))], }, - test { + test { @@ -1753,7 +1753,7 @@ fn s_nan() -> Float { name: atanh, attrs: { @@ -100,7 +100,7 @@ index c61961f8584..d7b4fa20322 100644 + f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) f128: #[cfg(all(not(miri), target_has_reliable_f128_math))], }, - test { + test { @@ -1779,7 +1779,7 @@ fn s_nan() -> Float { name: gamma, attrs: { @@ -109,7 +109,7 @@ index c61961f8584..d7b4fa20322 100644 + f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) f128: #[cfg(all(not(miri), target_has_reliable_f128_math))], }, - test { + test { @@ -1814,7 +1814,7 @@ fn s_nan() -> Float { name: ln_gamma, attrs: { @@ -118,7 +118,7 @@ index c61961f8584..d7b4fa20322 100644 + f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) f128: #[cfg(all(not(miri), target_has_reliable_f128_math))], }, - test { + test { @@ -2027,7 +2027,7 @@ fn s_nan() -> Float { attrs: { // FIXME(f16_f128): add math tests when available @@ -127,7 +127,7 @@ index c61961f8584..d7b4fa20322 100644 + f16: #[cfg(false)], // FIXME(rust-lang/rustc_codegen_cranelift#1622) f128: #[cfg(all(not(miri), target_has_reliable_f128_math))], }, - test { + test { -- 2.50.1 From e316da9660a6a2d28fc0d93a915056705becf5de Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 6 Mar 2026 14:16:48 +0000 Subject: [PATCH 18/41] Fix unused feature warning --- example/std_example.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/example/std_example.rs b/example/std_example.rs index 408c9b3dad0f..5fef141a3953 100644 --- a/example/std_example.rs +++ b/example/std_example.rs @@ -1,7 +1,6 @@ #![feature( core_intrinsics, coroutines, - stmt_expr_attributes, coroutine_trait, repr_simd, tuple_trait, From 2d2c5521a2e2c592e587657dbe6277f19b56042d Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 6 Mar 2026 15:07:59 +0000 Subject: [PATCH 19/41] Fix another unused feature warning --- example/neon.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/neon.rs b/example/neon.rs index fb3e10a41c02..98a2a7af38f6 100644 --- a/example/neon.rs +++ b/example/neon.rs @@ -1,6 +1,6 @@ // Most of these tests are copied from https://github.com/japaric/stdsimd/blob/0f4413d01c4f0c3ffbc5a69e9a37fbc7235b31a9/coresimd/arm/neon.rs -#![feature(portable_simd)] +#![cfg_attr(target_arch = "aarch64", feature(portable_simd))] #[cfg(target_arch = "aarch64")] use std::arch::aarch64::*; From c465c7571a9c83cdb98dbb6311a6774accc8c14a Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 6 Mar 2026 21:47:56 +0000 Subject: [PATCH 20/41] Another unused feature fix --- example/mini_core.rs | 4 ++-- example/mini_core_hello_world.rs | 3 ++- example/std_example.rs | 9 +-------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/example/mini_core.rs b/example/mini_core.rs index 8a4e3ade667b..5792b85a6245 100644 --- a/example/mini_core.rs +++ b/example/mini_core.rs @@ -8,9 +8,9 @@ rustc_attrs, transparent_unions, auto_traits, - freeze_impls, - thread_local + freeze_impls )] +#![cfg_attr(not(all(windows, target_env = "gnu")), thread_local)] #![no_core] #![allow(dead_code, internal_features, ambiguous_wide_pointer_comparisons)] diff --git a/example/mini_core_hello_world.rs b/example/mini_core_hello_world.rs index c971a7df34b0..182cc3d0e5fa 100644 --- a/example/mini_core_hello_world.rs +++ b/example/mini_core_hello_world.rs @@ -1,4 +1,5 @@ -#![feature(no_core, lang_items, never_type, linkage, extern_types, thread_local, repr_simd)] +#![feature(no_core, lang_items, never_type, extern_types, thread_local, repr_simd)] +#![cfg_attr(not(any(jit, target_vendor = "apple", windows)), feature(linkage))] #![no_core] #![allow(dead_code, non_camel_case_types, internal_features)] diff --git a/example/std_example.rs b/example/std_example.rs index 5fef141a3953..360fb76a6224 100644 --- a/example/std_example.rs +++ b/example/std_example.rs @@ -1,11 +1,4 @@ -#![feature( - core_intrinsics, - coroutines, - coroutine_trait, - repr_simd, - tuple_trait, - unboxed_closures -)] +#![feature(core_intrinsics, coroutines, coroutine_trait, repr_simd, tuple_trait, unboxed_closures)] #![allow(internal_features)] #[cfg(target_arch = "x86_64")] From c4a8355c968464922175bdf3da00a01d93e2ddb1 Mon Sep 17 00:00:00 2001 From: Redddy Date: Fri, 27 Feb 2026 03:48:05 +0000 Subject: [PATCH 21/41] Change TODO in compiler to FIXME --- scripts/test_rustc_tests.sh | 2 +- src/intrinsics/mod.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/test_rustc_tests.sh b/scripts/test_rustc_tests.sh index 4cad18f2a94f..8712b41c8f8f 100755 --- a/scripts/test_rustc_tests.sh +++ b/scripts/test_rustc_tests.sh @@ -175,7 +175,7 @@ rm -r tests/run-make/panic-abort-eh_frame # .eh_frame emitted with panic=abort # bugs in the test suite # ====================== -rm tests/ui/process/nofile-limit.rs # TODO some AArch64 linking issue +rm tests/ui/process/nofile-limit.rs # FIXME some AArch64 linking issue rm -r tests/ui/codegen/equal-pointers-unequal # make incorrect assumptions about the location of stack variables rm -r tests/incremental/extern_static/issue-49153.rs # assumes reference to undefined static gets optimized away diff --git a/src/intrinsics/mod.rs b/src/intrinsics/mod.rs index ab9a11305baa..c21453d84be0 100644 --- a/src/intrinsics/mod.rs +++ b/src/intrinsics/mod.rs @@ -356,10 +356,10 @@ fn codegen_float_intrinsic_call<'tcx>( sym::fmaf64 => ("fma", 3, fx.tcx.types.f64, types::F64), sym::fmaf128 => ("fmaf128", 3, fx.tcx.types.f128, types::F128), // FIXME: calling `fma` from libc without FMA target feature uses expensive sofware emulation - sym::fmuladdf16 => ("fmaf16", 3, fx.tcx.types.f16, types::F16), // TODO: use cranelift intrinsic analogous to llvm.fmuladd.f16 - sym::fmuladdf32 => ("fmaf", 3, fx.tcx.types.f32, types::F32), // TODO: use cranelift intrinsic analogous to llvm.fmuladd.f32 - sym::fmuladdf64 => ("fma", 3, fx.tcx.types.f64, types::F64), // TODO: use cranelift intrinsic analogous to llvm.fmuladd.f64 - sym::fmuladdf128 => ("fmaf128", 3, fx.tcx.types.f128, types::F128), // TODO: use cranelift intrinsic analogous to llvm.fmuladd.f128 + sym::fmuladdf16 => ("fmaf16", 3, fx.tcx.types.f16, types::F16), // FIXME: use cranelift intrinsic analogous to llvm.fmuladd.f16 + sym::fmuladdf32 => ("fmaf", 3, fx.tcx.types.f32, types::F32), // FIXME: use cranelift intrinsic analogous to llvm.fmuladd.f32 + sym::fmuladdf64 => ("fma", 3, fx.tcx.types.f64, types::F64), // FIXME: use cranelift intrinsic analogous to llvm.fmuladd.f64 + sym::fmuladdf128 => ("fmaf128", 3, fx.tcx.types.f128, types::F128), // FIXME: use cranelift intrinsic analogous to llvm.fmuladd.f128 sym::copysignf16 => ("copysignf16", 2, fx.tcx.types.f16, types::F16), sym::copysignf32 => ("copysignf", 2, fx.tcx.types.f32, types::F32), sym::copysignf64 => ("copysign", 2, fx.tcx.types.f64, types::F64), From 8fc7440ceca81538e9ff23b17cb01da01e440db4 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 10 Mar 2026 16:04:12 +0000 Subject: [PATCH 22/41] Fix --- example/mini_core.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/mini_core.rs b/example/mini_core.rs index 5792b85a6245..8f4d0cd217dc 100644 --- a/example/mini_core.rs +++ b/example/mini_core.rs @@ -10,7 +10,7 @@ auto_traits, freeze_impls )] -#![cfg_attr(not(all(windows, target_env = "gnu")), thread_local)] +#![cfg_attr(not(all(windows, target_env = "gnu")), feature(thread_local))] #![no_core] #![allow(dead_code, internal_features, ambiguous_wide_pointer_comparisons)] From f441cc675bfa7bc98630a21f8f9b3a63d2e19c20 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 10 Mar 2026 16:12:05 +1100 Subject: [PATCH 23/41] Move `Spanned`. It's defined in `rustc_span::source_map` which doesn't make any sense because it has nothing to do with source maps. This commit moves it to the crate root, a more sensible spot for something this basic. --- src/abi/mod.rs | 2 +- src/common.rs | 3 +-- src/intrinsics/mod.rs | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/abi/mod.rs b/src/abi/mod.rs index 97a19b8976d3..13f5ad5157ce 100644 --- a/src/abi/mod.rs +++ b/src/abi/mod.rs @@ -20,7 +20,7 @@ use rustc_middle::ty::layout::FnAbiOf; use rustc_middle::ty::print::with_no_trimmed_paths; use rustc_session::Session; -use rustc_span::source_map::Spanned; +use rustc_span::Spanned; use rustc_target::callconv::{FnAbi, PassMode}; use rustc_target::spec::Arch; use smallvec::{SmallVec, smallvec}; diff --git a/src/common.rs b/src/common.rs index b11f42408f58..b22afca847aa 100644 --- a/src/common.rs +++ b/src/common.rs @@ -6,8 +6,7 @@ use rustc_middle::ty::layout::{ self, FnAbiError, FnAbiOfHelpers, FnAbiRequest, LayoutError, LayoutOfHelpers, }; -use rustc_span::Symbol; -use rustc_span::source_map::Spanned; +use rustc_span::{Spanned, Symbol}; use rustc_target::callconv::FnAbi; use rustc_target::spec::{Arch, HasTargetSpec, Target}; diff --git a/src/intrinsics/mod.rs b/src/intrinsics/mod.rs index ab9a11305baa..da8569dac746 100644 --- a/src/intrinsics/mod.rs +++ b/src/intrinsics/mod.rs @@ -24,8 +24,7 @@ macro_rules! intrinsic_args { use rustc_middle::ty::GenericArgsRef; use rustc_middle::ty::layout::ValidityRequirement; use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths}; -use rustc_span::source_map::Spanned; -use rustc_span::{Symbol, sym}; +use rustc_span::{Spanned, Symbol, sym}; use rustc_target::spec::PanicStrategy; pub(crate) use self::llvm::codegen_llvm_intrinsic_call; From 5f3d696d9d2a3f31777b0ee876781dd1522d5017 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Wed, 11 Mar 2026 12:41:29 +0000 Subject: [PATCH 24/41] Rustup to rustc 1.96.0-nightly (2d76d9bc7 2026-03-09) --- ...sroot_tests-Add-missing-feature-gate.patch | 37 +++++++++++++++++++ rust-toolchain.toml | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 patches/0030-sysroot_tests-Add-missing-feature-gate.patch diff --git a/patches/0030-sysroot_tests-Add-missing-feature-gate.patch b/patches/0030-sysroot_tests-Add-missing-feature-gate.patch new file mode 100644 index 000000000000..f2985f4f83d9 --- /dev/null +++ b/patches/0030-sysroot_tests-Add-missing-feature-gate.patch @@ -0,0 +1,37 @@ +From baa9c656ba61633f2e5785fc47bc8f88ed2f738e Mon Sep 17 00:00:00 2001 +From: bjorn3 <17426603+bjorn3@users.noreply.github.com> +Date: Wed, 11 Mar 2026 12:34:47 +0000 +Subject: [PATCH] Add missing feature gate + +--- + coretests/benches/lib.rs | 1 + + coretests/tests/lib.rs | 1 + + 2 file changed, 2 insertion(+) + +diff --git a/coretests/benches/lib.rs b/coretests/benches/lib.rs +index 150b9b3..281aa75 100644 +--- a/coretests/benches/lib.rs ++++ b/coretests/benches/lib.rs +@@ -8,6 +8,7 @@ + #![feature(iter_array_chunks)] + #![feature(iter_next_chunk)] + #![feature(iter_advance_by)] ++#![feature(num_internals)] + #![feature(uint_gather_scatter_bits)] + + extern crate test; +diff --git a/coretests/tests/lib.rs b/coretests/tests/lib.rs +index ecdb687..ab2cf77 100644 +--- a/coretests/tests/lib.rs ++++ b/coretests/tests/lib.rs +@@ -88,6 +88,7 @@ + #![feature(non_exhaustive_omitted_patterns_lint)] + #![feature(nonzero_from_str_radix)] + #![feature(numfmt)] ++#![feature(num_internals)] + #![feature(one_sided_range)] + #![feature(panic_internals)] + #![feature(pattern)] +-- +2.43.0 + diff --git a/rust-toolchain.toml b/rust-toolchain.toml index bc909ed97551..6789958e3722 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2026-03-06" +channel = "nightly-2026-03-10" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt"] profile = "minimal" From 5030e8119f40ea31e1f2c78719baf39b02d3dd76 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 3 Mar 2026 12:35:41 +0100 Subject: [PATCH 25/41] rename min/maxnum intrinsics to min/maximum_number and fix their LLVM lowering --- src/intrinsics/mod.rs | 16 ++++++++-------- src/num.rs | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/intrinsics/mod.rs b/src/intrinsics/mod.rs index da8569dac746..063bc5db959c 100644 --- a/src/intrinsics/mod.rs +++ b/src/intrinsics/mod.rs @@ -1266,7 +1266,7 @@ fn codegen_regular_intrinsic_call<'tcx>( ret.write_cvalue(fx, val); } - sym::minnumf16 => { + sym::minimum_number_nsz_f16 => { intrinsic_args!(fx, args => (a, b); intrinsic); let a = a.load_scalar(fx); let b = b.load_scalar(fx); @@ -1275,7 +1275,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let val = CValue::by_val(val, fx.layout_of(fx.tcx.types.f16)); ret.write_cvalue(fx, val); } - sym::minnumf32 => { + sym::minimum_number_nsz_f32 => { intrinsic_args!(fx, args => (a, b); intrinsic); let a = a.load_scalar(fx); let b = b.load_scalar(fx); @@ -1284,7 +1284,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let val = CValue::by_val(val, fx.layout_of(fx.tcx.types.f32)); ret.write_cvalue(fx, val); } - sym::minnumf64 => { + sym::minimum_number_nsz_f64 => { intrinsic_args!(fx, args => (a, b); intrinsic); let a = a.load_scalar(fx); let b = b.load_scalar(fx); @@ -1293,7 +1293,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let val = CValue::by_val(val, fx.layout_of(fx.tcx.types.f64)); ret.write_cvalue(fx, val); } - sym::minnumf128 => { + sym::minimum_number_nsz_f128 => { intrinsic_args!(fx, args => (a, b); intrinsic); let a = a.load_scalar(fx); let b = b.load_scalar(fx); @@ -1302,7 +1302,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let val = CValue::by_val(val, fx.layout_of(fx.tcx.types.f128)); ret.write_cvalue(fx, val); } - sym::maxnumf16 => { + sym::maximum_number_nsz_f16 => { intrinsic_args!(fx, args => (a, b); intrinsic); let a = a.load_scalar(fx); let b = b.load_scalar(fx); @@ -1311,7 +1311,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let val = CValue::by_val(val, fx.layout_of(fx.tcx.types.f16)); ret.write_cvalue(fx, val); } - sym::maxnumf32 => { + sym::maximum_number_nsz_f32 => { intrinsic_args!(fx, args => (a, b); intrinsic); let a = a.load_scalar(fx); let b = b.load_scalar(fx); @@ -1320,7 +1320,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let val = CValue::by_val(val, fx.layout_of(fx.tcx.types.f32)); ret.write_cvalue(fx, val); } - sym::maxnumf64 => { + sym::maximum_number_nsz_f64 => { intrinsic_args!(fx, args => (a, b); intrinsic); let a = a.load_scalar(fx); let b = b.load_scalar(fx); @@ -1329,7 +1329,7 @@ fn codegen_regular_intrinsic_call<'tcx>( let val = CValue::by_val(val, fx.layout_of(fx.tcx.types.f64)); ret.write_cvalue(fx, val); } - sym::maxnumf128 => { + sym::maximum_number_nsz_f128 => { intrinsic_args!(fx, args => (a, b); intrinsic); let a = a.load_scalar(fx); let b = b.load_scalar(fx); diff --git a/src/num.rs b/src/num.rs index 95d44dfb6d95..0459644e16aa 100644 --- a/src/num.rs +++ b/src/num.rs @@ -498,10 +498,10 @@ fn codegen_ptr_binop<'tcx>( } } -// In Rust floating point min and max don't propagate NaN. In Cranelift they do however. -// For this reason it is necessary to use `a.is_nan() ? b : (a >= b ? b : a)` for `minnumf*` -// and `a.is_nan() ? b : (a <= b ? b : a)` for `maxnumf*`. NaN checks are done by comparing -// a float against itself. Only in case of NaN is it not equal to itself. +// In Rust floating point min and max don't propagate NaN (not even SNaN). In Cranelift they do +// however. For this reason it is necessary to use `a.is_nan() ? b : (a >= b ? b : a)` for +// `minnumf*` and `a.is_nan() ? b : (a <= b ? b : a)` for `maxnumf*`. NaN checks are done by +// comparing a float against itself. Only in case of NaN is it not equal to itself. pub(crate) fn codegen_float_min(fx: &mut FunctionCx<'_, '_, '_>, a: Value, b: Value) -> Value { // FIXME(bytecodealliance/wasmtime#8312): Replace with Cranelift `fcmp` once // `f16`/`f128` backend lowerings have been added to Cranelift. From 0b5b096ce8c235fb028666378e9ea8411261c552 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 16 Mar 2026 16:32:39 +0000 Subject: [PATCH 26/41] Update to Cranelift 0.129 --- Cargo.lock | 124 +++++++++++++++++++++++++++++------------------------ Cargo.toml | 26 +++++------ 2 files changed, 81 insertions(+), 69 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index afc1d0d0ab95..2ceca336f094 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,42 +43,45 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "cranelift-assembler-x64" -version = "0.128.3" +version = "0.129.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0377b13bf002a0774fcccac4f1102a10f04893d24060cf4b7350c87e4cbb647c" +checksum = "40630d663279bc855bff805d6f5e8a0b6a1867f9df95b010511ac6dc894e9395" dependencies = [ "cranelift-assembler-x64-meta", ] [[package]] name = "cranelift-assembler-x64-meta" -version = "0.128.3" +version = "0.129.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfa027979140d023b25bf7509fb7ede3a54c3d3871fb5ead4673c4b633f671a2" +checksum = "3ee6aec5ceb55e5fdbcf7ef677d7c7195531360ff181ce39b2b31df11d57305f" dependencies = [ "cranelift-srcgen", ] [[package]] name = "cranelift-bforest" -version = "0.128.3" +version = "0.129.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "618e4da87d9179a70b3c2f664451ca8898987aa6eb9f487d16988588b5d8cc40" +checksum = "9a92d78cc3f087d7e7073828f08d98c7074a3a062b6b29a1b7783ce74305685e" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-bitset" -version = "0.128.3" +version = "0.129.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db53764b5dad233b37b8f5dc54d3caa9900c54579195e00f17ea21f03f71aaa7" +checksum = "edcc73d756f2e0d7eda6144fe64a2bc69c624de893cb1be51f1442aed77881d2" +dependencies = [ + "wasmtime-internal-core", +] [[package]] name = "cranelift-codegen" -version = "0.128.3" +version = "0.129.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae927f1d8c0abddaa863acd201471d56e7fc6c3925104f4861ed4dc3e28b421" +checksum = "683d94c2cd0d73b41369b88da1129589bc3a2d99cf49979af1d14751f35b7a1b" dependencies = [ "bumpalo", "cranelift-assembler-x64", @@ -90,21 +93,22 @@ dependencies = [ "cranelift-entity", "cranelift-isle", "gimli", - "hashbrown", + "hashbrown 0.15.5", + "libm", "log", "regalloc2", "rustc-hash", "serde", "smallvec", "target-lexicon", - "wasmtime-internal-math", + "wasmtime-internal-core", ] [[package]] name = "cranelift-codegen-meta" -version = "0.128.3" +version = "0.129.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fcf1e3e6757834bd2584f4cbff023fcc198e9279dcb5d684b4bb27a9b19f54" +checksum = "235da0e52ee3a0052d0e944c3470ff025b1f4234f6ec4089d3109f2d2ffa6cbd" dependencies = [ "cranelift-assembler-x64-meta", "cranelift-codegen-shared", @@ -114,33 +118,34 @@ dependencies = [ [[package]] name = "cranelift-codegen-shared" -version = "0.128.3" +version = "0.129.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "205dcb9e6ccf9d368b7466be675ff6ee54a63e36da6fe20e72d45169cf6fd254" +checksum = "20c07c6c440bd1bf920ff7597a1e743ede1f68dcd400730bd6d389effa7662af" [[package]] name = "cranelift-control" -version = "0.128.3" +version = "0.129.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "108eca9fcfe86026054f931eceaf57b722c1b97464bf8265323a9b5877238817" +checksum = "8797c022e02521901e1aee483dea3ed3c67f2bf0a26405c9dd48e8ee7a70944b" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.128.3" +version = "0.129.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0d96496910065d3165f84ff8e1e393916f4c086f88ac8e1b407678bc78735aa" +checksum = "59d8e72637246edd2cba337939850caa8b201f6315925ec4c156fdd089999699" dependencies = [ "cranelift-bitset", + "wasmtime-internal-core", ] [[package]] name = "cranelift-frontend" -version = "0.128.3" +version = "0.129.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e303983ad7e23c850f24d9c41fc3cb346e1b930f066d3966545e4c98dac5c9fb" +checksum = "4c31db0085c3dfa131e739c3b26f9f9c84d69a9459627aac1ac4ef8355e3411b" dependencies = [ "cranelift-codegen", "log", @@ -150,15 +155,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.128.3" +version = "0.129.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24b0cf8d867d891245836cac7abafb0a5b0ea040a019d720702b3b8bcba40bfa" +checksum = "524d804c1ebd8c542e6f64e71aa36934cec17c5da4a9ae3799796220317f5d23" [[package]] name = "cranelift-jit" -version = "0.128.3" +version = "0.129.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf1e35da6eca2448395f483eb172ce71dd7842f7dc96f44bb8923beafe43c6d" +checksum = "02ca12808d5c1ccf40cb02493a8f1790358f230867fe37735e9af8b76a2262cb" dependencies = [ "anyhow", "cranelift-codegen", @@ -176,9 +181,9 @@ dependencies = [ [[package]] name = "cranelift-module" -version = "0.128.3" +version = "0.129.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "792ba2a54100e34f8a36e3e329a5207cafd1f0918a031d34695db73c163fdcc7" +checksum = "4d92fca47132ffc3de8783e82a577a2c8aedf85d1e12b92d08863d9af8a76bd4" dependencies = [ "anyhow", "cranelift-codegen", @@ -187,9 +192,9 @@ dependencies = [ [[package]] name = "cranelift-native" -version = "0.128.3" +version = "0.129.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e24b641e315443e27807b69c440fe766737d7e718c68beb665a2d69259c77bf3" +checksum = "dc9598f02540e382e1772416eba18e93c5275b746adbbf06ac1f3cf149415270" dependencies = [ "cranelift-codegen", "libc", @@ -198,9 +203,9 @@ dependencies = [ [[package]] name = "cranelift-object" -version = "0.128.3" +version = "0.129.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecba1f219a201cf946150538e631defd620c5051b62c52ecb89a0004bab263d4" +checksum = "38fe79386c13648cf28653b300ba16b797a5be248bf11d3984201a17acbbbde5" dependencies = [ "anyhow", "cranelift-codegen", @@ -213,9 +218,9 @@ dependencies = [ [[package]] name = "cranelift-srcgen" -version = "0.128.3" +version = "0.129.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e378a54e7168a689486d67ee1f818b7e5356e54ae51a1d7a53f4f13f7f8b7a" +checksum = "d953932541249c91e3fa70a75ff1e52adc62979a2a8132145d4b9b3e6d1a9b6a" [[package]] name = "crc32fast" @@ -233,10 +238,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] -name = "fallible-iterator" -version = "0.3.0" +name = "fnv" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foldhash" @@ -246,11 +251,12 @@ checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] name = "gimli" -version = "0.32.3" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" +checksum = "0bf7f043f89559805f8c7cacc432749b2fa0d0a0a9ee46ce47164ed5ba7f126c" dependencies = [ - "fallible-iterator", + "fnv", + "hashbrown 0.16.1", "indexmap", "stable_deref_trait", ] @@ -264,6 +270,12 @@ dependencies = [ "foldhash", ] +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + [[package]] name = "heck" version = "0.5.0" @@ -272,12 +284,12 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "indexmap" -version = "2.10.0" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.16.1", ] [[package]] @@ -330,7 +342,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" dependencies = [ "crc32fast", - "hashbrown", + "hashbrown 0.15.5", "indexmap", "memchr", ] @@ -361,7 +373,7 @@ checksum = "08effbc1fa53aaebff69521a5c05640523fab037b34a4a2c109506bc938246fa" dependencies = [ "allocator-api2", "bumpalo", - "hashbrown", + "hashbrown 0.15.5", "log", "rustc-hash", "smallvec", @@ -468,24 +480,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] -name = "wasmtime-internal-jit-icache-coherence" -version = "41.0.3" +name = "wasmtime-internal-core" +version = "42.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bada5ca1cc47df7d14100e2254e187c2486b426df813cea2dd2553a7469f7674" +checksum = "03a4a3f055a804a2f3d86e816a9df78a8fa57762212a8506164959224a40cd48" dependencies = [ - "anyhow", - "cfg-if", - "libc", - "windows-sys 0.61.2", + "libm", ] [[package]] -name = "wasmtime-internal-math" -version = "41.0.3" +name = "wasmtime-internal-jit-icache-coherence" +version = "42.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf6f615d528eda9adc6eefb062135f831b5215c348f4c3ec3e143690c730605b" +checksum = "c57d24e8d1334a0e5a8b600286ffefa1fc4c3e8176b110dff6fbc1f43c4a599b" dependencies = [ - "libm", + "cfg-if", + "libc", + "wasmtime-internal-core", + "windows-sys 0.61.2", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index a7b4664282ed..bc75092cfb90 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,14 +8,14 @@ crate-type = ["dylib"] [dependencies] # These have to be in sync with each other -cranelift-codegen = { version = "0.128.3", default-features = false, features = ["std", "timing", "unwind", "all-native-arch"] } -cranelift-frontend = { version = "0.128.3" } -cranelift-module = { version = "0.128.3" } -cranelift-native = { version = "0.128.3" } -cranelift-jit = { version = "0.128.3", optional = true } -cranelift-object = { version = "0.128.3" } +cranelift-codegen = { version = "0.129.0", default-features = false, features = ["std", "timing", "unwind", "all-native-arch"] } +cranelift-frontend = { version = "0.129.0" } +cranelift-module = { version = "0.129.0" } +cranelift-native = { version = "0.129.0" } +cranelift-jit = { version = "0.129.0", optional = true } +cranelift-object = { version = "0.129.0" } target-lexicon = "0.13" -gimli = { version = "0.32", default-features = false, features = ["write"] } +gimli = { version = "0.33", default-features = false, features = ["write"] } object = { version = "0.37.3", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] } indexmap = "2.0.0" @@ -24,12 +24,12 @@ smallvec = "1.8.1" [patch.crates-io] # Uncomment to use an unreleased version of cranelift -#cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-41.0.0" } -#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-41.0.0" } -#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-41.0.0" } -#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-41.0.0" } -#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-41.0.0" } -#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-41.0.0" } +#cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-42.0.0" } +#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-42.0.0" } +#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-42.0.0" } +#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-42.0.0" } +#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-42.0.0" } +#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-42.0.0" } # Uncomment to use local checkout of cranelift #cranelift-codegen = { path = "../wasmtime/cranelift/codegen" } From d9bd396c29b25b4af2f2e40a1d35732eff55cb49 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 17 Mar 2026 10:26:29 +0000 Subject: [PATCH 27/41] Workaround for incorrect target cpu rename in Cranelift --- src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 82c2e91b4b0f..9ed882c0dc26 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -345,7 +345,8 @@ fn build_isa(sess: &Session, jit: bool) -> Arc { if target_triple.architecture == target_lexicon::Architecture::X86_64 { // Only set the target cpu on x86_64 as Cranelift is missing // the target cpu list for most other targets. - builder.enable(sess.target.cpu.as_ref()).unwrap(); + // FIXME remove the replace once bytecodealliance/wasmtime#12792 lands + builder.enable(&sess.target.cpu.replace("-", "_")).unwrap(); } builder } From 51aa24a8a83526e955b1edebd4989b6dede345c1 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 17 Mar 2026 12:17:40 +0000 Subject: [PATCH 28/41] Rustup to rustc 1.96.0-nightly (3645249d7 2026-03-16) --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 6789958e3722..aa338e8a8c75 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2026-03-10" +channel = "nightly-2026-03-17" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt"] profile = "minimal" From 13fc81ac2a424040f95cc8e116b1a61e3b476f12 Mon Sep 17 00:00:00 2001 From: Redddy Date: Thu, 19 Mar 2026 00:37:22 +0900 Subject: [PATCH 29/41] Add TODO checker (#1632) --- .github/workflows/main.yml | 12 ++++++- build_system/main.rs | 9 ++++- build_system/todo.rs | 70 ++++++++++++++++++++++++++++++++++++++ build_system/usage.txt | 1 + 4 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 build_system/todo.rs diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 07d9af4a9b54..8acaa42d68bf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,6 +19,16 @@ env: RUSTFLAGS: "-Dwarnings" jobs: + todo_check: + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v4 + + - name: Check todo + run: ./y.sh check-todo + rustfmt: runs-on: ubuntu-latest timeout-minutes: 10 @@ -232,7 +242,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 if: ${{ github.ref == 'refs/heads/main' }} - needs: [rustfmt, test, bench, dist] + needs: [todo_check, rustfmt, test, bench, dist] permissions: contents: write # for creating the dev tag and release diff --git a/build_system/main.rs b/build_system/main.rs index 6251687babc6..0720d72c6d7c 100644 --- a/build_system/main.rs +++ b/build_system/main.rs @@ -17,6 +17,7 @@ mod rustc_info; mod shared_utils; mod tests; +mod todo; mod utils; fn usage() { @@ -38,6 +39,7 @@ enum Command { Test, AbiCafe, Bench, + CheckTodo, } #[derive(Copy, Clone, Debug)] @@ -66,6 +68,7 @@ fn main() { Some("test") => Command::Test, Some("abi-cafe") => Command::AbiCafe, Some("bench") => Command::Bench, + Some("check-todo") => Command::CheckTodo, Some(flag) if flag.starts_with('-') => arg_error!("Expected command found flag {}", flag), Some(command) => arg_error!("Unknown command {}", command), None => { @@ -139,6 +142,10 @@ fn main() { process::exit(0); } + if command == Command::CheckTodo { + todo::run(); + } + let rustup_toolchain_name = match (env::var("CARGO"), env::var("RUSTC"), env::var("RUSTDOC")) { (Ok(_), Ok(_), Ok(_)) => None, (_, Err(_), Err(_)) => Some(rustc_info::get_toolchain_name()), @@ -202,7 +209,7 @@ fn main() { )) }; match command { - Command::Prepare => { + Command::Prepare | Command::CheckTodo => { // Handled above } Command::Test => { diff --git a/build_system/todo.rs b/build_system/todo.rs new file mode 100644 index 000000000000..66b31a10a065 --- /dev/null +++ b/build_system/todo.rs @@ -0,0 +1,70 @@ +use std::ffi::OsStr; +use std::path::{Path, PathBuf}; +use std::process::Command; +use std::{fs, process}; + +const EXTENSIONS: &[&str] = + &["rs", "py", "js", "sh", "c", "cpp", "h", "md", "css", "ftl", "toml", "yml", "yaml"]; + +fn has_supported_extension(path: &Path) -> bool { + path.extension().is_some_and(|ext| EXTENSIONS.iter().any(|e| ext == OsStr::new(e))) +} + +fn list_tracked_files() -> Result, String> { + let output = Command::new("git") + .args(["ls-files", "-z"]) + .output() + .map_err(|e| format!("Failed to run `git ls-files`: {e}"))?; + + if !output.status.success() { + let stderr = String::from_utf8_lossy(&output.stderr); + return Err(format!("`git ls-files` failed: {stderr}")); + } + + let mut files = Vec::new(); + for entry in output.stdout.split(|b| *b == 0) { + if entry.is_empty() { + continue; + } + let path = std::str::from_utf8(entry).unwrap(); + files.push(PathBuf::from(path)); + } + + Ok(files) +} + +pub(crate) fn run() -> ! { + let files = list_tracked_files().unwrap(); + let mut error_count = 0; + // Avoid embedding the task marker in source so greps only find real occurrences. + let todo_marker = "todo".to_ascii_uppercase(); + + for file in files { + if !has_supported_extension(&file) { + continue; + } + + let bytes = fs::read(&file).unwrap(); + let contents = std::str::from_utf8(&bytes).unwrap(); + + for (i, line) in contents.split('\n').enumerate() { + let trimmed = line.trim(); + if trimmed.contains(&todo_marker) { + eprintln!( + "{}:{}: {} is used for tasks that should be done before merging a PR; if you want to leave a message in the codebase use FIXME", + file.display(), + i + 1, + todo_marker + ); + error_count += 1; + } + } + } + + if error_count == 0 { + process::exit(0); + } + + eprintln!("found {} {}(s)", error_count, todo_marker); + process::exit(1); +} diff --git a/build_system/usage.txt b/build_system/usage.txt index 6c98087e5239..572fe7805810 100644 --- a/build_system/usage.txt +++ b/build_system/usage.txt @@ -6,6 +6,7 @@ USAGE: ./y.sh test [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen] [--skip-test TESTNAME] ./y.sh abi-cafe [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen] ./y.sh bench [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen] + ./y.sh check-todo OPTIONS: --sysroot none|clif|llvm From 989b69c6d0ed227ec1992a0116f8aa34adc26780 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Wed, 18 Mar 2026 17:09:59 +0100 Subject: [PATCH 30/41] Remove audit workflow It is not really useful. cg_clif is meant for development only and has relatively few dependencies. It has only ever caught an unmaintained crate about which nothing could be done on our end as cranelift-jit depended on it. --- .github/workflows/audit.yml | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 .github/workflows/audit.yml diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml deleted file mode 100644 index 95a4dcd3266d..000000000000 --- a/.github/workflows/audit.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Security audit -on: - workflow_dispatch: - schedule: - - cron: '0 10 * * 1' # every monday at 10:00 UTC -permissions: - issues: write - checks: write -jobs: - audit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - run: | - sed -i 's/components.*/components = []/' rust-toolchain.toml - - uses: rustsec/audit-check@v2.0.0 - with: - token: ${{ secrets.GITHUB_TOKEN }} From 4366c22475fa011f9c7f4c2d275b21e1f0ee7441 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Wed, 18 Mar 2026 17:27:11 +0100 Subject: [PATCH 31/41] Remove outdated entries in clean_all.sh --- clean_all.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/clean_all.sh b/clean_all.sh index 4dbd9dac94a8..32ed19300ac6 100755 --- a/clean_all.sh +++ b/clean_all.sh @@ -2,9 +2,3 @@ set -e rm -rf target/ build_system/target download/ build/ dist/ - -# Kept for now in case someone updates their checkout of cg_clif before running clean_all.sh -# FIXME remove at some point in the future -rm y.bin y.bin.dSYM y.exe y.pdb 2>/dev/null || true -rm -rf rand/ regex/ simple-raytracer/ portable-simd/ abi-checker/ abi-cafe/ -rm -rf build_sysroot/{sysroot_src/,target/,compiler-builtins/,rustc_version} From fe2a2fb8c67be4c3484e8d2f61a000b1fc0c3838 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Thu, 19 Mar 2026 16:08:00 +0000 Subject: [PATCH 32/41] coretests: Expand ieee754 parsing and printing tests to f16 Use `float_test!` to cover all types, with a note about f128 missing the traits. --- patches/0029-sysroot_tests-disable-f16-math.patch | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/patches/0029-sysroot_tests-disable-f16-math.patch b/patches/0029-sysroot_tests-disable-f16-math.patch index 340f6cc9b0e7..2a6bfe816457 100644 --- a/patches/0029-sysroot_tests-disable-f16-math.patch +++ b/patches/0029-sysroot_tests-disable-f16-math.patch @@ -4,13 +4,13 @@ Date: Sun, 15 Feb 2026 14:06:49 +0000 Subject: [PATCH] Disable f16 math tests for cranelift --- - coretests/tests/floats/mod.rs | 26 +++++++++++++------------- + coretests/tests/num/floats.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/coretests/tests/floats/mod.rs b/coretests/tests/floats/mod.rs index c61961f8584..d7b4fa20322 100644 ---- a/coretests/tests/floats/mod.rs -+++ b/coretests/tests/floats/mod.rs +--- a/coretests/tests/num/floats.rs ++++ b/coretests/tests/num/floats.rs @@ -1534,7 +1534,7 @@ fn s_nan() -> Float { name: powf, attrs: { @@ -128,6 +128,5 @@ index c61961f8584..d7b4fa20322 100644 f128: #[cfg(all(not(miri), target_has_reliable_f128_math))], }, test { --- +-- 2.50.1 - From 1111eb599e6ce93acfd854961749bebb3b0664e5 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 20 Mar 2026 09:59:58 +0000 Subject: [PATCH 33/41] Update to Cranelift 0.130 --- Cargo.lock | 100 +++++++++++++++++++++++++++-------------------------- Cargo.toml | 26 +++++++------- src/lib.rs | 3 +- 3 files changed, 65 insertions(+), 64 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2ceca336f094..2d84d2c57fc6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,9 +28,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bumpalo" -version = "3.19.1" +version = "3.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" dependencies = [ "allocator-api2", ] @@ -43,45 +43,46 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "cranelift-assembler-x64" -version = "0.129.1" +version = "0.130.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40630d663279bc855bff805d6f5e8a0b6a1867f9df95b010511ac6dc894e9395" +checksum = "4f248321c6a7d4de5dcf2939368e96a397ad3f53b6a076e38d0104d1da326d37" dependencies = [ "cranelift-assembler-x64-meta", ] [[package]] name = "cranelift-assembler-x64-meta" -version = "0.129.1" +version = "0.130.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ee6aec5ceb55e5fdbcf7ef677d7c7195531360ff181ce39b2b31df11d57305f" +checksum = "ab6d78ff1f7d9bf8b7e1afbedbf78ba49e38e9da479d4c8a2db094e22f64e2bc" dependencies = [ "cranelift-srcgen", ] [[package]] name = "cranelift-bforest" -version = "0.129.1" +version = "0.130.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a92d78cc3f087d7e7073828f08d98c7074a3a062b6b29a1b7783ce74305685e" +checksum = "6b6005ba640213a5b95382aeaf6b82bf028309581c8d7349778d66f27dc1180b" dependencies = [ "cranelift-entity", + "wasmtime-internal-core", ] [[package]] name = "cranelift-bitset" -version = "0.129.1" +version = "0.130.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edcc73d756f2e0d7eda6144fe64a2bc69c624de893cb1be51f1442aed77881d2" +checksum = "81fb5b134a12b559ff0c0f5af0fcd755ad380723b5016c4e0d36f74d39485340" dependencies = [ "wasmtime-internal-core", ] [[package]] name = "cranelift-codegen" -version = "0.129.1" +version = "0.130.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d94c2cd0d73b41369b88da1129589bc3a2d99cf49979af1d14751f35b7a1b" +checksum = "85837de8be7f17a4034a6b08816f05a3144345d2091937b39d415990daca28f4" dependencies = [ "bumpalo", "cranelift-assembler-x64", @@ -93,7 +94,7 @@ dependencies = [ "cranelift-entity", "cranelift-isle", "gimli", - "hashbrown 0.15.5", + "hashbrown 0.16.1", "libm", "log", "regalloc2", @@ -106,9 +107,9 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.129.1" +version = "0.130.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235da0e52ee3a0052d0e944c3470ff025b1f4234f6ec4089d3109f2d2ffa6cbd" +checksum = "e433faa87d38e5b8ff469e44a26fea4f93e58abd7a7c10bad9810056139700c9" dependencies = [ "cranelift-assembler-x64-meta", "cranelift-codegen-shared", @@ -118,24 +119,24 @@ dependencies = [ [[package]] name = "cranelift-codegen-shared" -version = "0.129.1" +version = "0.130.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20c07c6c440bd1bf920ff7597a1e743ede1f68dcd400730bd6d389effa7662af" +checksum = "5397ba61976e13944ca71230775db13ee1cb62849701ed35b753f4761ed0a9b7" [[package]] name = "cranelift-control" -version = "0.129.1" +version = "0.130.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8797c022e02521901e1aee483dea3ed3c67f2bf0a26405c9dd48e8ee7a70944b" +checksum = "cc81c88765580720eb30f4fc2c1bfdb75fcbf3094f87b3cd69cecca79d77a245" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.129.1" +version = "0.130.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59d8e72637246edd2cba337939850caa8b201f6315925ec4c156fdd089999699" +checksum = "463feed5d46cf8763f3ba3045284cf706dd161496e20ec9c14afbb4ba09b9e66" dependencies = [ "cranelift-bitset", "wasmtime-internal-core", @@ -143,9 +144,9 @@ dependencies = [ [[package]] name = "cranelift-frontend" -version = "0.129.1" +version = "0.130.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c31db0085c3dfa131e739c3b26f9f9c84d69a9459627aac1ac4ef8355e3411b" +checksum = "a4c5eca7696c1c04ab4c7ed8d18eadbb47d6cc9f14ec86fe0881bf1d7e97e261" dependencies = [ "cranelift-codegen", "log", @@ -155,15 +156,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.129.1" +version = "0.130.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524d804c1ebd8c542e6f64e71aa36934cec17c5da4a9ae3799796220317f5d23" +checksum = "f1153844610cc9c6da8cf10ce205e45da1a585b7688ed558aa808bbe2e4e6d77" [[package]] name = "cranelift-jit" -version = "0.129.1" +version = "0.130.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02ca12808d5c1ccf40cb02493a8f1790358f230867fe37735e9af8b76a2262cb" +checksum = "41836de8321b303d3d4188e58cc09c30c7645337342acfcfb363732695cae098" dependencies = [ "anyhow", "cranelift-codegen", @@ -181,9 +182,9 @@ dependencies = [ [[package]] name = "cranelift-module" -version = "0.129.1" +version = "0.130.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d92fca47132ffc3de8783e82a577a2c8aedf85d1e12b92d08863d9af8a76bd4" +checksum = "b731f66cb1b69b60a74216e632968ebdbb95c488d26aa1448ec226ae0ffec33e" dependencies = [ "anyhow", "cranelift-codegen", @@ -192,9 +193,9 @@ dependencies = [ [[package]] name = "cranelift-native" -version = "0.129.1" +version = "0.130.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc9598f02540e382e1772416eba18e93c5275b746adbbf06ac1f3cf149415270" +checksum = "a97b583fe9a60f06b0464cee6be5a17f623fd91b217aaac99b51b339d19911af" dependencies = [ "cranelift-codegen", "libc", @@ -203,9 +204,9 @@ dependencies = [ [[package]] name = "cranelift-object" -version = "0.129.1" +version = "0.130.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38fe79386c13648cf28653b300ba16b797a5be248bf11d3984201a17acbbbde5" +checksum = "9809d2d419cd18f17377f4ce64a7ad22eeda0d042c08833d3796657f1ddebc82" dependencies = [ "anyhow", "cranelift-codegen", @@ -218,9 +219,9 @@ dependencies = [ [[package]] name = "cranelift-srcgen" -version = "0.129.1" +version = "0.130.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d953932541249c91e3fa70a75ff1e52adc62979a2a8132145d4b9b3e6d1a9b6a" +checksum = "8594dc6bb4860fa8292f1814c76459dbfb933e1978d8222de6380efce45c7cee" [[package]] name = "crc32fast" @@ -245,9 +246,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foldhash" -version = "0.1.5" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" [[package]] name = "gimli" @@ -266,15 +267,15 @@ name = "hashbrown" version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" -dependencies = [ - "foldhash", -] [[package]] name = "hashbrown" version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "foldhash", +] [[package]] name = "heck" @@ -337,12 +338,12 @@ checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "object" -version = "0.37.3" +version = "0.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +checksum = "271638cd5fa9cca89c4c304675ca658efc4e64a66c716b7cfe1afb4b9611dbbc" dependencies = [ "crc32fast", - "hashbrown 0.15.5", + "hashbrown 0.16.1", "indexmap", "memchr", ] @@ -367,9 +368,9 @@ dependencies = [ [[package]] name = "regalloc2" -version = "0.13.5" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08effbc1fa53aaebff69521a5c05640523fab037b34a4a2c109506bc938246fa" +checksum = "952ddbfc6f9f64d006c3efd8c9851a6ba2f2b944ba94730db255d55006e0ffda" dependencies = [ "allocator-api2", "bumpalo", @@ -481,18 +482,19 @@ checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] name = "wasmtime-internal-core" -version = "42.0.1" +version = "43.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a4a3f055a804a2f3d86e816a9df78a8fa57762212a8506164959224a40cd48" +checksum = "e671917bb6856ae360cb59d7aaf26f1cfd042c7b924319dd06fd380739fc0b2e" dependencies = [ + "hashbrown 0.16.1", "libm", ] [[package]] name = "wasmtime-internal-jit-icache-coherence" -version = "42.0.1" +version = "43.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c57d24e8d1334a0e5a8b600286ffefa1fc4c3e8176b110dff6fbc1f43c4a599b" +checksum = "9b3112806515fac8495883885eb8dbdde849988ae91fe6beb544c0d7c0f4c9aa" dependencies = [ "cfg-if", "libc", diff --git a/Cargo.toml b/Cargo.toml index bc75092cfb90..6707557f06f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,15 +8,15 @@ crate-type = ["dylib"] [dependencies] # These have to be in sync with each other -cranelift-codegen = { version = "0.129.0", default-features = false, features = ["std", "timing", "unwind", "all-native-arch"] } -cranelift-frontend = { version = "0.129.0" } -cranelift-module = { version = "0.129.0" } -cranelift-native = { version = "0.129.0" } -cranelift-jit = { version = "0.129.0", optional = true } -cranelift-object = { version = "0.129.0" } +cranelift-codegen = { version = "0.130.0", default-features = false, features = ["std", "timing", "unwind", "all-native-arch"] } +cranelift-frontend = { version = "0.130.0" } +cranelift-module = { version = "0.130.0" } +cranelift-native = { version = "0.130.0" } +cranelift-jit = { version = "0.130.0", optional = true } +cranelift-object = { version = "0.130.0" } target-lexicon = "0.13" gimli = { version = "0.33", default-features = false, features = ["write"] } -object = { version = "0.37.3", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] } +object = { version = "0.38.0", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] } indexmap = "2.0.0" libloading = { version = "0.9.0", optional = true } @@ -24,12 +24,12 @@ smallvec = "1.8.1" [patch.crates-io] # Uncomment to use an unreleased version of cranelift -#cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-42.0.0" } -#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-42.0.0" } -#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-42.0.0" } -#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-42.0.0" } -#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-42.0.0" } -#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-42.0.0" } +#cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-43.0.0" } +#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-43.0.0" } +#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-43.0.0" } +#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-43.0.0" } +#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-43.0.0" } +#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-43.0.0" } # Uncomment to use local checkout of cranelift #cranelift-codegen = { path = "../wasmtime/cranelift/codegen" } diff --git a/src/lib.rs b/src/lib.rs index 9ed882c0dc26..82c2e91b4b0f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -345,8 +345,7 @@ fn build_isa(sess: &Session, jit: bool) -> Arc { if target_triple.architecture == target_lexicon::Architecture::X86_64 { // Only set the target cpu on x86_64 as Cranelift is missing // the target cpu list for most other targets. - // FIXME remove the replace once bytecodealliance/wasmtime#12792 lands - builder.enable(&sess.target.cpu.replace("-", "_")).unwrap(); + builder.enable(sess.target.cpu.as_ref()).unwrap(); } builder } From a043e3657488386febb4ef815398ee63d339e5de Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 20 Mar 2026 11:48:36 +0100 Subject: [PATCH 34/41] Defer codegen for the VaList Drop impl to actual uses This allows compiling libcore with codegen backends that don't actually implement VaList like cg_clif. --- ...esn-t-get-emitted-unless-VaList-is-a.patch | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 patches/0028-stdlib-Ensure-va_end-doesn-t-get-emitted-unless-VaList-is-a.patch diff --git a/patches/0028-stdlib-Ensure-va_end-doesn-t-get-emitted-unless-VaList-is-a.patch b/patches/0028-stdlib-Ensure-va_end-doesn-t-get-emitted-unless-VaList-is-a.patch deleted file mode 100644 index 2aa93164674f..000000000000 --- a/patches/0028-stdlib-Ensure-va_end-doesn-t-get-emitted-unless-VaList-is-a.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 116abc64add4d617104993a7a3011f20bcf31ef2 Mon Sep 17 00:00:00 2001 -From: bjorn3 <17426603+bjorn3@users.noreply.github.com> -Date: Mon, 26 Jan 2026 16:20:58 +0000 -Subject: [PATCH] Ensure va_end doesn't get emitted unless VaList is actually - used - ---- - library/core/src/ffi/va_list.rs | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/library/core/src/ffi/va_list.rs b/library/core/src/ffi/va_list.rs -index d0f1553..75129af 100644 ---- a/library/core/src/ffi/va_list.rs -+++ b/library/core/src/ffi/va_list.rs -@@ -217,6 +217,7 @@ impl Clone for VaList<'_> { - - #[rustc_const_unstable(feature = "const_c_variadic", issue = "151787")] - impl<'f> const Drop for VaList<'f> { -+ #[inline] - fn drop(&mut self) { - // SAFETY: this variable argument list is being dropped, so won't be read from again. - unsafe { va_end(self) } --- -2.43.0 - From 910d0d7a7779ee7e620ec420f0a324b99f0d3c7a Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 20 Mar 2026 11:37:33 +0100 Subject: [PATCH 35/41] Fix calling custom call conv functions from inline asm --- example/std_example.rs | 18 ++++++++++++++++++ src/inline_asm.rs | 39 +++++++++++++++++++++++++-------------- 2 files changed, 43 insertions(+), 14 deletions(-) diff --git a/example/std_example.rs b/example/std_example.rs index 360fb76a6224..f0e38ae0610c 100644 --- a/example/std_example.rs +++ b/example/std_example.rs @@ -167,6 +167,9 @@ enum Never {} rust_call_abi(); + // #[cfg(target_arch = "x86_64")] + // inline_asm_call_custom_abi(); + const fn no_str() -> Option> { None } @@ -678,3 +681,18 @@ fn map(a: Option<(u8, Box)>) -> Option> { Some((_, instr)) => Some(instr), } } + +// FIXME enable once inline asm sym references are stabilized in cg_clif +// #[cfg(target_arch = "x86_64")] +// fn inline_asm_call_custom_abi() { +// use std::arch::{asm, naked_asm}; +// +// #[unsafe(naked)] +// unsafe extern "custom" fn double() { +// naked_asm!("add rax, rax", "ret"); +// } +// +// let mut x: u64 = 21; +// unsafe { asm!("call {}", sym double, inout("rax") x) }; +// assert_eq!(x, 42); +// } diff --git a/src/inline_asm.rs b/src/inline_asm.rs index 044243f2c716..8100d565b397 100644 --- a/src/inline_asm.rs +++ b/src/inline_asm.rs @@ -3,8 +3,10 @@ use std::fmt::Write; use cranelift_codegen::isa::CallConv; +use rustc_abi::CanonAbi; use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_hir::LangItem; +use rustc_middle::ty::layout::FnAbiOf; use rustc_span::sym; use rustc_target::asm::*; use rustc_target::spec::Arch; @@ -120,21 +122,30 @@ pub(crate) fn codegen_inline_asm_terminator<'tcx>( .unwrap(); let symbol = fx.tcx.symbol_name(instance); - // Pass a wrapper rather than the function itself as the function itself may not - // be exported from the main codegen unit and may thus be unreachable from the - // object file created by an external assembler. - let wrapper_name = format!( - "{}__inline_asm_{}_wrapper_n{}", - fx.symbol_name, - fx.cgu_name.as_str().replace('.', "__").replace('-', "_"), - fx.inline_asm_index, - ); - fx.inline_asm_index += 1; - let sig = - get_function_sig(fx.tcx, fx.target_config.default_call_conv, instance); - create_wrapper_function(fx.module, sig, &wrapper_name, symbol.name); + if FullyMonomorphizedLayoutCx(fx.tcx) + .fn_abi_of_instance(instance, ty::List::empty()) + .conv + == CanonAbi::Custom + { + // We can't create a wrapper for custom ABI functions. + CInlineAsmOperand::Symbol { symbol: symbol.name.to_owned() } + } else { + // Pass a wrapper rather than the function itself as the function itself may not + // be exported from the main codegen unit and may thus be unreachable from the + // object file created by an external assembler. + let wrapper_name = format!( + "{}__inline_asm_{}_wrapper_n{}", + fx.symbol_name, + fx.cgu_name.as_str().replace('.', "__").replace('-', "_"), + fx.inline_asm_index, + ); + fx.inline_asm_index += 1; + let sig = + get_function_sig(fx.tcx, fx.target_config.default_call_conv, instance); + create_wrapper_function(fx.module, sig, &wrapper_name, symbol.name); - CInlineAsmOperand::Symbol { symbol: wrapper_name } + CInlineAsmOperand::Symbol { symbol: wrapper_name } + } } else { span_bug!(span, "invalid type for asm sym (fn)"); } From 18a28f04f26b186ad7868bd7c734685211e3cb0c Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 20 Mar 2026 14:13:31 +0100 Subject: [PATCH 36/41] Update to actions/checkout@v6 --- .github/workflows/abi-cafe.yml | 2 +- .github/workflows/main.yml | 14 +++++++------- .github/workflows/rustc.yml | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/abi-cafe.yml b/.github/workflows/abi-cafe.yml index 3367562f2683..0abc0c6677da 100644 --- a/.github/workflows/abi-cafe.yml +++ b/.github/workflows/abi-cafe.yml @@ -43,7 +43,7 @@ jobs: # TARGET_TRIPLE: x86_64-pc-windows-gnu steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: CPU features if: matrix.os == 'ubuntu-latest' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8acaa42d68bf..b62e3b76db35 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,7 +24,7 @@ jobs: timeout-minutes: 10 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Check todo run: ./y.sh check-todo @@ -34,7 +34,7 @@ jobs: timeout-minutes: 10 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Avoid installing rustc-dev run: | @@ -88,7 +88,7 @@ jobs: TARGET_TRIPLE: x86_64-pc-windows-gnu steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: CPU features if: matrix.os == 'ubuntu-latest' @@ -137,7 +137,7 @@ jobs: timeout-minutes: 60 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: CPU features run: cat /proc/cpuinfo @@ -159,7 +159,7 @@ jobs: timeout-minutes: 60 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: CPU features run: cat /proc/cpuinfo @@ -211,7 +211,7 @@ jobs: TARGET_TRIPLE: x86_64-pc-windows-gnu steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Cache cargo target dir uses: actions/cache@v4 @@ -252,7 +252,7 @@ jobs: cancel-in-progress: true steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Download all built artifacts uses: actions/download-artifact@v4 diff --git a/.github/workflows/rustc.yml b/.github/workflows/rustc.yml index b22725fdc9d4..bb5851d522f0 100644 --- a/.github/workflows/rustc.yml +++ b/.github/workflows/rustc.yml @@ -11,7 +11,7 @@ jobs: timeout-minutes: 60 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: CPU features run: cat /proc/cpuinfo @@ -31,7 +31,7 @@ jobs: timeout-minutes: 60 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: CPU features run: cat /proc/cpuinfo From 4ff5ba2393058003fe589c288a7ab14713460f8c Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 20 Mar 2026 14:15:49 +0100 Subject: [PATCH 37/41] Update to actions/cache@v5 and actions/upload-artifact@v6 --- .github/workflows/abi-cafe.yml | 2 +- .github/workflows/main.yml | 8 ++++---- .github/workflows/rustc.yml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/abi-cafe.yml b/.github/workflows/abi-cafe.yml index 0abc0c6677da..c11fc5921ef1 100644 --- a/.github/workflows/abi-cafe.yml +++ b/.github/workflows/abi-cafe.yml @@ -56,7 +56,7 @@ jobs: run: .github/scripts/free-disk-space.sh - name: Cache cargo target dir - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: build/cg_clif key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b62e3b76db35..7f9fd0cc7c5e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -95,7 +95,7 @@ jobs: run: cat /proc/cpuinfo - name: Cache cargo target dir - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: build/cg_clif key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain.toml', '**/Cargo.lock') }} @@ -165,7 +165,7 @@ jobs: run: cat /proc/cpuinfo - name: Cache cargo target dir - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: build/cg_clif key: ${{ runner.os }}-x86_64-unknown-linux-gnu-cargo-build-target-${{ hashFiles('rust-toolchain.toml', '**/Cargo.lock') }} @@ -214,7 +214,7 @@ jobs: - uses: actions/checkout@v6 - name: Cache cargo target dir - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: build/cg_clif key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-dist-cargo-build-target-${{ hashFiles('rust-toolchain.toml', '**/Cargo.lock') }} @@ -233,7 +233,7 @@ jobs: run: tar cvfJ cg_clif.tar.xz dist - name: Upload prebuilt cg_clif - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: cg_clif-${{ matrix.env.TARGET_TRIPLE }} path: cg_clif.tar.xz diff --git a/.github/workflows/rustc.yml b/.github/workflows/rustc.yml index bb5851d522f0..0f91bc11753e 100644 --- a/.github/workflows/rustc.yml +++ b/.github/workflows/rustc.yml @@ -17,7 +17,7 @@ jobs: run: cat /proc/cpuinfo - name: Cache cargo target dir - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: build/cg_clif key: ${{ runner.os }}-rustc-test-cargo-build-target-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }} @@ -37,7 +37,7 @@ jobs: run: cat /proc/cpuinfo - name: Cache cargo target dir - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: build/cg_clif key: ${{ runner.os }}-rustc-test-cargo-build-target-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }} From 8ad9f06106a80ef6249e4f7b2990544bdf829e1d Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 20 Mar 2026 14:55:26 +0100 Subject: [PATCH 38/41] Rustup to rustc 1.96.0-nightly (bcf3d36c9 2026-03-19) --- ...0-sysroot_tests-Add-missing-feature-gate.patch | 15 +-------------- rust-toolchain.toml | 2 +- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/patches/0030-sysroot_tests-Add-missing-feature-gate.patch b/patches/0030-sysroot_tests-Add-missing-feature-gate.patch index f2985f4f83d9..e4f1b0474afe 100644 --- a/patches/0030-sysroot_tests-Add-missing-feature-gate.patch +++ b/patches/0030-sysroot_tests-Add-missing-feature-gate.patch @@ -5,8 +5,7 @@ Subject: [PATCH] Add missing feature gate --- coretests/benches/lib.rs | 1 + - coretests/tests/lib.rs | 1 + - 2 file changed, 2 insertion(+) + 1 file changed, 1 insertion(+) diff --git a/coretests/benches/lib.rs b/coretests/benches/lib.rs index 150b9b3..281aa75 100644 @@ -20,18 +19,6 @@ index 150b9b3..281aa75 100644 #![feature(uint_gather_scatter_bits)] extern crate test; -diff --git a/coretests/tests/lib.rs b/coretests/tests/lib.rs -index ecdb687..ab2cf77 100644 ---- a/coretests/tests/lib.rs -+++ b/coretests/tests/lib.rs -@@ -88,6 +88,7 @@ - #![feature(non_exhaustive_omitted_patterns_lint)] - #![feature(nonzero_from_str_radix)] - #![feature(numfmt)] -+#![feature(num_internals)] - #![feature(one_sided_range)] - #![feature(panic_internals)] - #![feature(pattern)] -- 2.43.0 diff --git a/rust-toolchain.toml b/rust-toolchain.toml index aa338e8a8c75..a531c60a45a5 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2026-03-17" +channel = "nightly-2026-03-20" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt"] profile = "minimal" From 70488173b7a7864f2d24f09399f40b7d7075c8e0 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 12 Mar 2026 09:54:41 +0100 Subject: [PATCH 39/41] target specs: rename abi to cfg_abi --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 82c2e91b4b0f..cbbb0ccbbc21 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,7 +46,7 @@ use rustc_session::Session; use rustc_session::config::OutputFilenames; use rustc_span::{Symbol, sym}; -use rustc_target::spec::{Abi, Arch, Env, Os}; +use rustc_target::spec::{Arch, CfgAbi, Env, Os}; pub use crate::config::*; use crate::prelude::*; @@ -178,7 +178,7 @@ fn target_config(&self, sess: &Session) -> TargetConfig { let has_reliable_f16_f128 = !(sess.target.arch == Arch::X86_64 && sess.target.os == Os::Windows && sess.target.env == Env::Gnu - && sess.target.abi != Abi::Llvm); + && sess.target.cfg_abi != CfgAbi::Llvm); // FIXME(f128): f128 math operations need f128 math symbols, which currently aren't always // filled in by compiler-builtins. The only libc that provides these currently is glibc. From 151ce088757143cf18a6c92263944b88ccb2b351 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 23 Mar 2026 15:18:14 +0100 Subject: [PATCH 40/41] Rustup to rustc 1.96.0-nightly (562dee482 2026-03-21) --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index a531c60a45a5..80a698809720 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2026-03-20" +channel = "nightly-2026-03-23" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt"] profile = "minimal" From 493d427c7d3423f085f05179e36a35b4943b1379 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Wed, 25 Mar 2026 11:18:17 +0100 Subject: [PATCH 41/41] Rustup to rustc 1.96.0-nightly (362211dc2 2026-03-24) --- ...sroot_tests-Add-missing-feature-gate.patch | 24 ------------------- rust-toolchain.toml | 2 +- 2 files changed, 1 insertion(+), 25 deletions(-) delete mode 100644 patches/0030-sysroot_tests-Add-missing-feature-gate.patch diff --git a/patches/0030-sysroot_tests-Add-missing-feature-gate.patch b/patches/0030-sysroot_tests-Add-missing-feature-gate.patch deleted file mode 100644 index e4f1b0474afe..000000000000 --- a/patches/0030-sysroot_tests-Add-missing-feature-gate.patch +++ /dev/null @@ -1,24 +0,0 @@ -From baa9c656ba61633f2e5785fc47bc8f88ed2f738e Mon Sep 17 00:00:00 2001 -From: bjorn3 <17426603+bjorn3@users.noreply.github.com> -Date: Wed, 11 Mar 2026 12:34:47 +0000 -Subject: [PATCH] Add missing feature gate - ---- - coretests/benches/lib.rs | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/coretests/benches/lib.rs b/coretests/benches/lib.rs -index 150b9b3..281aa75 100644 ---- a/coretests/benches/lib.rs -+++ b/coretests/benches/lib.rs -@@ -8,6 +8,7 @@ - #![feature(iter_array_chunks)] - #![feature(iter_next_chunk)] - #![feature(iter_advance_by)] -+#![feature(num_internals)] - #![feature(uint_gather_scatter_bits)] - - extern crate test; --- -2.43.0 - diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 80a698809720..d4bb9bea82bb 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2026-03-23" +channel = "nightly-2026-03-25" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt"] profile = "minimal"