From 4c29d61ec622f9081ee4f6bbe38ee5735d4cfb22 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Wed, 15 Oct 2025 09:55:38 +0000 Subject: [PATCH 01/17] Remove -Zoom=panic There are major questions remaining about the reentrancy that this allows. It doesn't have any users on github outside of a single project that uses it in a panic=abort project to show backtraces. It can still be emulated through #[alloc_error_handler] or set_alloc_error_hook depending on if you use the standard library or not. And finally it makes it harder to do various improvements to the allocator shim. --- src/allocator.rs | 39 ++------------------------------------- 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/src/allocator.rs b/src/allocator.rs index 67b89114356b5..4a9b0c0952ff3 100644 --- a/src/allocator.rs +++ b/src/allocator.rs @@ -6,7 +6,6 @@ use rustc_ast::expand::allocator::{ AllocatorMethod, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE, default_fn_name, global_fn_name, }; use rustc_codegen_ssa::base::{allocator_kind_for_codegen, allocator_shim_contents}; -use rustc_session::config::OomStrategy; use rustc_symbol_mangling::mangle_internal_symbol; use crate::prelude::*; @@ -15,16 +14,11 @@ use crate::prelude::*; pub(crate) fn codegen(tcx: TyCtxt<'_>, module: &mut dyn Module) -> bool { let Some(kind) = allocator_kind_for_codegen(tcx) else { return false }; let methods = allocator_shim_contents(tcx, kind); - codegen_inner(tcx, module, &methods, tcx.sess.opts.unstable_opts.oom); + codegen_inner(tcx, module, &methods); true } -fn codegen_inner( - tcx: TyCtxt<'_>, - module: &mut dyn Module, - methods: &[AllocatorMethod], - oom_strategy: OomStrategy, -) { +fn codegen_inner(tcx: TyCtxt<'_>, module: &mut dyn Module, methods: &[AllocatorMethod]) { let usize_ty = module.target_config().pointer_type(); for method in methods { @@ -65,35 +59,6 @@ fn codegen_inner( ); } - { - let sig = Signature { - call_conv: module.target_config().default_call_conv, - params: vec![], - returns: vec![AbiParam::new(types::I8)], - }; - let func_id = module - .declare_function( - &mangle_internal_symbol(tcx, OomStrategy::SYMBOL), - Linkage::Export, - &sig, - ) - .unwrap(); - let mut ctx = Context::new(); - ctx.func.signature = sig; - { - let mut func_ctx = FunctionBuilderContext::new(); - let mut bcx = FunctionBuilder::new(&mut ctx.func, &mut func_ctx); - - let block = bcx.create_block(); - bcx.switch_to_block(block); - let value = bcx.ins().iconst(types::I8, oom_strategy.should_panic() as i64); - bcx.ins().return_(&[value]); - bcx.seal_all_blocks(); - bcx.finalize(); - } - module.define_function(func_id, &mut ctx).unwrap(); - } - { let sig = Signature { call_conv: module.target_config().default_call_conv, From 6693a568aff4d4f41007898d070c157f08a6d2db Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 8 Dec 2025 16:20:48 +0000 Subject: [PATCH 02/17] Merge commit 'e24f0fa3c54951d1a5843b54ebe052faaa3a3cd2' into sync_cg_clif-2025-12-08 --- .cirrus.yml | 2 +- Cargo.lock | 159 ++++++++++-------- Cargo.toml | 26 +-- build_system/abi_cafe.rs | 2 +- build_system/bench.rs | 39 +++-- build_system/build_backend.rs | 7 +- build_system/build_sysroot.rs | 43 ++--- build_system/main.rs | 7 +- build_system/tests.rs | 8 +- build_system/utils.rs | 4 +- ...-simd-Disable-broken-reduce_sum-test.patch | 26 --- rust-toolchain | 2 +- scripts/rustup.sh | 4 +- src/common.rs | 20 ++- src/debuginfo/line_info.rs | 9 +- src/debuginfo/mod.rs | 59 ++++--- src/debuginfo/types.rs | 3 +- src/lib.rs | 12 +- 18 files changed, 224 insertions(+), 208 deletions(-) delete mode 100644 patches/0001-portable-simd-Disable-broken-reduce_sum-test.patch diff --git a/.cirrus.yml b/.cirrus.yml index 3ed89beceb7fe..9be095dbf2d8f 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,7 +1,7 @@ task: name: freebsd freebsd_instance: - image_family: freebsd-14-2 + image_family: freebsd-15-0-amd64-ufs setup_rust_script: - pkg install -y git-tiny binutils - curl https://sh.rustup.rs -sSf --output rustup.sh diff --git a/Cargo.lock b/Cargo.lock index 09b6c6b87c300..617c7f0e34cd4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,15 +10,15 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "anyhow" -version = "1.0.98" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" [[package]] name = "arbitrary" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" +checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" [[package]] name = "bitflags" @@ -37,48 +37,48 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.1" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "cranelift-assembler-x64" -version = "0.125.1" +version = "0.126.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f502c60b6af2025c312b37788c089943ef03156a2910da1aa046bb39eb8f61c7" +checksum = "bf7631e609c97f063f9777aae405e8492abf9bf92336d7aa3f875403dd4ffd7d" dependencies = [ "cranelift-assembler-x64-meta", ] [[package]] name = "cranelift-assembler-x64-meta" -version = "0.125.1" +version = "0.126.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b7e21a74bcf08443a4ef800a4a257063e5c51ee4d7a3bd58da5262d10340830" +checksum = "9c030edccdc4a5bbf28fbfe7701b5cd1f9854b4445184dd34af2a7e8f8db6f45" dependencies = [ "cranelift-srcgen", ] [[package]] name = "cranelift-bforest" -version = "0.125.1" +version = "0.126.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f337d268865c292ad5df0669a9bbf6223ca41460292a20ad5b0a57b8e9f27f93" +checksum = "bb544c1242d0ca98baf01873ebba96c79d5df155d5108d9bb699aefc741f5e6d" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-bitset" -version = "0.125.1" +version = "0.126.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0e60319a8242c8d1c7b5a2444d140c416f903f75e0d84da3256fceb822bab85" +checksum = "f0325aecbafec053d3d3f082edfdca7937e2945e7f09c5ff9672e05198312282" [[package]] name = "cranelift-codegen" -version = "0.125.1" +version = "0.126.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78dee669e447a1c68760bf7acee33835e99d564f0137b067f74d4718dfc9970d" +checksum = "abb3236fd319ae897ba00c8a25105081de5c1348576def0e96c062ad259f87a7" dependencies = [ "bumpalo", "cranelift-assembler-x64", @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.125.1" +version = "0.126.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601f629d172b7230f41dd0e78ee797efaf7ec1a5e113c8f395f4027dff6a92ca" +checksum = "7b8791c911a361c539130ace34fb726b16aca4216470ec75d75264b1495c8a3a" dependencies = [ "cranelift-assembler-x64-meta", "cranelift-codegen-shared", @@ -114,33 +114,33 @@ dependencies = [ [[package]] name = "cranelift-codegen-shared" -version = "0.125.1" +version = "0.126.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15755c2660902c7d59d96f6551a66ef629650dc3fd405f9dad841e8c58c1a4a2" +checksum = "12ead718c2a10990870c19b2497b5a04b8aae6024485e33da25b5d02e35819e0" [[package]] name = "cranelift-control" -version = "0.125.1" +version = "0.126.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "727bfca18705101a294ab9077ad214a8b762ea2bc9844389d0db233d7c61ec3b" +checksum = "c0a57fc972b5651047efddccb99440d103d9d8c13393ccebde15ddd5b6a1181b" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.125.1" +version = "0.126.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15564c6f0c72750ca4374f40b044857cbc8087571e46d4c7ccdbdcc29b1dec8b" +checksum = "5aae980b4a1678b601eab2f52e372ed0b3c9565a31c17f380008cb97b3a699c5" dependencies = [ "cranelift-bitset", ] [[package]] name = "cranelift-frontend" -version = "0.125.1" +version = "0.126.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16c681f2731f1cf68eed9f3b6811571823a5ac498f59c52b73736b68599defb3" +checksum = "a78877016b607982ca1708c0dd4ce23bde04581a39854c9b43a1dca43625b54c" dependencies = [ "cranelift-codegen", "log", @@ -150,15 +150,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.125.1" +version = "0.126.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40cedc02f08307da019a3e06d3f20f772f829ff813aec975accb012f8930b688" +checksum = "5dc46a68b46d4f53f9f2f02ab8d3a34b00f03a21c124a7a965b8cbf5fdb6773b" [[package]] name = "cranelift-jit" -version = "0.125.1" +version = "0.126.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2864461448c72d15ae3311ea63df9c7e35f22f04683785f6715a0cf17e6577d" +checksum = "7df920009af919ad9df52eb7b47b1895145822e0c29da9b715a876fc8ecc6d82" dependencies = [ "anyhow", "cranelift-codegen", @@ -176,9 +176,9 @@ dependencies = [ [[package]] name = "cranelift-module" -version = "0.125.1" +version = "0.126.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b31d249bbbccc4c1ae54701087d4d49d05951897691eef44f4a60e70252743b" +checksum = "ddcf313629071ce74de8e59f02092f5453d1a01047607fc4ad36886b8bd1486c" dependencies = [ "anyhow", "cranelift-codegen", @@ -187,9 +187,9 @@ dependencies = [ [[package]] name = "cranelift-native" -version = "0.125.1" +version = "0.126.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db03ab51c60710eb83d0217725b77db4062aca83b35359f5e6aa99ed1c275977" +checksum = "03faa07ec8cf373250a8252eb773d098ff88259fa1c19ee1ecde8012839f4097" dependencies = [ "cranelift-codegen", "libc", @@ -198,9 +198,9 @@ dependencies = [ [[package]] name = "cranelift-object" -version = "0.125.1" +version = "0.126.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7131e0eb45ee10b0bd6082d0c0114c2e9a670b034d46774b39d0fc5c0ed7cedf" +checksum = "7cca62c14f3c2e4f438192562bbf82d1a98a59543cc66ba04fb658ba99f515a6" dependencies = [ "anyhow", "cranelift-codegen", @@ -213,9 +213,9 @@ dependencies = [ [[package]] name = "cranelift-srcgen" -version = "0.125.1" +version = "0.126.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d7a06c330b7994a891ad5b622ebc9aefcd17beae832dd25f577cf60c13426bf" +checksum = "0484cb32c527a742e1bba09ef174acac0afb1dcf623ef1adda42849200edcd2e" [[package]] name = "crc32fast" @@ -246,9 +246,9 @@ checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] name = "gimli" -version = "0.32.0" +version = "0.32.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93563d740bc9ef04104f9ed6f86f1e3275c2cdafb95664e26584b9ca807a8ffe" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" dependencies = [ "fallible-iterator", "indexmap", @@ -282,18 +282,18 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.174" +version = "0.2.178" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" +checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" [[package]] name = "libloading" -version = "0.8.8" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" +checksum = "754ca22de805bb5744484a5b151a9e1a8e837d5dc232c2d7d8c2e3492edc8b60" dependencies = [ "cfg-if", - "windows-targets 0.53.3", + "windows-link 0.2.1", ] [[package]] @@ -304,9 +304,9 @@ checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" [[package]] name = "log" -version = "0.4.27" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "mach2" @@ -319,9 +319,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.5" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "object" @@ -337,27 +337,27 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.40" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" dependencies = [ "proc-macro2", ] [[package]] name = "regalloc2" -version = "0.13.2" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd8138ce7c3d7c13be4f61893154b5d711bd798d2d7be3ecb8dcc7e7a06ca98" +checksum = "4e249c660440317032a71ddac302f25f1d5dff387667bcc3978d1f77aa31ac34" dependencies = [ "allocator-api2", "bumpalo", @@ -405,18 +405,27 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", @@ -431,15 +440,15 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "stable_deref_trait" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "syn" -version = "2.0.104" +version = "2.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" +checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" dependencies = [ "proc-macro2", "quote", @@ -448,21 +457,21 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.13.2" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a" +checksum = "df7f62577c25e07834649fc3b39fafdc597c0a3527dc1c60129201ccfcbaa50c" [[package]] name = "unicode-ident" -version = "1.0.18" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] name = "wasmtime-internal-jit-icache-coherence" -version = "38.0.1" +version = "39.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d0a76f1a6e887cc1b551b02dfd6e2ce5f6738e8cacd9ad7284f6ac1aac4698f" +checksum = "3f67986f5c499274ae5b2ba5b173bba0b95d1381f5ca70d8eec657f2392117d8" dependencies = [ "anyhow", "cfg-if", @@ -472,9 +481,9 @@ dependencies = [ [[package]] name = "wasmtime-internal-math" -version = "38.0.1" +version = "39.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b900df4252ad86547e7f2b2c00201b006db4e864893bedfb3aca32b23d81868a" +checksum = "a681733e9b5d5d8804ee6cacd59f92c0d87ba2274f42ee1d4e5a943828d0075d" dependencies = [ "libm", ] @@ -485,6 +494,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-sys" version = "0.52.0" @@ -525,7 +540,7 @@ version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" dependencies = [ - "windows-link", + "windows-link 0.1.3", "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", diff --git a/Cargo.toml b/Cargo.toml index f2001123e579d..58e61cd0b9d7d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,28 +8,28 @@ crate-type = ["dylib"] [dependencies] # These have to be in sync with each other -cranelift-codegen = { version = "0.125.0", default-features = false, features = ["std", "timing", "unwind", "all-native-arch"] } -cranelift-frontend = { version = "0.125.0" } -cranelift-module = { version = "0.125.0" } -cranelift-native = { version = "0.125.0" } -cranelift-jit = { version = "0.125.0", optional = true } -cranelift-object = { version = "0.125.0" } +cranelift-codegen = { version = "0.126.0", default-features = false, features = ["std", "timing", "unwind", "all-native-arch"] } +cranelift-frontend = { version = "0.126.0" } +cranelift-module = { version = "0.126.0" } +cranelift-native = { version = "0.126.0" } +cranelift-jit = { version = "0.126.0", optional = true } +cranelift-object = { version = "0.126.0" } 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"] } indexmap = "2.0.0" -libloading = { version = "0.8.0", optional = true } +libloading = { version = "0.9.0", optional = true } 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-38.0.0" } -#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-38.0.0" } -#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-38.0.0" } -#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-38.0.0" } -#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-38.0.0" } -#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-38.0.0" } +#cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-39.0.0" } +#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-39.0.0" } +#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-39.0.0" } +#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-39.0.0" } +#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-39.0.0" } +#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-39.0.0" } # Uncomment to use local checkout of cranelift #cranelift-codegen = { path = "../wasmtime/cranelift/codegen" } diff --git a/build_system/abi_cafe.rs b/build_system/abi_cafe.rs index 5a393a217c278..762b2be8f4405 100644 --- a/build_system/abi_cafe.rs +++ b/build_system/abi_cafe.rs @@ -11,7 +11,7 @@ static ABI_CAFE_REPO: GitRepo = GitRepo::github( "abi-cafe", ); -static ABI_CAFE: CargoProject = CargoProject::new(&ABI_CAFE_REPO.source_dir(), "abi_cafe_target"); +static ABI_CAFE: CargoProject = CargoProject::new(ABI_CAFE_REPO.source_dir(), "abi_cafe_target"); pub(crate) fn run( sysroot_kind: SysrootKind, diff --git a/build_system/bench.rs b/build_system/bench.rs index 192cb499536f1..91353ba8a874d 100644 --- a/build_system/bench.rs +++ b/build_system/bench.rs @@ -39,7 +39,26 @@ pub(crate) fn benchmark(dirs: &Dirs, compiler: &Compiler) { let rustc_clif = &compiler.rustc; let rustflags = &compiler.rustflags.join("\x1f"); let manifest_path = SIMPLE_RAYTRACER_REPO.source_dir().to_path(dirs).join("Cargo.toml"); - let target_dir = dirs.build_dir.join("simple_raytracer"); + let target_dir = dirs.build_dir.join("simple-raytracer_target"); + + let raytracer_cg_llvm = dirs + .build_dir + .join(get_file_name(&compiler.rustc, "raytracer_cg_llvm", "bin")) + .to_str() + .unwrap() + .to_owned(); + let raytracer_cg_clif = dirs + .build_dir + .join(get_file_name(&compiler.rustc, "raytracer_cg_clif", "bin")) + .to_str() + .unwrap() + .to_owned(); + let raytracer_cg_clif_opt = dirs + .build_dir + .join(get_file_name(&compiler.rustc, "raytracer_cg_clif_opt", "bin")) + .to_str() + .unwrap() + .to_owned(); let clean_cmd = format!( "RUSTC=rustc cargo clean --manifest-path {manifest_path} --target-dir {target_dir}", @@ -47,19 +66,19 @@ pub(crate) fn benchmark(dirs: &Dirs, compiler: &Compiler) { target_dir = target_dir.display(), ); let llvm_build_cmd = format!( - "RUSTC=rustc cargo build --manifest-path {manifest_path} --target-dir {target_dir} && (rm build/raytracer_cg_llvm || true) && ln build/simple_raytracer/debug/main build/raytracer_cg_llvm", + "RUSTC=rustc cargo build --manifest-path {manifest_path} --target-dir {target_dir} && (rm {raytracer_cg_llvm} || true) && ln {target_dir}/debug/main {raytracer_cg_llvm}", manifest_path = manifest_path.display(), target_dir = target_dir.display(), ); let clif_build_cmd = format!( - "RUSTC={rustc_clif} CARGO_ENCODED_RUSTFLAGS=\"{rustflags}\" {cargo_clif} build --manifest-path {manifest_path} --target-dir {target_dir} && (rm build/raytracer_cg_clif || true) && ln build/simple_raytracer/debug/main build/raytracer_cg_clif", + "RUSTC={rustc_clif} CARGO_ENCODED_RUSTFLAGS=\"{rustflags}\" {cargo_clif} build --manifest-path {manifest_path} --target-dir {target_dir} && (rm {raytracer_cg_clif} || true) && ln {target_dir}/debug/main {raytracer_cg_clif}", cargo_clif = cargo_clif.display(), rustc_clif = rustc_clif.display(), manifest_path = manifest_path.display(), target_dir = target_dir.display(), ); let clif_build_opt_cmd = format!( - "RUSTC={rustc_clif} CARGO_ENCODED_RUSTFLAGS=\"{rustflags}\" {cargo_clif} build --manifest-path {manifest_path} --target-dir {target_dir} --release && (rm build/raytracer_cg_clif_opt || true) && ln build/simple_raytracer/release/main build/raytracer_cg_clif_opt", + "RUSTC={rustc_clif} CARGO_ENCODED_RUSTFLAGS=\"{rustflags}\" CARGO_BUILD_INCREMENTAL=true {cargo_clif} build --manifest-path {manifest_path} --target-dir {target_dir} --release && (rm {raytracer_cg_clif_opt} || true) && ln {target_dir}/release/main {raytracer_cg_clif_opt}", cargo_clif = cargo_clif.display(), rustc_clif = rustc_clif.display(), manifest_path = manifest_path.display(), @@ -92,20 +111,14 @@ pub(crate) fn benchmark(dirs: &Dirs, compiler: &Compiler) { let bench_run_markdown = dirs.build_dir.join("bench_run.md"); - let raytracer_cg_llvm = - Path::new(".").join(get_file_name(&compiler.rustc, "raytracer_cg_llvm", "bin")); - let raytracer_cg_clif = - Path::new(".").join(get_file_name(&compiler.rustc, "raytracer_cg_clif", "bin")); - let raytracer_cg_clif_opt = - Path::new(".").join(get_file_name(&compiler.rustc, "raytracer_cg_clif_opt", "bin")); let mut bench_run = hyperfine_command( 0, bench_runs, None, &[ - ("", raytracer_cg_llvm.to_str().unwrap()), - ("", raytracer_cg_clif.to_str().unwrap()), - ("", raytracer_cg_clif_opt.to_str().unwrap()), + ("build/raytracer_cg_llvm", &raytracer_cg_llvm), + ("build/raytracer_cg_clif", &raytracer_cg_clif), + ("build/raytracer_cg_clif_opt", &raytracer_cg_clif_opt), ], &bench_run_markdown, ); diff --git a/build_system/build_backend.rs b/build_system/build_backend.rs index b9fa0ff2d94c3..c0a8cc95614f6 100644 --- a/build_system/build_backend.rs +++ b/build_system/build_backend.rs @@ -6,7 +6,7 @@ use crate::rustc_info::get_file_name; use crate::shared_utils::{rustflags_from_env, rustflags_to_cmd_env}; use crate::utils::{CargoProject, Compiler, LogGroup}; -static CG_CLIF: CargoProject = CargoProject::new(&RelPath::source("."), "cg_clif"); +static CG_CLIF: CargoProject = CargoProject::new(RelPath::source("."), "cg_clif"); pub(crate) fn build_backend( dirs: &Dirs, @@ -22,6 +22,11 @@ pub(crate) fn build_backend( rustflags.push("-Zallow-features=rustc_private,f16,f128".to_owned()); rustflags_to_cmd_env(&mut cmd, "RUSTFLAGS", &rustflags); + // Use incr comp despite release mode unless incremental builds are explicitly disabled + if env::var_os("CARGO_BUILD_INCREMENTAL").is_none() { + cmd.env("CARGO_BUILD_INCREMENTAL", "true"); + } + if env::var("CG_CLIF_EXPENSIVE_CHECKS").is_ok() { // Enabling debug assertions implicitly enables the clif ir verifier cmd.env("CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS", "true"); diff --git a/build_system/build_sysroot.rs b/build_system/build_sysroot.rs index 70504ee8007d2..e7363e37a45d0 100644 --- a/build_system/build_sysroot.rs +++ b/build_system/build_sysroot.rs @@ -140,7 +140,7 @@ impl SysrootTarget { static STDLIB_SRC: RelPath = RelPath::build("stdlib"); static STANDARD_LIBRARY: CargoProject = - CargoProject::new(&RelPath::build("stdlib/library/sysroot"), "stdlib_target"); + CargoProject::new(RelPath::build("stdlib/library/sysroot"), "stdlib_target"); fn build_sysroot_for_triple( dirs: &Dirs, @@ -161,35 +161,18 @@ fn build_sysroot_for_triple( fn build_llvm_sysroot_for_triple(compiler: Compiler) -> SysrootTarget { let default_sysroot = crate::rustc_info::get_default_sysroot(&compiler.rustc); - let mut target_libs = SysrootTarget { triple: compiler.triple, libs: vec![] }; + let std_manifest_path = default_sysroot + .join("lib") + .join("rustlib") + .join(format!("manifest-rust-std-{}", compiler.triple)); - for entry in fs::read_dir( - default_sysroot.join("lib").join("rustlib").join(&target_libs.triple).join("lib"), - ) - .unwrap() - { - let entry = entry.unwrap(); - if entry.file_type().unwrap().is_dir() { - continue; - } - let file = entry.path(); - let file_name_str = file.file_name().unwrap().to_str().unwrap(); - if (file_name_str.contains("rustc_") - && !file_name_str.contains("rustc_std_workspace_") - && !file_name_str.contains("rustc_demangle") - && !file_name_str.contains("rustc_literal_escaper")) - || file_name_str.contains("chalk") - || file_name_str.contains("tracing") - || file_name_str.contains("regex") - { - // These are large crates that are part of the rustc-dev component and are not - // necessary to run regular programs. - continue; - } - target_libs.libs.push(file); - } + let libs = fs::read_to_string(std_manifest_path) + .unwrap() + .lines() + .map(|entry| default_sysroot.join(entry.strip_prefix("file:").unwrap())) + .collect(); - target_libs + SysrootTarget { triple: compiler.triple, libs } } fn build_clif_sysroot_for_triple( @@ -251,6 +234,10 @@ fn build_clif_sysroot_for_triple( if compiler.triple.contains("apple") { build_cmd.env("CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO", "packed"); } + // Use incr comp despite release mode unless incremental builds are explicitly disabled + if env::var_os("CARGO_BUILD_INCREMENTAL").is_none() { + build_cmd.env("CARGO_BUILD_INCREMENTAL", "true"); + } spawn_and_wait(build_cmd); for entry in fs::read_dir(build_dir.join("deps")).unwrap() { diff --git a/build_system/main.rs b/build_system/main.rs index fc00931283002..6251687babc67 100644 --- a/build_system/main.rs +++ b/build_system/main.rs @@ -59,11 +59,6 @@ fn main() { } env::set_var("CG_CLIF_DISABLE_INCR_CACHE", "1"); - // Force incr comp even in release mode unless in CI or incremental builds are explicitly disabled - if env::var_os("CARGO_BUILD_INCREMENTAL").is_none() { - env::set_var("CARGO_BUILD_INCREMENTAL", "true"); - } - let mut args = env::args().skip(1); let command = match args.next().as_deref() { Some("prepare") => Command::Prepare, @@ -79,7 +74,7 @@ fn main() { } }; - let mut out_dir = PathBuf::from("."); + let mut out_dir = std::env::current_dir().unwrap(); let mut download_dir = None; let mut sysroot_kind = SysrootKind::Clif; let mut use_unstable_features = true; diff --git a/build_system/tests.rs b/build_system/tests.rs index dd8cf929bc2f0..3b6a2e7a055cb 100644 --- a/build_system/tests.rs +++ b/build_system/tests.rs @@ -129,7 +129,7 @@ pub(crate) static RAND_REPO: GitRepo = GitRepo::github( "rand", ); -static RAND: CargoProject = CargoProject::new(&RAND_REPO.source_dir(), "rand_target"); +static RAND: CargoProject = CargoProject::new(RAND_REPO.source_dir(), "rand_target"); pub(crate) static REGEX_REPO: GitRepo = GitRepo::github( "rust-lang", @@ -139,15 +139,15 @@ pub(crate) static REGEX_REPO: GitRepo = GitRepo::github( "regex", ); -static REGEX: CargoProject = CargoProject::new(®EX_REPO.source_dir(), "regex_target"); +static REGEX: CargoProject = CargoProject::new(REGEX_REPO.source_dir(), "regex_target"); static PORTABLE_SIMD_SRC: RelPath = RelPath::build("portable-simd"); -static PORTABLE_SIMD: CargoProject = CargoProject::new(&PORTABLE_SIMD_SRC, "portable-simd_target"); +static PORTABLE_SIMD: CargoProject = CargoProject::new(PORTABLE_SIMD_SRC, "portable-simd_target"); static SYSROOT_TESTS_SRC: RelPath = RelPath::build("sysroot_tests"); -static SYSROOT_TESTS: CargoProject = CargoProject::new(&SYSROOT_TESTS_SRC, "sysroot_tests_target"); +static SYSROOT_TESTS: CargoProject = CargoProject::new(SYSROOT_TESTS_SRC, "sysroot_tests_target"); const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[ TestCase::custom("test.rust-random/rand", &|runner| { diff --git a/build_system/utils.rs b/build_system/utils.rs index 3266aa0ce8b64..5c7cefa120a7f 100644 --- a/build_system/utils.rs +++ b/build_system/utils.rs @@ -75,12 +75,12 @@ impl Compiler { } pub(crate) struct CargoProject { - source: &'static RelPath, + source: RelPath, target: &'static str, } impl CargoProject { - pub(crate) const fn new(path: &'static RelPath, target: &'static str) -> CargoProject { + pub(crate) const fn new(path: RelPath, target: &'static str) -> CargoProject { CargoProject { source: path, target } } diff --git a/patches/0001-portable-simd-Disable-broken-reduce_sum-test.patch b/patches/0001-portable-simd-Disable-broken-reduce_sum-test.patch deleted file mode 100644 index b1fd6224632be..0000000000000 --- a/patches/0001-portable-simd-Disable-broken-reduce_sum-test.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 5489384bc265e9e6fc2efaa63d93a4d51ebec2f5 Mon Sep 17 00:00:00 2001 -From: bjorn3 <17426603+bjorn3@users.noreply.github.com> -Date: Thu, 22 Aug 2024 19:22:58 +0000 -Subject: [PATCH] Disable broken reduce_sum test - -It was broken by an upstream change to the .sum() implementation on -float iterators. ---- - crates/core_simd/tests/ops_macros.rs | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/crates/core_simd/tests/ops_macros.rs b/crates/core_simd/tests/ops_macros.rs -index aa565a1..5e6ac41 100644 ---- a/crates/core_simd/tests/ops_macros.rs -+++ b/crates/core_simd/tests/ops_macros.rs -@@ -646,6 +646,7 @@ macro_rules! impl_float_tests { - } - - fn reduce_sum() { -+ return; - test_helpers::test_1(&|x| { - test_helpers::prop_assert_biteq! ( - Vector::::from_array(x).reduce_sum(), --- -2.34.1 - diff --git a/rust-toolchain b/rust-toolchain index 17c2cc5ac6609..461dbcdb0fb5d 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2025-11-08" +channel = "nightly-2025-12-08" components = ["rust-src", "rustc-dev", "llvm-tools"] profile = "minimal" diff --git a/scripts/rustup.sh b/scripts/rustup.sh index fdfd03029b160..1a82193303e23 100755 --- a/scripts/rustup.sh +++ b/scripts/rustup.sh @@ -43,7 +43,7 @@ case $1 in cg_clif=$(pwd) pushd ../rust - git pull origin master + git pull origin main branch=sync_cg_clif-$(date +%Y-%m-%d) git checkout -b "$branch" "$cg_clif/git-fixed-subtree.sh" pull --prefix=compiler/rustc_codegen_cranelift/ https://github.com/rust-lang/rustc_codegen_cranelift.git main @@ -63,7 +63,7 @@ case $1 in cg_clif=$(pwd) pushd ../rust - git fetch origin master + git fetch origin main git -c advice.detachedHead=false checkout "$RUST_VERS" "$cg_clif/git-fixed-subtree.sh" push --prefix=compiler/rustc_codegen_cranelift/ "$cg_clif" sync_from_rust popd diff --git a/src/common.rs b/src/common.rs index 38676eaac3d56..b11f42408f58b 100644 --- a/src/common.rs +++ b/src/common.rs @@ -377,26 +377,28 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> { size.is_multiple_of(align), "size must be a multiple of alignment (size={size}, align={align})" ); + debug_assert!(align.is_power_of_two(), "alignment must be a power of two (align={align})"); let abi_align = if self.tcx.sess.target.arch == Arch::S390x { 8 } else { 16 }; + // Cranelift can only guarantee alignment up to the ABI alignment provided by the target. + // If the requested alignment is less than the abi_align it can be used directly. if align <= abi_align { let stack_slot = self.bcx.create_sized_stack_slot(StackSlotData { kind: StackSlotKind::ExplicitSlot, - // FIXME Don't force the size to a multiple of bytes once Cranelift gets - // a way to specify stack slot alignment. - size: size.div_ceil(abi_align) * abi_align, - align_shift: 4, + size, + // The maximum value of ilog2 is 31 which will always fit in a u8. + align_shift: align.ilog2().try_into().unwrap(), + key: None, }); Pointer::stack_slot(stack_slot) } else { - // Alignment is too big to handle using the above hack. Dynamically realign a stack slot + // Alignment is larger than the ABI alignment guaranteed. Dynamically realign a stack slot // instead. This wastes some space for the realignment. let stack_slot = self.bcx.create_sized_stack_slot(StackSlotData { kind: StackSlotKind::ExplicitSlot, - // FIXME Don't force the size to a multiple of bytes once Cranelift gets - // a way to specify stack slot alignment. - size: (size + align) / abi_align * abi_align, - align_shift: 4, + size: size + align, + align_shift: abi_align.ilog2().try_into().unwrap(), + key: None, }); let base_ptr = self.bcx.ins().stack_addr(self.pointer_type, stack_slot, 0); let misalign_offset = self.bcx.ins().band_imm(base_ptr, i64::from(align - 1)); diff --git a/src/debuginfo/line_info.rs b/src/debuginfo/line_info.rs index 6fe22f5c6dd9b..db58ee8909113 100644 --- a/src/debuginfo/line_info.rs +++ b/src/debuginfo/line_info.rs @@ -5,7 +5,7 @@ use std::path::{Component, Path}; use cranelift_codegen::MachSrcLoc; use cranelift_codegen::binemit::CodeOffset; -use gimli::write::{AttributeValue, FileId, FileInfo, LineProgram, LineString, LineStringTable}; +use gimli::write::{FileId, FileInfo, LineProgram, LineString, LineStringTable}; use rustc_span::{FileName, Pos, SourceFile, SourceFileAndLine, SourceFileHashAlgorithm, hygiene}; use crate::debuginfo::FunctionDebugContext; @@ -117,8 +117,7 @@ impl DebugContext { } filename => { // For anonymous sources, create an empty directory instead of using the default - let empty_dir = LineString::new(b"", line_program.encoding(), line_strings); - let dir_id = line_program.add_directory(empty_dir); + let dir_id = line_program.default_directory(); let dummy_file_name = LineString::new( filename.prefer_remapped_unconditionally().to_string().into_bytes(), @@ -176,10 +175,6 @@ impl FunctionDebugContext { assert_ne!(func_end, 0); - let entry = debug_context.dwarf.unit.get_mut(self.entry_id); - entry.set(gimli::DW_AT_low_pc, AttributeValue::Address(address_for_func(func_id))); - entry.set(gimli::DW_AT_high_pc, AttributeValue::Udata(u64::from(func_end))); - func_end } } diff --git a/src/debuginfo/mod.rs b/src/debuginfo/mod.rs index 494002f525c84..8c43db92fe05f 100644 --- a/src/debuginfo/mod.rs +++ b/src/debuginfo/mod.rs @@ -42,14 +42,14 @@ pub(crate) struct DebugContext { created_files: FxHashMap<(StableSourceFileId, SourceFileHash), FileId>, stack_pointer_register: Register, namespace_map: DefIdMap, - array_size_type: UnitEntryId, + array_size_type: Option, filename_display_preference: FileNameDisplayPreference, embed_source: bool, } pub(crate) struct FunctionDebugContext { - entry_id: UnitEntryId, + entry_id: Option, function_source_loc: (FileId, u64, u64), source_loc_set: IndexSet<(FileId, u64, u64)>, } @@ -154,18 +154,23 @@ impl DebugContext { root.set(gimli::DW_AT_low_pc, AttributeValue::Address(Address::Constant(0))); } - let array_size_type = dwarf.unit.add(dwarf.unit.root(), gimli::DW_TAG_base_type); - let array_size_type_entry = dwarf.unit.get_mut(array_size_type); - array_size_type_entry.set( - gimli::DW_AT_name, - AttributeValue::StringRef(dwarf.strings.add("__ARRAY_SIZE_TYPE__")), - ); - array_size_type_entry - .set(gimli::DW_AT_encoding, AttributeValue::Encoding(gimli::DW_ATE_unsigned)); - array_size_type_entry.set( - gimli::DW_AT_byte_size, - AttributeValue::Udata(isa.frontend_config().pointer_bytes().into()), - ); + let array_size_type = if tcx.sess.opts.debuginfo == DebugInfo::LineTablesOnly { + None + } else { + let array_size_type = dwarf.unit.add(dwarf.unit.root(), gimli::DW_TAG_base_type); + let array_size_type_entry = dwarf.unit.get_mut(array_size_type); + array_size_type_entry.set( + gimli::DW_AT_name, + AttributeValue::StringRef(dwarf.strings.add("__ARRAY_SIZE_TYPE__")), + ); + array_size_type_entry + .set(gimli::DW_AT_encoding, AttributeValue::Encoding(gimli::DW_ATE_unsigned)); + array_size_type_entry.set( + gimli::DW_AT_byte_size, + AttributeValue::Udata(isa.frontend_config().pointer_bytes().into()), + ); + Some(array_size_type) + }; Some(DebugContext { endian, @@ -217,6 +222,14 @@ impl DebugContext { ) -> FunctionDebugContext { let (file_id, line, column) = self.get_span_loc(tcx, function_span, function_span); + if tcx.sess.opts.debuginfo == DebugInfo::LineTablesOnly { + return FunctionDebugContext { + entry_id: None, + function_source_loc: (file_id, line, column), + source_loc_set: IndexSet::new(), + }; + } + let scope = self.item_namespace(tcx, tcx.parent(instance.def_id())); let mut name = String::new(); @@ -274,7 +287,7 @@ impl DebugContext { } FunctionDebugContext { - entry_id, + entry_id: Some(entry_id), function_source_loc: (file_id, line, column), source_loc_set: IndexSet::new(), } @@ -288,6 +301,10 @@ impl DebugContext { def_id: DefId, data_id: DataId, ) { + if tcx.sess.opts.debuginfo == DebugInfo::LineTablesOnly { + return; + } + let DefKind::Static { nested, .. } = tcx.def_kind(def_id) else { bug!() }; if nested { return; @@ -353,10 +370,12 @@ impl FunctionDebugContext { .0 .push(Range::StartLength { begin: address_for_func(func_id), length: u64::from(end) }); - let func_entry = debug_context.dwarf.unit.get_mut(self.entry_id); - // Gdb requires both DW_AT_low_pc and DW_AT_high_pc. Otherwise the DW_TAG_subprogram is skipped. - func_entry.set(gimli::DW_AT_low_pc, AttributeValue::Address(address_for_func(func_id))); - // Using Udata for DW_AT_high_pc requires at least DWARF4 - func_entry.set(gimli::DW_AT_high_pc, AttributeValue::Udata(u64::from(end))); + if let Some(entry_id) = self.entry_id { + let entry = debug_context.dwarf.unit.get_mut(entry_id); + // Gdb requires both DW_AT_low_pc and DW_AT_high_pc. Otherwise the DW_TAG_subprogram is skipped. + entry.set(gimli::DW_AT_low_pc, AttributeValue::Address(address_for_func(func_id))); + // Using Udata for DW_AT_high_pc requires at least DWARF4 + entry.set(gimli::DW_AT_high_pc, AttributeValue::Udata(u64::from(end))); + } } } diff --git a/src/debuginfo/types.rs b/src/debuginfo/types.rs index a292429cdfad9..18a0632a0939d 100644 --- a/src/debuginfo/types.rs +++ b/src/debuginfo/types.rs @@ -109,7 +109,8 @@ impl DebugContext { let subrange_id = self.dwarf.unit.add(array_type_id, gimli::DW_TAG_subrange_type); let subrange_entry = self.dwarf.unit.get_mut(subrange_id); - subrange_entry.set(gimli::DW_AT_type, AttributeValue::UnitRef(self.array_size_type)); + subrange_entry + .set(gimli::DW_AT_type, AttributeValue::UnitRef(self.array_size_type.unwrap())); subrange_entry.set(gimli::DW_AT_lower_bound, AttributeValue::Udata(0)); subrange_entry.set(gimli::DW_AT_count, AttributeValue::Udata(len)); diff --git a/src/lib.rs b/src/lib.rs index 5fdecd014ac05..b47b9afa4f073 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -47,7 +47,7 @@ use rustc_codegen_ssa::{CodegenResults, TargetConfig}; use rustc_log::tracing::info; use rustc_middle::dep_graph::{WorkProduct, WorkProductId}; use rustc_session::Session; -use rustc_session::config::OutputFilenames; +use rustc_session::config::{OutputFilenames, PrintKind, PrintRequest}; use rustc_span::{Symbol, sym}; use rustc_target::spec::{Abi, Arch, Env, Os}; @@ -160,6 +160,16 @@ impl CodegenBackend for CraneliftCodegenBackend { } } + fn print(&self, req: &PrintRequest, out: &mut String, _sess: &Session) { + match req.kind { + // FIXME have a default impl that returns false + PrintKind::BackendHasZstd => { + out.push_str("false\n"); + } + _ => {} + } + } + fn target_config(&self, sess: &Session) -> TargetConfig { // FIXME return the actually used target features. this is necessary for #[cfg(target_feature)] let target_features = match sess.target.arch { From 66381e3d790c8a5ea8f3e736e561dacb88780fdc Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Mon, 8 Dec 2025 19:11:04 +0000 Subject: [PATCH 03/17] Revert build_llvm_sysroot_for_triple back from reading the manifest to filtering Reading the manifest doesn't work when running in the context of the rust build system. --- build_system/build_sysroot.rs | 41 +++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/build_system/build_sysroot.rs b/build_system/build_sysroot.rs index e7363e37a45d0..7b4c604580c11 100644 --- a/build_system/build_sysroot.rs +++ b/build_system/build_sysroot.rs @@ -161,18 +161,35 @@ fn build_sysroot_for_triple( fn build_llvm_sysroot_for_triple(compiler: Compiler) -> SysrootTarget { let default_sysroot = crate::rustc_info::get_default_sysroot(&compiler.rustc); - let std_manifest_path = default_sysroot - .join("lib") - .join("rustlib") - .join(format!("manifest-rust-std-{}", compiler.triple)); - - let libs = fs::read_to_string(std_manifest_path) - .unwrap() - .lines() - .map(|entry| default_sysroot.join(entry.strip_prefix("file:").unwrap())) - .collect(); - - SysrootTarget { triple: compiler.triple, libs } + let mut target_libs = SysrootTarget { triple: compiler.triple, libs: vec![] }; + + for entry in fs::read_dir( + default_sysroot.join("lib").join("rustlib").join(&target_libs.triple).join("lib"), + ) + .unwrap() + { + let entry = entry.unwrap(); + if entry.file_type().unwrap().is_dir() { + continue; + } + let file = entry.path(); + let file_name_str = file.file_name().unwrap().to_str().unwrap(); + if (file_name_str.contains("rustc_") + && !file_name_str.contains("rustc_std_workspace_") + && !file_name_str.contains("rustc_demangle") + && !file_name_str.contains("rustc_literal_escaper")) + || file_name_str.contains("chalk") + || file_name_str.contains("tracing") + || file_name_str.contains("regex") + { + // These are large crates that are part of the rustc-dev component and are not + // necessary to run regular programs. + continue; + } + target_libs.libs.push(file); + } + + target_libs } fn build_clif_sysroot_for_triple( From d38a5a6d1d3a988d43ceb247d378317d2e157c9e Mon Sep 17 00:00:00 2001 From: Zalathar Date: Mon, 8 Dec 2025 22:41:13 +1100 Subject: [PATCH 04/17] Make `--print=backend-has-zstd` work by default on any backend Using a defaulted `CodegenBackend` method that querying for zstd support should automatically print a safe value of `false` on any backend that doesn't specifically indicate the presence or absence of zstd. --- src/lib.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b47b9afa4f073..5fdecd014ac05 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -47,7 +47,7 @@ use rustc_codegen_ssa::{CodegenResults, TargetConfig}; use rustc_log::tracing::info; use rustc_middle::dep_graph::{WorkProduct, WorkProductId}; use rustc_session::Session; -use rustc_session::config::{OutputFilenames, PrintKind, PrintRequest}; +use rustc_session::config::OutputFilenames; use rustc_span::{Symbol, sym}; use rustc_target::spec::{Abi, Arch, Env, Os}; @@ -160,16 +160,6 @@ impl CodegenBackend for CraneliftCodegenBackend { } } - fn print(&self, req: &PrintRequest, out: &mut String, _sess: &Session) { - match req.kind { - // FIXME have a default impl that returns false - PrintKind::BackendHasZstd => { - out.push_str("false\n"); - } - _ => {} - } - } - fn target_config(&self, sess: &Session) -> TargetConfig { // FIXME return the actually used target features. this is necessary for #[cfg(target_feature)] let target_features = match sess.target.arch { From 932c939c9fa2c72c313172be4ea18b1fb1afcc7a Mon Sep 17 00:00:00 2001 From: Jamie Hill-Daniel Date: Wed, 10 Dec 2025 23:41:19 +0000 Subject: [PATCH 05/17] Remove uses of `cfg(any()/all())` --- src/base.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base.rs b/src/base.rs index a0bee4e182147..ac5b3c2407851 100644 --- a/src/base.rs +++ b/src/base.rs @@ -167,7 +167,7 @@ pub(crate) fn compile_fn( context.clear(); context.func = codegened_func.func; - #[cfg(any())] // This is never true + #[cfg(false)] let _clif_guard = { use std::fmt::Write; From d55b61a684a8dd525883091f7ddbeb433e6cc30b Mon Sep 17 00:00:00 2001 From: Urgau Date: Sat, 6 Dec 2025 11:31:46 +0100 Subject: [PATCH 06/17] Adapt `cg_cranelift` to the overhauled filename handling --- src/debuginfo/line_info.rs | 7 +++++-- src/debuginfo/mod.rs | 22 ++++++++++------------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/debuginfo/line_info.rs b/src/debuginfo/line_info.rs index db58ee8909113..12b0d5ec4963b 100644 --- a/src/debuginfo/line_info.rs +++ b/src/debuginfo/line_info.rs @@ -6,7 +6,10 @@ use std::path::{Component, Path}; use cranelift_codegen::MachSrcLoc; use cranelift_codegen::binemit::CodeOffset; use gimli::write::{FileId, FileInfo, LineProgram, LineString, LineStringTable}; -use rustc_span::{FileName, Pos, SourceFile, SourceFileAndLine, SourceFileHashAlgorithm, hygiene}; +use rustc_span::{ + FileName, Pos, RemapPathScopeComponents, SourceFile, SourceFileAndLine, + SourceFileHashAlgorithm, hygiene, +}; use crate::debuginfo::FunctionDebugContext; use crate::debuginfo::emit::address_for_func; @@ -95,7 +98,7 @@ impl DebugContext { match &source_file.name { FileName::Real(path) => { let (dir_path, file_name) = - split_path_dir_and_file(path.to_path(self.filename_display_preference)); + split_path_dir_and_file(path.path(RemapPathScopeComponents::DEBUGINFO)); let dir_name = osstr_as_utf8_bytes(dir_path.as_os_str()); let file_name = osstr_as_utf8_bytes(file_name); diff --git a/src/debuginfo/mod.rs b/src/debuginfo/mod.rs index 8c43db92fe05f..0cd510037293d 100644 --- a/src/debuginfo/mod.rs +++ b/src/debuginfo/mod.rs @@ -21,7 +21,7 @@ use rustc_hir::def::DefKind; use rustc_hir::def_id::DefIdMap; use rustc_session::Session; use rustc_session::config::DebugInfo; -use rustc_span::{FileNameDisplayPreference, SourceFileHash, StableSourceFileId}; +use rustc_span::{RemapPathScopeComponents, SourceFileHash, StableSourceFileId}; use rustc_target::callconv::FnAbi; pub(crate) use self::emit::{DebugReloc, DebugRelocName}; @@ -44,7 +44,6 @@ pub(crate) struct DebugContext { namespace_map: DefIdMap, array_size_type: Option, - filename_display_preference: FileNameDisplayPreference, embed_source: bool, } @@ -102,18 +101,18 @@ impl DebugContext { let mut dwarf = DwarfUnit::new(encoding); - use rustc_session::config::RemapPathScopeComponents; - - let filename_display_preference = - tcx.sess.filename_display_preference(RemapPathScopeComponents::DEBUGINFO); - let producer = producer(tcx.sess); - let comp_dir = - tcx.sess.opts.working_dir.to_string_lossy(filename_display_preference).to_string(); + let comp_dir = tcx + .sess + .source_map() + .working_dir() + .path(RemapPathScopeComponents::DEBUGINFO) + .to_string_lossy(); let (name, file_info) = match tcx.sess.local_crate_source_file() { Some(path) => { - let name = path.to_string_lossy(filename_display_preference).to_string(); + let name = + path.path(RemapPathScopeComponents::DEBUGINFO).to_string_lossy().into_owned(); (name, None) } None => (tcx.crate_name(LOCAL_CRATE).to_string(), None), @@ -137,7 +136,7 @@ impl DebugContext { { let name = dwarf.strings.add(format!("{name}/@/{cgu_name}")); - let comp_dir = dwarf.strings.add(comp_dir); + let comp_dir = dwarf.strings.add(&*comp_dir); let root = dwarf.unit.root(); let root = dwarf.unit.get_mut(root); @@ -180,7 +179,6 @@ impl DebugContext { stack_pointer_register, namespace_map: DefIdMap::default(), array_size_type, - filename_display_preference, embed_source, }) } From 4d011efb8e418babc9337a24791462608a39d97e Mon Sep 17 00:00:00 2001 From: Urgau <3616612+Urgau@users.noreply.github.com> Date: Fri, 12 Dec 2025 18:13:08 +0100 Subject: [PATCH 07/17] Remove `[no-mentions]` handler in the triagebot config https://github.blog/changelog/2025-11-07-removing-notifications-for-mentions-in-commit-messages/ --- triagebot.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/triagebot.toml b/triagebot.toml index 13da0a87def3c..eb0c7b011f605 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -2,6 +2,3 @@ # Prevents un-canonicalized issue links (to avoid wrong issues being linked in r-l/rust) [issue-links] - -# Prevents mentions in commits to avoid users being spammed -[no-mentions] From e3f9bcef746096612567eb200f0695eaee152fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Tue, 9 Dec 2025 00:43:46 +0000 Subject: [PATCH 08/17] Use `let...else` instead of `match foo { ... _ => return };` and `if let ... else return` --- src/debuginfo/unwind.rs | 6 ++---- src/optimize/peephole.rs | 6 +----- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/debuginfo/unwind.rs b/src/debuginfo/unwind.rs index ecaf88a26259e..33ffe4cc4e9c8 100644 --- a/src/debuginfo/unwind.rs +++ b/src/debuginfo/unwind.rs @@ -130,11 +130,9 @@ impl UnwindContext { return; } - let unwind_info = if let Some(unwind_info) = + let Some(unwind_info) = context.compiled_code().unwrap().create_unwind_info(module.isa()).unwrap() - { - unwind_info - } else { + else { return; }; diff --git a/src/optimize/peephole.rs b/src/optimize/peephole.rs index c93fe93521033..f38c1f96e6ed5 100644 --- a/src/optimize/peephole.rs +++ b/src/optimize/peephole.rs @@ -29,11 +29,7 @@ pub(crate) fn maybe_known_branch_taken( arg: Value, test_zero: bool, ) -> Option { - let arg_inst = if let ValueDef::Result(arg_inst, 0) = bcx.func.dfg.value_def(arg) { - arg_inst - } else { - return None; - }; + let ValueDef::Result(arg_inst, 0) = bcx.func.dfg.value_def(arg) else { return None }; match bcx.func.dfg.insts[arg_inst] { InstructionData::UnaryImm { opcode: Opcode::Iconst, imm } => { From 6a821c5518a81145048faccf619b211eb7c23c2f Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Sat, 13 Dec 2025 15:18:07 +0100 Subject: [PATCH 09/17] simplify how inline asm handles `MaybeUninit` --- src/inline_asm.rs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/inline_asm.rs b/src/inline_asm.rs index 08cabe9d695c3..ac0da06cbb8e3 100644 --- a/src/inline_asm.rs +++ b/src/inline_asm.rs @@ -857,19 +857,9 @@ fn call_inline_asm<'tcx>( fn asm_clif_type<'tcx>(fx: &FunctionCx<'_, '_, 'tcx>, ty: Ty<'tcx>) -> Option { match ty.kind() { - // Adapted from https://github.com/rust-lang/rust/blob/f3c66088610c1b80110297c2d9a8b5f9265b013f/compiler/rustc_hir_analysis/src/check/intrinsicck.rs#L136-L151 + // Adapted from https://github.com/rust-lang/rust/blob/df44a57fd29fca899ce473f85ed64efd0708dd7c/compiler/rustc_hir_typeck/src/inline_asm.rs#L180-L183 ty::Adt(adt, args) if fx.tcx.is_lang_item(adt.did(), LangItem::MaybeUninit) => { - let fields = &adt.non_enum_variant().fields; - let ty = fields[FieldIdx::ONE].ty(fx.tcx, args); - let ty::Adt(ty, args) = ty.kind() else { - unreachable!("expected first field of `MaybeUninit` to be an ADT") - }; - assert!( - ty.is_manually_drop(), - "expected first field of `MaybeUninit` to be `ManuallyDrop`" - ); - let fields = &ty.non_enum_variant().fields; - let ty = fields[FieldIdx::ZERO].ty(fx.tcx, args); + let ty = args.type_at(0); fx.clif_type(ty) } _ => fx.clif_type(ty), From 4748c5372077eb7ce4fc080769f974a5ea222de9 Mon Sep 17 00:00:00 2001 From: Opstic <46141527+opstic@users.noreply.github.com> Date: Sun, 14 Dec 2025 05:53:13 -0500 Subject: [PATCH 10/17] Add `llvm.x86.vcvtps2ph.128` (#1613) * Add `llvm.x86.vcvtps2ph.128` * `cargo fmt` * Test `_mm_cvtps_ph` --- example/std_example.rs | 18 ++++++++++++++++++ src/intrinsics/llvm_x86.rs | 29 +++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/example/std_example.rs b/example/std_example.rs index c569ef0ef8297..33db75f0943a9 100644 --- a/example/std_example.rs +++ b/example/std_example.rs @@ -259,6 +259,9 @@ unsafe fn test_simd() { test_mm_cvttps_epi32(); test_mm_cvtsi128_si64(); + #[cfg(not(jit))] + test_mm_cvtps_ph(); + test_mm_extract_epi8(); test_mm_insert_epi16(); test_mm_shuffle_epi8(); @@ -558,6 +561,21 @@ unsafe fn test_mm_cvttps_epi32() { } } +#[cfg(target_arch = "x86_64")] +#[target_feature(enable = "f16c")] +#[cfg(not(jit))] +unsafe fn test_mm_cvtps_ph() { + const F16_ONE: i16 = 0x3c00; + const F16_TWO: i16 = 0x4000; + const F16_THREE: i16 = 0x4200; + const F16_FOUR: i16 = 0x4400; + + let a = _mm_set_ps(1.0, 2.0, 3.0, 4.0); + let r = _mm_cvtps_ph::<_MM_FROUND_CUR_DIRECTION>(a); + let e = _mm_set_epi16(0, 0, 0, 0, F16_ONE, F16_TWO, F16_THREE, F16_FOUR); + assert_eq_m128i(r, e); +} + fn test_checked_mul() { let u: Option = u8::from_str_radix("1000", 10).ok(); assert_eq!(u, None); diff --git a/src/intrinsics/llvm_x86.rs b/src/intrinsics/llvm_x86.rs index 37fbe4be1b0fe..61f48fa977435 100644 --- a/src/intrinsics/llvm_x86.rs +++ b/src/intrinsics/llvm_x86.rs @@ -1313,6 +1313,35 @@ pub(super) fn codegen_x86_llvm_intrinsic_call<'tcx>( ret.write_cvalue_transmute(fx, res); } + "llvm.x86.vcvtps2ph.128" => { + // https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_cvtps_ph + intrinsic_args!(fx, args => (a, _imm8); intrinsic); + let a = a.load_scalar(fx); + + let imm8 = + if let Some(imm8) = crate::constant::mir_operand_get_const_val(fx, &args[1].node) { + imm8 + } else { + fx.tcx + .dcx() + .span_fatal(span, "Index argument for `_mm_cvtps_ph` is not a constant"); + }; + + let imm8 = imm8.to_u32(); + + codegen_inline_asm_inner( + fx, + &[InlineAsmTemplatePiece::String(format!("vcvtps2ph xmm0, xmm0, {imm8}").into())], + &[CInlineAsmOperand::InOut { + reg: InlineAsmRegOrRegClass::Reg(InlineAsmReg::X86(X86InlineAsmReg::xmm0)), + _late: true, + in_value: a, + out_place: Some(ret), + }], + InlineAsmOptions::NOSTACK | InlineAsmOptions::PURE | InlineAsmOptions::NOMEM, + ); + } + _ => { fx.tcx .dcx() From b9839eb105204f665e8675689c49b26a3d8fdcdd Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 16 Dec 2025 16:13:22 +0000 Subject: [PATCH 11/17] Rustup to rustc 1.94.0-nightly (21ff67df1 2025-12-15) --- rust-toolchain | 2 +- src/driver/jit.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rust-toolchain b/rust-toolchain index 461dbcdb0fb5d..61ef39d75ffc0 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2025-12-08" +channel = "nightly-2025-12-16" components = ["rust-src", "rustc-dev", "llvm-tools"] profile = "minimal" diff --git a/src/driver/jit.rs b/src/driver/jit.rs index 9dba46363936f..3a8ca25a5fc00 100644 --- a/src/driver/jit.rs +++ b/src/driver/jit.rs @@ -190,7 +190,7 @@ fn dep_symbol_lookup_fn( diag.emit(); } Linkage::Dynamic => { - dylib_paths.push(src.dylib.as_ref().unwrap().0.clone()); + dylib_paths.push(src.dylib.as_ref().unwrap().clone()); } } } From b73270f189cfe1f2c4bfbf9dda70f300ee8ed0bb Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 16 Dec 2025 16:40:44 +0000 Subject: [PATCH 12/17] Fix rustc test suite --- scripts/test_rustc_tests.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/test_rustc_tests.sh b/scripts/test_rustc_tests.sh index b5af585a732e3..570ac434b97e2 100755 --- a/scripts/test_rustc_tests.sh +++ b/scripts/test_rustc_tests.sh @@ -70,6 +70,7 @@ rm tests/ui/linking/no-gc-encapsulation-symbols.rs # same rm tests/ui/attributes/fn-align-dyn.rs # per-function alignment not supported rm -r tests/ui/explicit-tail-calls # tail calls rm -r tests/run-make/pointer-auth-link-with-c # pointer auth +rm -r tests/ui/eii # EII not yet implemented # requires LTO rm -r tests/run-make/cdylib @@ -143,6 +144,14 @@ 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 # genuine bugs # ============ From 49f1fa5110846d1ffec4e5557961a4a9a1b4334e Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 16 Dec 2025 16:42:17 +0000 Subject: [PATCH 13/17] Unconditionally install rustfmt Rustfmt used to be optional for nightlies long ago, but it is now always present. Also rename rust-toolchain to rust-toolchain.toml. --- .github/workflows/main.yml | 8 ++++---- .github/workflows/rustc.yml | 4 ++-- rust-toolchain | 4 ---- rust-toolchain.toml | 4 ++++ scripts/rustup.sh | 5 ++--- 5 files changed, 12 insertions(+), 13 deletions(-) delete mode 100644 rust-toolchain create mode 100644 rust-toolchain.toml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0930b924d1773..07d9af4a9b54a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: - name: Avoid installing rustc-dev run: | - sed -i 's/components.*/components = ["rustfmt"]/' rust-toolchain + sed -i 's/components.*/components = ["rustfmt"]/' rust-toolchain.toml rustfmt -v - name: Rustfmt @@ -88,7 +88,7 @@ jobs: uses: actions/cache@v4 with: path: build/cg_clif - key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }} + key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain.toml', '**/Cargo.lock') }} - name: Set MinGW as the default toolchain if: matrix.os == 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu' @@ -158,7 +158,7 @@ jobs: uses: actions/cache@v4 with: path: build/cg_clif - key: ${{ runner.os }}-x86_64-unknown-linux-gnu-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }} + key: ${{ runner.os }}-x86_64-unknown-linux-gnu-cargo-build-target-${{ hashFiles('rust-toolchain.toml', '**/Cargo.lock') }} - name: Install hyperfine run: | @@ -207,7 +207,7 @@ jobs: uses: actions/cache@v4 with: path: build/cg_clif - key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-dist-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }} + key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-dist-cargo-build-target-${{ hashFiles('rust-toolchain.toml', '**/Cargo.lock') }} - name: Set MinGW as the default toolchain if: matrix.os == 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu' diff --git a/.github/workflows/rustc.yml b/.github/workflows/rustc.yml index 9253ab96353c3..b22725fdc9d41 100644 --- a/.github/workflows/rustc.yml +++ b/.github/workflows/rustc.yml @@ -20,7 +20,7 @@ jobs: uses: actions/cache@v4 with: path: build/cg_clif - key: ${{ runner.os }}-rustc-test-cargo-build-target-${{ hashFiles('rust-toolchain', 'Cargo.lock') }} + key: ${{ runner.os }}-rustc-test-cargo-build-target-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }} - name: Test run: ./scripts/test_bootstrap.sh @@ -40,7 +40,7 @@ jobs: uses: actions/cache@v4 with: path: build/cg_clif - key: ${{ runner.os }}-rustc-test-cargo-build-target-${{ hashFiles('rust-toolchain', 'Cargo.lock') }} + key: ${{ runner.os }}-rustc-test-cargo-build-target-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }} - name: Install ripgrep run: | diff --git a/rust-toolchain b/rust-toolchain deleted file mode 100644 index 61ef39d75ffc0..0000000000000 --- a/rust-toolchain +++ /dev/null @@ -1,4 +0,0 @@ -[toolchain] -channel = "nightly-2025-12-16" -components = ["rust-src", "rustc-dev", "llvm-tools"] -profile = "minimal" diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000000000..4d3fe30e7d47a --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "nightly-2025-12-16" +components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt"] +profile = "minimal" diff --git a/scripts/rustup.sh b/scripts/rustup.sh index 1a82193303e23..e26be307328f0 100755 --- a/scripts/rustup.sh +++ b/scripts/rustup.sh @@ -22,8 +22,7 @@ case $1 in "prepare") echo "=> Installing new nightly" rustup toolchain install --profile minimal "nightly-${TOOLCHAIN}" # Sanity check to see if the nightly exists - sed -i "s/\"nightly-.*\"/\"nightly-${TOOLCHAIN}\"/" rust-toolchain - rustup component add rustfmt || true + sed -i "s/\"nightly-.*\"/\"nightly-${TOOLCHAIN}\"/" rust-toolchain.toml echo "=> Uninstalling all old nightlies" for nightly in $(rustup toolchain list | grep nightly | grep -v "$TOOLCHAIN" | grep -v nightly-x86_64); do @@ -35,7 +34,7 @@ case $1 in ./y.sh prepare ;; "commit") - git add rust-toolchain + git add rust-toolchain.toml git commit -m "Rustup to $(rustc -V)" ;; "push") From bb9dac5fe5889f6c4cfb373388ca0e54413429f9 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 16 Dec 2025 16:49:44 +0000 Subject: [PATCH 14/17] Disable linker plugin lto rustc test --- scripts/test_rustc_tests.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/test_rustc_tests.sh b/scripts/test_rustc_tests.sh index 570ac434b97e2..09de603efa117 100755 --- a/scripts/test_rustc_tests.sh +++ b/scripts/test_rustc_tests.sh @@ -79,6 +79,7 @@ rm -r tests/run-make/lto-* rm -r tests/run-make/reproducible-build-2 rm -r tests/run-make/no-builtins-lto rm -r tests/run-make/reachable-extern-fn-available-lto +rm -r tests/run-make/no-builtins-linker-plugin-lto # coverage instrumentation rm tests/ui/consts/precise-drop-with-coverage.rs From 3822cf126bf004c9c9a5db6609f32e7758ea3427 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 16 Dec 2025 17:00:09 +0000 Subject: [PATCH 15/17] Disable a bunch of rustc tests that fail with --panic-unwind-support --- scripts/test_rustc_tests.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/scripts/test_rustc_tests.sh b/scripts/test_rustc_tests.sh index 09de603efa117..69c6099c3ab86 100755 --- a/scripts/test_rustc_tests.sh +++ b/scripts/test_rustc_tests.sh @@ -53,17 +53,21 @@ 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 +# inline assembly features +rm tests/ui/asm/x86_64/issue-96797.rs # const and sym inline asm operands don't work entirely correctly +rm tests/ui/asm/global-asm-mono-sym-fn.rs # same +rm tests/ui/asm/naked-asm-mono-sym-fn.rs # same +rm tests/ui/asm/x86_64/goto.rs # inline asm labels not supported +rm tests/ui/asm/label-operand.rs # same +rm tests/ui/asm/may_unwind.rs # asm unwinding not supported +rm tests/ui/asm/aarch64/may_unwind.rs # same + # misc unimplemented things rm tests/ui/target-feature/missing-plusminus.rs # error not implemented rm -r tests/run-make/repr128-dwarf # debuginfo test rm -r tests/run-make/split-debuginfo # same rm -r tests/run-make/target-specs # i686 not supported by Cranelift rm -r tests/run-make/mismatching-target-triples # same -rm tests/ui/asm/x86_64/issue-96797.rs # const and sym inline asm operands don't work entirely correctly -rm tests/ui/asm/global-asm-mono-sym-fn.rs # same -rm tests/ui/asm/naked-asm-mono-sym-fn.rs # same -rm tests/ui/asm/x86_64/goto.rs # inline asm labels not supported -rm tests/ui/asm/label-operand.rs # same rm tests/ui/simd/simd-bitmask-notpow2.rs # non-pow-of-2 simd vector sizes rm -r tests/run-make/used-proc-macro # used(linker) isn't supported yet rm tests/ui/linking/no-gc-encapsulation-symbols.rs # same @@ -71,6 +75,7 @@ rm tests/ui/attributes/fn-align-dyn.rs # per-function alignment not supported rm -r tests/ui/explicit-tail-calls # tail calls rm -r tests/run-make/pointer-auth-link-with-c # pointer auth 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/run-make/cdylib @@ -89,6 +94,7 @@ rm -r tests/ui/instrument-coverage/ # ================== rm tests/ui/codegen/issue-28950.rs # depends on stack size optimizations rm tests/ui/codegen/init-large-type.rs # same +rm tests/ui/codegen/StackColoring-not-blowup-stack-issue-40883.rs # same rm tests/ui/statics/const_generics.rs # tests an optimization rm tests/ui/linking/executable-no-mangle-strip.rs # requires --gc-sections to work for statics @@ -167,6 +173,7 @@ 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 rm tests/ui/process/process-panic-after-fork.rs # same From 6396521fdbcda3c9e79dd7c6f698d6589eeaf5ce Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Thu, 18 Dec 2025 10:52:32 +0000 Subject: [PATCH 16/17] Rustup to rustc 1.94.0-nightly (f794a0873 2025-12-17) --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 4d3fe30e7d47a..6ce49eb4ccf07 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2025-12-16" +channel = "nightly-2025-12-18" components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt"] profile = "minimal" From 8de4afd39ba48f25be98684cdb7a96ec6da89d10 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Thu, 18 Dec 2025 11:09:12 +0000 Subject: [PATCH 17/17] Fix rustc testsuite --- scripts/test_rustc_tests.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/test_rustc_tests.sh b/scripts/test_rustc_tests.sh index 69c6099c3ab86..b25269d1430ae 100755 --- a/scripts/test_rustc_tests.sh +++ b/scripts/test_rustc_tests.sh @@ -35,6 +35,7 @@ git checkout -- tests/ui/entry-point/auxiliary/bad_main_functions.rs rm tests/ui/asm/x86_64/evex512-implicit-feature.rs # unimplemented AVX512 x86 vendor intrinsic rm tests/ui/simd/dont-invalid-bitcast-x86_64.rs # unimplemented llvm.x86.sse41.round.ps rm tests/ui/simd/intrinsic/generic-arithmetic-pass.rs # unimplemented simd_funnel_{shl,shr} +rm -r tests/ui/scalable-vectors # scalable vectors are unsupported # exotic linkages rm tests/incremental/hashes/function_interfaces.rs @@ -159,6 +160,7 @@ 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 # genuine bugs # ============