From 57ff4cb8dbcac906acb67f36e7f5e99ef6f944a4 Mon Sep 17 00:00:00 2001 From: firestar99 Date: Thu, 16 Jul 2026 15:11:02 +0200 Subject: [PATCH 01/11] update to nightly-2026-07-16, failing compiletests --- crates/rustc_codegen_spirv/build.rs | 4 ++-- crates/rustc_codegen_spirv/src/abi.rs | 6 +++--- crates/rustc_codegen_spirv/src/attr.rs | 4 ++-- .../rustc_codegen_spirv/src/builder/builder_methods.rs | 2 +- crates/rustc_codegen_spirv/src/builder/intrinsics.rs | 7 ++----- crates/rustc_codegen_spirv/src/codegen_cx/constant.rs | 7 +++---- crates/rustc_codegen_spirv/src/codegen_cx/mod.rs | 10 +++++++--- crates/rustc_codegen_spirv/src/codegen_cx/type_.rs | 4 ++-- crates/rustc_codegen_spirv/src/lib.rs | 3 ++- rust-toolchain.toml | 4 ++-- tests/compiletests/ui/dis/ptr_copy.normal.stderr | 8 ++++---- tests/compiletests/ui/dis/ptr_read.stderr | 2 +- tests/compiletests/ui/dis/ptr_read_method.stderr | 2 +- tests/compiletests/ui/dis/ptr_write.stderr | 2 +- tests/compiletests/ui/dis/ptr_write_method.stderr | 2 +- tests/difftests/runner/src/differ.rs | 2 -- 16 files changed, 34 insertions(+), 35 deletions(-) diff --git a/crates/rustc_codegen_spirv/build.rs b/crates/rustc_codegen_spirv/build.rs index 16d67c37838..819a31c8299 100644 --- a/crates/rustc_codegen_spirv/build.rs +++ b/crates/rustc_codegen_spirv/build.rs @@ -19,9 +19,9 @@ use std::{env, fs, mem}; /// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/ //const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain.toml"); const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain] -channel = "nightly-2026-07-03" +channel = "nightly-2026-07-16" components = ["rust-src", "rustc-dev", "llvm-tools"] -# commit_hash = c397dae808f70caebab1fc4e11b3edf7e59f58c7"#; +# commit_hash = d0babd8b6b05ef9bb65d42f928cef4129d64cf65"#; fn rustc_output(arg: &str) -> Result> { let rustc = env::var("RUSTC").unwrap_or_else(|_| "rustc".into()); diff --git a/crates/rustc_codegen_spirv/src/abi.rs b/crates/rustc_codegen_spirv/src/abi.rs index 781f48efb28..0dafc0bf355 100644 --- a/crates/rustc_codegen_spirv/src/abi.rs +++ b/crates/rustc_codegen_spirv/src/abi.rs @@ -87,7 +87,7 @@ pub(crate) fn provide(providers: &mut Providers) { fn_abi: &'tcx FnAbi<'tcx, Ty<'tcx>>, ) -> &'tcx FnAbi<'tcx, Ty<'tcx>> { let readjust_arg_abi = |arg: &ArgAbi<'tcx, Ty<'tcx>>| { - let mut arg = ArgAbi::new(&tcx, arg.layout, |_, _| ArgAttributes::new()); + let mut arg = ArgAbi::new(arg.layout, |_, _| ArgAttributes::new()); // FIXME: this is bad! https://github.com/rust-lang/rust/issues/115666 // arg.make_direct_deprecated(); @@ -382,7 +382,7 @@ impl<'tcx> ConvSpirvType<'tcx> for TyAndLayout<'tcx> { } .def_with_name(cx, span, TyLayoutNameKey::from(*self)), BackendRepr::Scalar(scalar) => trans_scalar(cx, span, *self, scalar, Size::ZERO), - BackendRepr::ScalarPair(a, b) => { + BackendRepr::ScalarPair { a, b, .. } => { // NOTE(eddyb) unlike `BackendRepr::Scalar`'s simpler newtype-unpacking // behavior, `BackendRepr::ScalarPair` can be composed in two ways: // * two `BackendRepr::Scalar` fields (and any number of ZST fields), @@ -485,7 +485,7 @@ pub fn scalar_pair_element_backend_type<'tcx>( index: usize, ) -> Word { let [a, b] = match ty.backend_repr { - BackendRepr::ScalarPair(a, b) => [a, b], + BackendRepr::ScalarPair { a, b, .. } => [a, b], other => span_bug!( span, "scalar_pair_element_backend_type invalid abi: {:?}", diff --git a/crates/rustc_codegen_spirv/src/attr.rs b/crates/rustc_codegen_spirv/src/attr.rs index ae1651120b6..4698aae0fa2 100644 --- a/crates/rustc_codegen_spirv/src/attr.rs +++ b/crates/rustc_codegen_spirv/src/attr.rs @@ -7,7 +7,7 @@ use crate::symbols::Symbols; use rspirv::spirv::{BuiltIn, ExecutionMode, ExecutionModel, StorageClass}; use rustc_ast::{LitKind, MetaItemInner, MetaItemLit}; use rustc_hir as hir; -use rustc_hir::def_id::LocalModDefId; +use rustc_hir::def_id::LocalModId; use rustc_hir::intravisit::{self, Visitor}; use rustc_hir::{Attribute, CRATE_HIR_ID, HirId, MethodKind, Target}; use rustc_middle::hir::nested_filter; @@ -503,7 +503,7 @@ impl<'tcx> Visitor<'tcx> for CheckSpirvAttrVisitor<'tcx> { } // FIXME(eddyb) DRY this somehow and make it reusable from somewhere in `rustc`. -fn check_mod_attrs(tcx: TyCtxt<'_>, module_def_id: LocalModDefId) { +fn check_mod_attrs(tcx: TyCtxt<'_>, module_def_id: LocalModId) { let check_spirv_attr_visitor = &mut CheckSpirvAttrVisitor { tcx, sym: Symbols::get(), diff --git a/crates/rustc_codegen_spirv/src/builder/builder_methods.rs b/crates/rustc_codegen_spirv/src/builder/builder_methods.rs index b2b50694428..129fe24b11a 100644 --- a/crates/rustc_codegen_spirv/src/builder/builder_methods.rs +++ b/crates/rustc_codegen_spirv/src/builder/builder_methods.rs @@ -1924,7 +1924,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> { place.val.align, ); OperandValue::Immediate(llval) - } else if let BackendRepr::ScalarPair(a, b) = place.layout.backend_repr { + } else if let BackendRepr::ScalarPair { a, b, .. } = place.layout.backend_repr { let b_offset = a .primitive() .size(self) diff --git a/crates/rustc_codegen_spirv/src/builder/intrinsics.rs b/crates/rustc_codegen_spirv/src/builder/intrinsics.rs index a188400f5bc..622347b8a08 100644 --- a/crates/rustc_codegen_spirv/src/builder/intrinsics.rs +++ b/crates/rustc_codegen_spirv/src/builder/intrinsics.rs @@ -77,7 +77,7 @@ impl<'a, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'tcx> { let callee_ty = instance.ty(self.tcx, TypingEnv::fully_monomorphized()); let (def_id, fn_args) = match *callee_ty.kind() { - FnDef(def_id, fn_args) => (def_id, fn_args), + FnDef(def_id, fn_args) => (def_id, fn_args.skip_binder()), _ => bug!("expected fn item type, found {}", callee_ty), }; @@ -360,10 +360,7 @@ impl<'a, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'tcx> { _ => { // Call the fallback body instead of generating the intrinsic code - return IntrinsicResult::Fallback(Instance::new_raw( - instance.def_id(), - instance.args, - )); + return IntrinsicResult::Fallback(Instance::new_raw(def_id, instance.args)); } }; diff --git a/crates/rustc_codegen_spirv/src/codegen_cx/constant.rs b/crates/rustc_codegen_spirv/src/codegen_cx/constant.rs index d4f0cbbb3a3..0ef855f63d7 100644 --- a/crates/rustc_codegen_spirv/src/codegen_cx/constant.rs +++ b/crates/rustc_codegen_spirv/src/codegen_cx/constant.rs @@ -8,11 +8,10 @@ use crate::spirv_type::SpirvType; use itertools::Itertools as _; use rspirv::spirv::Word; use rustc_abi::{self as abi, AddressSpace, Float, HasDataLayout, Integer, Primitive, Size}; -use rustc_codegen_ssa::traits::{ - ConstCodegenMethods, MiscCodegenMethods, PacMetadata, StaticCodegenMethods, -}; +use rustc_codegen_ssa::traits::{ConstCodegenMethods, MiscCodegenMethods, StaticCodegenMethods}; use rustc_middle::mir::interpret::{AllocError, ConstAllocation, GlobalAlloc, Scalar, alloc_range}; use rustc_middle::ty::layout::LayoutOf; +use rustc_session::PointerAuthSchema; use rustc_span::{DUMMY_SP, Span}; impl<'tcx> CodegenCx<'tcx> { @@ -233,7 +232,7 @@ impl ConstCodegenMethods for CodegenCx<'_> { cv: Scalar, layout: rustc_abi::Scalar, ty: Self::Type, - _pac: Option, + _pac: Option<&PointerAuthSchema>, ) -> Self::Value { self.scalar_to_backend(cv, layout, ty) } diff --git a/crates/rustc_codegen_spirv/src/codegen_cx/mod.rs b/crates/rustc_codegen_spirv/src/codegen_cx/mod.rs index f08cdb819f8..236bc5f4adf 100644 --- a/crates/rustc_codegen_spirv/src/codegen_cx/mod.rs +++ b/crates/rustc_codegen_spirv/src/codegen_cx/mod.rs @@ -23,14 +23,14 @@ use rustc_abi::{AddressSpace, HasDataLayout, TargetDataLayout}; use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_codegen_ssa::traits::{ AsmCodegenMethods, BackendTypes, DebugInfoCodegenMethods, GlobalAsmOperandRef, - MiscCodegenMethods, PacMetadata, + MiscCodegenMethods, }; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir::def_id::DefId; use rustc_middle::mono::CodegenUnit; use rustc_middle::ty::layout::{HasTyCtxt, HasTypingEnv}; use rustc_middle::ty::{self, Instance, Ty, TyCtxt, TypingEnv}; -use rustc_session::Session; +use rustc_session::{PointerAuthSchema, Session}; use rustc_span::symbol::Symbol; use rustc_span::{DUMMY_SP, Span}; use rustc_target::spec::{HasTargetSpec, Target, TargetTuple}; @@ -908,7 +908,11 @@ impl<'tcx> MiscCodegenMethods<'tcx> for CodegenCx<'tcx> { // NOTE(eddyb) see the comment on `SpirvValueKind::FnAddr`, this should // be fixed upstream, so we never see any "function pointer" values being // created just to perform direct calls. - fn get_fn_addr(&self, instance: Instance<'tcx>, _pac: Option) -> Self::Value { + fn get_fn_addr( + &self, + instance: Instance<'tcx>, + _pac: Option<&PointerAuthSchema>, + ) -> Self::Value { let function = self.get_fn(instance); let span = self.tcx.def_span(instance.def_id()); diff --git a/crates/rustc_codegen_spirv/src/codegen_cx/type_.rs b/crates/rustc_codegen_spirv/src/codegen_cx/type_.rs index c2ef34ee283..e9a3f95c383 100644 --- a/crates/rustc_codegen_spirv/src/codegen_cx/type_.rs +++ b/crates/rustc_codegen_spirv/src/codegen_cx/type_.rs @@ -99,14 +99,14 @@ impl<'tcx> LayoutTypeCodegenMethods<'tcx> for CodegenCx<'tcx> { BackendRepr::Scalar(_) | BackendRepr::SimdScalableVector { .. } | BackendRepr::SimdVector { .. } => true, - BackendRepr::ScalarPair(..) => false, + BackendRepr::ScalarPair { .. } => false, BackendRepr::Memory { .. } => layout.is_zst(), } } fn is_backend_scalar_pair(&self, layout: TyAndLayout<'tcx>) -> bool { match layout.backend_repr { - BackendRepr::ScalarPair(..) => true, + BackendRepr::ScalarPair { .. } => true, BackendRepr::Scalar(_) | BackendRepr::SimdScalableVector { .. } | BackendRepr::SimdVector { .. } diff --git a/crates/rustc_codegen_spirv/src/lib.rs b/crates/rustc_codegen_spirv/src/lib.rs index df16829a6be..4e72b8584a1 100644 --- a/crates/rustc_codegen_spirv/src/lib.rs +++ b/crates/rustc_codegen_spirv/src/lib.rs @@ -2,10 +2,11 @@ #![feature(deref_patterns)] #![feature(file_buffered)] #![feature(negative_impls)] -#![feature(string_from_utf8_lossy_owned)] +#![feature(option_into_flat_iter)] #![feature(trait_alias)] #![feature(try_blocks)] #![recursion_limit = "256"] +#![cfg_attr(bootstrap, feature(string_from_utf8_lossy_owned))] // HACK(eddyb) end of `rustc_codegen_ssa` crate-level attributes (see `build.rs`). //! Welcome to the API documentation for the `rust-gpu` project, this API is diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 3e36ae224b4..2e61e578ccc 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,7 +1,7 @@ [toolchain] -channel = "nightly-2026-07-03" +channel = "nightly-2026-07-16" components = ["rust-src", "rustc-dev", "llvm-tools"] -# commit_hash = c397dae808f70caebab1fc4e11b3edf7e59f58c7 +# commit_hash = d0babd8b6b05ef9bb65d42f928cef4129d64cf65 # Whenever changing the nightly channel, update the commit hash above, and # change `REQUIRED_RUST_TOOLCHAIN` in `crates/rustc_codegen_spirv/build.rs` too. diff --git a/tests/compiletests/ui/dis/ptr_copy.normal.stderr b/tests/compiletests/ui/dis/ptr_copy.normal.stderr index e4fd211dcca..a01ff97c7c6 100644 --- a/tests/compiletests/ui/dis/ptr_copy.normal.stderr +++ b/tests/compiletests/ui/dis/ptr_copy.normal.stderr @@ -1,11 +1,11 @@ error: cannot memcpy dynamically sized data - --> <$CORE_SRC/ptr/mod.rs>:642:9 + --> <$CORE_SRC/ptr/mod.rs>:640:9 | LL | crate::intrinsics::copy(src, dst, count) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: used from within `core::ptr::copy::` - --> <$CORE_SRC/ptr/mod.rs>:627:21 + --> <$CORE_SRC/ptr/mod.rs>:625:21 | LL | pub const unsafe fn copy(src: *const T, dst: *mut T, count: usize) { | ^^^^ @@ -28,7 +28,7 @@ LL | pub fn main(i: f32, o: &mut f32) { error: cannot cast between pointer types from `*f32` to `*struct () { }` - --> <$CORE_SRC/ptr/mod.rs>:630:9 + --> <$CORE_SRC/ptr/mod.rs>:628:9 | LL | / ub_checks::assert_unsafe_precondition!( LL | | check_language_ub, @@ -39,7 +39,7 @@ LL | | ); | |_________^ | note: used from within `core::ptr::copy::` - --> <$CORE_SRC/ptr/mod.rs>:630:9 + --> <$CORE_SRC/ptr/mod.rs>:628:9 | LL | / ub_checks::assert_unsafe_precondition!( LL | | check_language_ub, diff --git a/tests/compiletests/ui/dis/ptr_read.stderr b/tests/compiletests/ui/dis/ptr_read.stderr index 944037e5252..c719253ddeb 100644 --- a/tests/compiletests/ui/dis/ptr_read.stderr +++ b/tests/compiletests/ui/dis/ptr_read.stderr @@ -2,7 +2,7 @@ %4 = OpFunctionParameter %5 %6 = OpFunctionParameter %5 %7 = OpLabel - OpLine %8 1733 8 + OpLine %8 1731 8 %9 = OpLoad %10 %4 OpLine %11 7 13 OpStore %6 %9 diff --git a/tests/compiletests/ui/dis/ptr_read_method.stderr b/tests/compiletests/ui/dis/ptr_read_method.stderr index 944037e5252..c719253ddeb 100644 --- a/tests/compiletests/ui/dis/ptr_read_method.stderr +++ b/tests/compiletests/ui/dis/ptr_read_method.stderr @@ -2,7 +2,7 @@ %4 = OpFunctionParameter %5 %6 = OpFunctionParameter %5 %7 = OpLabel - OpLine %8 1733 8 + OpLine %8 1731 8 %9 = OpLoad %10 %4 OpLine %11 7 13 OpStore %6 %9 diff --git a/tests/compiletests/ui/dis/ptr_write.stderr b/tests/compiletests/ui/dis/ptr_write.stderr index f83f52d41af..35af9a8a355 100644 --- a/tests/compiletests/ui/dis/ptr_write.stderr +++ b/tests/compiletests/ui/dis/ptr_write.stderr @@ -4,7 +4,7 @@ %7 = OpLabel OpLine %8 7 35 %9 = OpLoad %10 %4 - OpLine %11 1941 40 + OpLine %11 1939 40 OpStore %6 %9 OpNoLine OpReturn diff --git a/tests/compiletests/ui/dis/ptr_write_method.stderr b/tests/compiletests/ui/dis/ptr_write_method.stderr index d29b867dff5..c042a20be7b 100644 --- a/tests/compiletests/ui/dis/ptr_write_method.stderr +++ b/tests/compiletests/ui/dis/ptr_write_method.stderr @@ -4,7 +4,7 @@ %7 = OpLabel OpLine %8 7 37 %9 = OpLoad %10 %4 - OpLine %11 1941 40 + OpLine %11 1939 40 OpStore %6 %9 OpNoLine OpReturn diff --git a/tests/difftests/runner/src/differ.rs b/tests/difftests/runner/src/differ.rs index 66c3e000402..592046dd175 100644 --- a/tests/difftests/runner/src/differ.rs +++ b/tests/difftests/runner/src/differ.rs @@ -302,7 +302,6 @@ impl Default for NumericDiffer { } impl OutputDiffer for NumericDiffer { - #[expect(clippy::chunks_exact_to_as_chunks)] fn compare(&self, output1: &[u8], output2: &[u8], epsilon: Option) -> Vec { if output1.len() != output2.len() { return vec![Difference { @@ -451,7 +450,6 @@ impl DifferenceDisplay for NumericDiffer { self.format_table(diffs, pkg1, pkg2) } - #[expect(clippy::chunks_exact_to_as_chunks)] fn write_human_readable(&self, output: &[u8], path: &std::path::Path) -> std::io::Result<()> { use std::io::Write; let mut file = std::fs::File::create(path)?; From b4b540c8191c02a8ae7c65cc2ff0730a1dac1a75 Mon Sep 17 00:00:00 2001 From: firestar99 Date: Thu, 16 Jul 2026 15:11:02 +0200 Subject: [PATCH 02/11] failing compiletests, rustc seems to change types? --- .../subgroup_composite_all_equals.stderr | 37 +++++++++++-------- .../core/ref/member_ref_arg_tuples.stderr | 16 +++++++- 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/tests/compiletests/ui/arch/subgroup/subgroup_composite_all_equals.stderr b/tests/compiletests/ui/arch/subgroup/subgroup_composite_all_equals.stderr index 08ae7961ea4..ced7a20296a 100644 --- a/tests/compiletests/ui/arch/subgroup/subgroup_composite_all_equals.stderr +++ b/tests/compiletests/ui/arch/subgroup/subgroup_composite_all_equals.stderr @@ -1,15 +1,22 @@ - %1 = OpFunction %2 None %3 - %4 = OpFunctionParameter %5 - %6 = OpLabel - %8 = OpCompositeExtract %9 %4 0 - %11 = OpGroupNonUniformAllEqual %2 %12 %8 - %13 = OpLogicalAnd %2 %14 %11 - %15 = OpCompositeExtract %16 %4 1 - %17 = OpGroupNonUniformAllEqual %2 %12 %15 - %18 = OpLogicalAnd %2 %13 %17 - %19 = OpCompositeExtract %20 %4 2 - %21 = OpGroupNonUniformAllEqual %2 %12 %19 - %22 = OpLogicalAnd %2 %18 %21 - OpNoLine - OpReturnValue %22 - OpFunctionEnd +error: `u8` type used without `OpCapability Int8` + | + = note: used by unnamed constant + = note: used from within `spirv_std::arch::subgroup::subgroup_all_equal::` +note: called by `subgroup_composite_all_equals::disassembly` + --> <$DIR/subgroup_composite_all_equals.rs>:27:5 + | +LL | subgroup_all_equal(my_struct) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: called by `subgroup_composite_all_equals::main` + --> <$DIR/subgroup_composite_all_equals.rs>:44:20 + | +LL | let bool = disassembly(my_struct); + | ^^^^^^^^^^^^^^^^^^^^^^ +note: called by GLCompute entry-point `main` + --> <$DIR/subgroup_composite_all_equals.rs>:31:8 + | +LL | pub fn main( + | ^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/compiletests/ui/lang/core/ref/member_ref_arg_tuples.stderr b/tests/compiletests/ui/lang/core/ref/member_ref_arg_tuples.stderr index 26a651c3ebc..2f81d211870 100644 --- a/tests/compiletests/ui/lang/core/ref/member_ref_arg_tuples.stderr +++ b/tests/compiletests/ui/lang/core/ref/member_ref_arg_tuples.stderr @@ -34,5 +34,19 @@ LL | fn h_newtyped(xyz: ((&u32, &u32, &u32),)) -> (u32, u32, u32) { = note: inlining was required due to illegal parameter type = note: called from `member_ref_arg_tuples::main` -warning: 4 warnings emitted +error: `u64` type used without `OpCapability Int64` + | + = note: used by unnamed constant +note: used from within `member_ref_arg_tuples::main` + --> <$DIR/member_ref_arg_tuples.rs>:44:13 + | +LL | let s = S { x: 2, y: 2 }; + | ^^^^^^^^^^^^^^^^ +note: called by Fragment entry-point `main` + --> <$DIR/member_ref_arg_tuples.rs>:43:8 + | +LL | pub fn main() { + | ^^^^ + +error: aborting due to 1 previous error; 4 warnings emitted From 3724cbfb3ab282f5197abeae546b33a04423c5ea Mon Sep 17 00:00:00 2001 From: firestar99 Date: Thu, 16 Jul 2026 15:35:25 +0200 Subject: [PATCH 03/11] ignore cg_ssa attributes only required for bootstrap feature --- crates/rustc_codegen_spirv/build.rs | 5 ++++- crates/rustc_codegen_spirv/src/lib.rs | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/rustc_codegen_spirv/build.rs b/crates/rustc_codegen_spirv/build.rs index 819a31c8299..b75d0a2aa8f 100644 --- a/crates/rustc_codegen_spirv/build.rs +++ b/crates/rustc_codegen_spirv/build.rs @@ -153,7 +153,10 @@ fn generate_pqp_cg_ssa() -> Result<(), Box> { for line in mem::take(&mut src).lines() { if line.starts_with("#!") { src += "// "; - if !line.starts_with("#![doc(") && line != "#![warn(unreachable_pub)]" { + if !line.starts_with("#![doc(") + && line != "#![warn(unreachable_pub)]" + && !line.starts_with("#![cfg_attr(bootstrap,") + { writeln(&mut cg_ssa_lib_rc_attrs, line); } } else if line == "#[macro_use]" || line.starts_with("extern crate ") { diff --git a/crates/rustc_codegen_spirv/src/lib.rs b/crates/rustc_codegen_spirv/src/lib.rs index 4e72b8584a1..9eb9fae4b6a 100644 --- a/crates/rustc_codegen_spirv/src/lib.rs +++ b/crates/rustc_codegen_spirv/src/lib.rs @@ -6,7 +6,6 @@ #![feature(trait_alias)] #![feature(try_blocks)] #![recursion_limit = "256"] -#![cfg_attr(bootstrap, feature(string_from_utf8_lossy_owned))] // HACK(eddyb) end of `rustc_codegen_ssa` crate-level attributes (see `build.rs`). //! Welcome to the API documentation for the `rust-gpu` project, this API is From cfd64e1eb00c8bfa49b7bdeb47e0127e4bba2220 Mon Sep 17 00:00:00 2001 From: firestar99 Date: Thu, 6 Aug 2026 16:50:59 +0200 Subject: [PATCH 04/11] update to nightly-2026-07-18 --- crates/rustc_codegen_spirv/build.rs | 4 ++-- rust-toolchain.toml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/rustc_codegen_spirv/build.rs b/crates/rustc_codegen_spirv/build.rs index b75d0a2aa8f..0cf8a22375a 100644 --- a/crates/rustc_codegen_spirv/build.rs +++ b/crates/rustc_codegen_spirv/build.rs @@ -19,9 +19,9 @@ use std::{env, fs, mem}; /// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/ //const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain.toml"); const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain] -channel = "nightly-2026-07-16" +channel = "nightly-2026-07-18" components = ["rust-src", "rustc-dev", "llvm-tools"] -# commit_hash = d0babd8b6b05ef9bb65d42f928cef4129d64cf65"#; +# commit_hash = b6839f4d0e2bd63b960bbff8619c6fdea27d81e5"#; fn rustc_output(arg: &str) -> Result> { let rustc = env::var("RUSTC").unwrap_or_else(|_| "rustc".into()); diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 2e61e578ccc..07b5084bc6a 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,7 +1,7 @@ [toolchain] -channel = "nightly-2026-07-16" +channel = "nightly-2026-07-18" components = ["rust-src", "rustc-dev", "llvm-tools"] -# commit_hash = d0babd8b6b05ef9bb65d42f928cef4129d64cf65 +# commit_hash = b6839f4d0e2bd63b960bbff8619c6fdea27d81e5 # Whenever changing the nightly channel, update the commit hash above, and # change `REQUIRED_RUST_TOOLCHAIN` in `crates/rustc_codegen_spirv/build.rs` too. From 7b66cdeda757c1a7ddd6578cedb8807c5f4c2d8f Mon Sep 17 00:00:00 2001 From: firestar99 Date: Thu, 6 Aug 2026 16:38:33 +0200 Subject: [PATCH 05/11] update to nightly-2026-07-19, requires full scalar pair support --- crates/rustc_codegen_spirv/build.rs | 4 ++-- .../src/builder/builder_methods.rs | 2 +- .../src/codegen_cx/type_.rs | 22 +------------------ rust-toolchain.toml | 4 ++-- .../ui/dis/ptr_copy.normal.stderr | 8 +++---- tests/compiletests/ui/dis/ptr_read.stderr | 2 +- .../ui/dis/ptr_read_method.stderr | 2 +- tests/compiletests/ui/dis/ptr_write.stderr | 2 +- .../ui/dis/ptr_write_method.stderr | 2 +- 9 files changed, 14 insertions(+), 34 deletions(-) diff --git a/crates/rustc_codegen_spirv/build.rs b/crates/rustc_codegen_spirv/build.rs index 0cf8a22375a..1550d90a4a3 100644 --- a/crates/rustc_codegen_spirv/build.rs +++ b/crates/rustc_codegen_spirv/build.rs @@ -19,9 +19,9 @@ use std::{env, fs, mem}; /// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/ //const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain.toml"); const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain] -channel = "nightly-2026-07-18" +channel = "nightly-2026-07-19" components = ["rust-src", "rustc-dev", "llvm-tools"] -# commit_hash = b6839f4d0e2bd63b960bbff8619c6fdea27d81e5"#; +# commit_hash = eff8269f797067c30555e77f160ec84c0ed15cd9"#; fn rustc_output(arg: &str) -> Result> { let rustc = env::var("RUSTC").unwrap_or_else(|_| "rustc".into()); diff --git a/crates/rustc_codegen_spirv/src/builder/builder_methods.rs b/crates/rustc_codegen_spirv/src/builder/builder_methods.rs index 129fe24b11a..ab94b5217a0 100644 --- a/crates/rustc_codegen_spirv/src/builder/builder_methods.rs +++ b/crates/rustc_codegen_spirv/src/builder/builder_methods.rs @@ -1917,7 +1917,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> { let val = if place.val.llextra.is_some() { OperandValue::Ref(place.val) - } else if self.cx.is_backend_immediate(place.layout) { + } else if place.layout.backend_repr.is_scalar_or_simd() { let llval = self.load( place.layout.spirv_type(self.span(), self), place.val.llval, diff --git a/crates/rustc_codegen_spirv/src/codegen_cx/type_.rs b/crates/rustc_codegen_spirv/src/codegen_cx/type_.rs index e9a3f95c383..f9c146d0bd0 100644 --- a/crates/rustc_codegen_spirv/src/codegen_cx/type_.rs +++ b/crates/rustc_codegen_spirv/src/codegen_cx/type_.rs @@ -5,7 +5,7 @@ use super::CodegenCx; use crate::abi::ConvSpirvType; use crate::spirv_type::SpirvType; use rspirv::spirv::Word; -use rustc_abi::{AddressSpace, BackendRepr, Reg}; +use rustc_abi::{AddressSpace, Reg}; use rustc_codegen_ssa::common::TypeKind; use rustc_codegen_ssa::traits::{BaseTypeCodegenMethods, LayoutTypeCodegenMethods}; use rustc_middle::ty::Ty; @@ -94,26 +94,6 @@ impl<'tcx> LayoutTypeCodegenMethods<'tcx> for CodegenCx<'tcx> { layout.spirv_type(DUMMY_SP, self) } - fn is_backend_immediate(&self, layout: TyAndLayout<'tcx>) -> bool { - match layout.backend_repr { - BackendRepr::Scalar(_) - | BackendRepr::SimdScalableVector { .. } - | BackendRepr::SimdVector { .. } => true, - BackendRepr::ScalarPair { .. } => false, - BackendRepr::Memory { .. } => layout.is_zst(), - } - } - - fn is_backend_scalar_pair(&self, layout: TyAndLayout<'tcx>) -> bool { - match layout.backend_repr { - BackendRepr::ScalarPair { .. } => true, - BackendRepr::Scalar(_) - | BackendRepr::SimdScalableVector { .. } - | BackendRepr::SimdVector { .. } - | BackendRepr::Memory { .. } => false, - } - } - fn scalar_pair_element_backend_type( &self, layout: TyAndLayout<'tcx>, diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 07b5084bc6a..560c5bb4d99 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,7 +1,7 @@ [toolchain] -channel = "nightly-2026-07-18" +channel = "nightly-2026-07-19" components = ["rust-src", "rustc-dev", "llvm-tools"] -# commit_hash = b6839f4d0e2bd63b960bbff8619c6fdea27d81e5 +# commit_hash = eff8269f797067c30555e77f160ec84c0ed15cd9 # Whenever changing the nightly channel, update the commit hash above, and # change `REQUIRED_RUST_TOOLCHAIN` in `crates/rustc_codegen_spirv/build.rs` too. diff --git a/tests/compiletests/ui/dis/ptr_copy.normal.stderr b/tests/compiletests/ui/dis/ptr_copy.normal.stderr index a01ff97c7c6..f012f7b74e7 100644 --- a/tests/compiletests/ui/dis/ptr_copy.normal.stderr +++ b/tests/compiletests/ui/dis/ptr_copy.normal.stderr @@ -1,11 +1,11 @@ error: cannot memcpy dynamically sized data - --> <$CORE_SRC/ptr/mod.rs>:640:9 + --> <$CORE_SRC/ptr/mod.rs>:645:9 | LL | crate::intrinsics::copy(src, dst, count) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: used from within `core::ptr::copy::` - --> <$CORE_SRC/ptr/mod.rs>:625:21 + --> <$CORE_SRC/ptr/mod.rs>:630:21 | LL | pub const unsafe fn copy(src: *const T, dst: *mut T, count: usize) { | ^^^^ @@ -28,7 +28,7 @@ LL | pub fn main(i: f32, o: &mut f32) { error: cannot cast between pointer types from `*f32` to `*struct () { }` - --> <$CORE_SRC/ptr/mod.rs>:628:9 + --> <$CORE_SRC/ptr/mod.rs>:633:9 | LL | / ub_checks::assert_unsafe_precondition!( LL | | check_language_ub, @@ -39,7 +39,7 @@ LL | | ); | |_________^ | note: used from within `core::ptr::copy::` - --> <$CORE_SRC/ptr/mod.rs>:628:9 + --> <$CORE_SRC/ptr/mod.rs>:633:9 | LL | / ub_checks::assert_unsafe_precondition!( LL | | check_language_ub, diff --git a/tests/compiletests/ui/dis/ptr_read.stderr b/tests/compiletests/ui/dis/ptr_read.stderr index c719253ddeb..3676866746b 100644 --- a/tests/compiletests/ui/dis/ptr_read.stderr +++ b/tests/compiletests/ui/dis/ptr_read.stderr @@ -2,7 +2,7 @@ %4 = OpFunctionParameter %5 %6 = OpFunctionParameter %5 %7 = OpLabel - OpLine %8 1731 8 + OpLine %8 1736 8 %9 = OpLoad %10 %4 OpLine %11 7 13 OpStore %6 %9 diff --git a/tests/compiletests/ui/dis/ptr_read_method.stderr b/tests/compiletests/ui/dis/ptr_read_method.stderr index c719253ddeb..3676866746b 100644 --- a/tests/compiletests/ui/dis/ptr_read_method.stderr +++ b/tests/compiletests/ui/dis/ptr_read_method.stderr @@ -2,7 +2,7 @@ %4 = OpFunctionParameter %5 %6 = OpFunctionParameter %5 %7 = OpLabel - OpLine %8 1731 8 + OpLine %8 1736 8 %9 = OpLoad %10 %4 OpLine %11 7 13 OpStore %6 %9 diff --git a/tests/compiletests/ui/dis/ptr_write.stderr b/tests/compiletests/ui/dis/ptr_write.stderr index 35af9a8a355..493a413de6e 100644 --- a/tests/compiletests/ui/dis/ptr_write.stderr +++ b/tests/compiletests/ui/dis/ptr_write.stderr @@ -4,7 +4,7 @@ %7 = OpLabel OpLine %8 7 35 %9 = OpLoad %10 %4 - OpLine %11 1939 40 + OpLine %11 1944 40 OpStore %6 %9 OpNoLine OpReturn diff --git a/tests/compiletests/ui/dis/ptr_write_method.stderr b/tests/compiletests/ui/dis/ptr_write_method.stderr index c042a20be7b..407c1008ceb 100644 --- a/tests/compiletests/ui/dis/ptr_write_method.stderr +++ b/tests/compiletests/ui/dis/ptr_write_method.stderr @@ -4,7 +4,7 @@ %7 = OpLabel OpLine %8 7 37 %9 = OpLoad %10 %4 - OpLine %11 1939 40 + OpLine %11 1944 40 OpStore %6 %9 OpNoLine OpReturn From 602c2b0518151a72a87a53b21af3d8b731892a5e Mon Sep 17 00:00:00 2001 From: firestar99 Date: Mon, 10 Aug 2026 12:45:45 +0200 Subject: [PATCH 06/11] update to nightly-2026-07-30 --- crates/rustc_codegen_spirv/build.rs | 4 +- crates/rustc_codegen_spirv/src/attr.rs | 8 +- .../src/builder/spirv_asm.rs | 228 ++++++++++-------- rust-toolchain.toml | 4 +- 4 files changed, 138 insertions(+), 106 deletions(-) diff --git a/crates/rustc_codegen_spirv/build.rs b/crates/rustc_codegen_spirv/build.rs index 1550d90a4a3..ba59d59fbe9 100644 --- a/crates/rustc_codegen_spirv/build.rs +++ b/crates/rustc_codegen_spirv/build.rs @@ -19,9 +19,9 @@ use std::{env, fs, mem}; /// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/ //const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain.toml"); const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain] -channel = "nightly-2026-07-19" +channel = "nightly-2026-07-30" components = ["rust-src", "rustc-dev", "llvm-tools"] -# commit_hash = eff8269f797067c30555e77f160ec84c0ed15cd9"#; +# commit_hash = 1a833e16546c2eb012758ddd499964fd8afee29e"#; fn rustc_output(arg: &str) -> Result> { let rustc = env::var("RUSTC").unwrap_or_else(|_| "rustc".into()); diff --git a/crates/rustc_codegen_spirv/src/attr.rs b/crates/rustc_codegen_spirv/src/attr.rs index 4698aae0fa2..6fe22385eac 100644 --- a/crates/rustc_codegen_spirv/src/attr.rs +++ b/crates/rustc_codegen_spirv/src/attr.rs @@ -433,19 +433,19 @@ impl<'tcx> Visitor<'tcx> for CheckSpirvAttrVisitor<'tcx> { } fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) { - let target = Target::from_item(item); + let target = Target::from(item); self.check_spirv_attributes(item.hir_id(), target); intravisit::walk_item(self, item); } fn visit_generic_param(&mut self, generic_param: &'tcx hir::GenericParam<'tcx>) { - let target = Target::from_generic_param(generic_param); + let target = Target::from(generic_param); self.check_spirv_attributes(generic_param.hir_id, target); intravisit::walk_generic_param(self, generic_param); } fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem<'tcx>) { - let target = Target::from_trait_item(trait_item); + let target = Target::from(trait_item); self.check_spirv_attributes(trait_item.hir_id(), target); intravisit::walk_trait_item(self, trait_item); } @@ -461,7 +461,7 @@ impl<'tcx> Visitor<'tcx> for CheckSpirvAttrVisitor<'tcx> { } fn visit_foreign_item(&mut self, f_item: &'tcx hir::ForeignItem<'tcx>) { - let target = Target::from_foreign_item(f_item); + let target = Target::from(f_item); self.check_spirv_attributes(f_item.hir_id(), target); intravisit::walk_foreign_item(self, f_item); } diff --git a/crates/rustc_codegen_spirv/src/builder/spirv_asm.rs b/crates/rustc_codegen_spirv/src/builder/spirv_asm.rs index e83ca9f0ed4..86f380fa621 100644 --- a/crates/rustc_codegen_spirv/src/builder/spirv_asm.rs +++ b/crates/rustc_codegen_spirv/src/builder/spirv_asm.rs @@ -3,8 +3,10 @@ use crate::maybe_pqp_cg_ssa as rustc_codegen_ssa; use super::Builder; use crate::abi::ConvSpirvType; -use crate::builder_spirv::{SpirvValue, SpirvValueExt, SpirvValueKind}; +use crate::builder_spirv::{SpirvBlockCursor, SpirvValue, SpirvValueExt, SpirvValueKind}; use crate::codegen_cx::CodegenCx; +use crate::maybe_pqp_cg_ssa::mir::operand::OperandRef; +use crate::maybe_pqp_cg_ssa::traits::BackendTypes; use crate::spirv_type::SpirvType; use rspirv::dr; use rspirv::grammar::{LogicalOperand, OperandKind, OperandQuantifier, reflect}; @@ -17,11 +19,12 @@ use rustc_abi::{BackendRepr, Primitive}; use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_codegen_ssa::mir::operand::OperandValue; use rustc_codegen_ssa::mir::place::PlaceRef; -use rustc_codegen_ssa::traits::{ - AsmBuilderMethods, BackendTypes, BuilderMethods, InlineAsmOperandRef, -}; +use rustc_codegen_ssa::traits::{AsmBuilderMethods, BuilderMethods, InlineAsmOperandRef}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use rustc_middle::{bug, ty::Instance}; +use rustc_middle::mir::interpret::Scalar; +use rustc_middle::ty::layout::LayoutOf; +use rustc_middle::{bug, span_bug, ty::Instance}; +use rustc_span::def_id::DefId; use rustc_span::{DUMMY_SP, Span}; use rustc_target::asm::{InlineAsmRegClass, InlineAsmRegOrRegClass, SpirVInlineAsmRegClass}; use smallvec::SmallVec; @@ -40,32 +43,80 @@ impl InstructionTable { } } -// HACK(eddyb) `InlineAsmOperandRef` lacks `#[derive(Clone)]` -fn inline_asm_operand_ref_clone<'tcx, B: BackendTypes + ?Sized>( - operand: &InlineAsmOperandRef<'tcx, B>, -) -> InlineAsmOperandRef<'tcx, B> { - use InlineAsmOperandRef::*; - - match operand { - &In { reg, value } => In { reg, value }, - &Out { reg, late, place } => Out { reg, late, place }, - &InOut { - reg, - late, - in_value, - out_place, - } => InOut { - reg, - late, - in_value, - out_place, - }, - Const { string } => Const { - string: string.clone(), - }, - &SymFn { instance } => SymFn { instance }, - &SymStatic { def_id } => SymStatic { def_id }, - &Label { label } => Label { label }, +#[expect( + dead_code, + reason = "keep asm structs like upstream with minimal changes" +)] +#[derive(Debug)] +pub enum SpvInlineAsmOperandRef<'tcx> { + In { + reg: InlineAsmRegOrRegClass, + value: OperandRef<'tcx, SpirvValue>, + }, + Out { + reg: InlineAsmRegOrRegClass, + late: bool, + place: Option>, + }, + InOut { + reg: InlineAsmRegOrRegClass, + late: bool, + in_value: OperandRef<'tcx, SpirvValue>, + out_place: Option>, + }, + Const { + string: String, + }, + SymThreadLocalStatic { + def_id: DefId, + }, + Label { + label: SpirvBlockCursor, + }, +} + +impl<'tcx> SpvInlineAsmOperandRef<'tcx> { + fn from + ?Sized>( + cx: &CodegenCx<'tcx>, + operand: &InlineAsmOperandRef<'tcx, B>, + span: Span, + ) -> Self { + match *operand { + InlineAsmOperandRef::In { reg, value } => Self::In { reg, value }, + InlineAsmOperandRef::Out { reg, late, place } => Self::Out { reg, late, place }, + InlineAsmOperandRef::InOut { + reg, + late, + in_value, + out_place, + } => Self::InOut { + reg, + late, + in_value, + out_place, + }, + InlineAsmOperandRef::Const { value, ty } => match value { + Scalar::Int(value) => { + let string = rustc_codegen_ssa::common::asm_const_to_str( + cx.tcx, + span, + value, + cx.layout_of(ty), + ); + Self::Const { string } + } + Scalar::Ptr(_, _) => { + span_bug!( + span, + "spirv can't handle `InlineAsmOperandRef::Const {{ value: Scalar::Ptr(_, _) }}`", + ) + } + }, + InlineAsmOperandRef::Label { label } => Self::Label { label }, + InlineAsmOperandRef::SymThreadLocalStatic { def_id } => { + Self::SymThreadLocalStatic { def_id } + } + } } } @@ -109,22 +160,24 @@ impl<'a, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'tcx> { // HACK(eddyb) get more accurate pointers types, for pointer operands, // from the Rust types available in their respective `OperandRef`s. - let mut operands: SmallVec<[_; 8]> = - operands.iter().map(inline_asm_operand_ref_clone).collect(); + let span = line_spans.first().copied().unwrap_or_default(); + let mut operands: SmallVec<[_; 8]> = operands + .iter() + .map(|operand| SpvInlineAsmOperandRef::from(self.cx, operand, span)) + .collect(); for operand in &mut operands { let (in_value, out_place) = match operand { - InlineAsmOperandRef::In { value, .. } => (Some(value), None), - InlineAsmOperandRef::InOut { + SpvInlineAsmOperandRef::In { value, .. } => (Some(value), None), + SpvInlineAsmOperandRef::InOut { in_value, out_place, .. } => (Some(in_value), out_place.as_mut()), - InlineAsmOperandRef::Out { place, .. } => (None, place.as_mut()), + SpvInlineAsmOperandRef::Out { place, .. } => (None, place.as_mut()), - InlineAsmOperandRef::Const { .. } - | InlineAsmOperandRef::SymFn { .. } - | InlineAsmOperandRef::SymStatic { .. } - | InlineAsmOperandRef::Label { .. } => (None, None), + SpvInlineAsmOperandRef::Const { .. } + | SpvInlineAsmOperandRef::Label { .. } + | SpvInlineAsmOperandRef::SymThreadLocalStatic { .. } => (None, None), }; if let Some(in_value) = in_value @@ -201,7 +254,9 @@ impl<'a, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'tcx> { Token::Typeof(&operands[operand_idx], span, kind); } None => match &operands[operand_idx] { - InlineAsmOperandRef::Const { string } => line.push(Token::Word(string)), + SpvInlineAsmOperandRef::Const { string } => { + line.push(Token::Word(string)); + } item => line.push(Token::Placeholder(item, span)), }, } @@ -213,7 +268,7 @@ impl<'a, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'tcx> { let mut defined_ids = FxHashSet::default(); let mut id_to_type_map = FxHashMap::default(); for operand in &operands { - if let InlineAsmOperandRef::In { reg: _, value } = operand { + if let SpvInlineAsmOperandRef::In { reg: _, value } = operand { let value = value.immediate(); id_to_type_map.insert(value.def(self), value.ty); } @@ -275,15 +330,11 @@ enum TypeofKind { Dereference, } -enum Token<'a, 'cx, 'tcx> { +enum Token<'a, 'tcx> { Word(&'a str), String(String), - Placeholder(&'a InlineAsmOperandRef<'tcx, Builder<'cx, 'tcx>>, Span), - Typeof( - &'a InlineAsmOperandRef<'tcx, Builder<'cx, 'tcx>>, - Span, - TypeofKind, - ), + Placeholder(&'a SpvInlineAsmOperandRef<'tcx>, Span), + Typeof(&'a SpvInlineAsmOperandRef<'tcx>, Span, TypeofKind), } enum OutRegister<'tcx> { @@ -297,7 +348,7 @@ enum AsmBlock { } impl<'cx, 'tcx> Builder<'cx, 'tcx> { - fn lex_word<'a>(&self, line: &mut std::str::Chars<'a>) -> Option> { + fn lex_word<'a>(&self, line: &mut std::str::Chars<'a>) -> Option> { loop { let start = line.as_str(); match line.next()? { @@ -512,7 +563,7 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> { defined_ids: &mut FxHashSet, id_to_type_map: &mut FxHashMap, asm_block: &mut AsmBlock, - mut tokens: impl Iterator>, + mut tokens: impl Iterator>, ) where 'cx: 'a, 'tcx: 'a, @@ -601,7 +652,7 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> { &mut self, id_map: &mut FxHashMap<&'a str, Word>, id_to_type_map: &FxHashMap, - mut tokens: impl Iterator>, + mut tokens: impl Iterator>, instruction: &mut dr::Instruction, ) where 'cx: 'a, @@ -909,7 +960,7 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> { &mut self, id_map: &mut FxHashMap<&'a str, Word>, defined_ids: &mut FxHashSet, - token: Token<'a, 'cx, 'tcx>, + token: Token<'a, 'tcx>, ) -> Option> { match token { Token::Word(word) => { @@ -937,14 +988,14 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> { None } Token::Placeholder(hole, span) => match hole { - InlineAsmOperandRef::In { reg, value: _ } => { + SpvInlineAsmOperandRef::In { reg, value: _ } => { self.check_reg(span, reg); self.tcx .dcx() .span_err(span, "in register cannot be assigned to"); None } - InlineAsmOperandRef::Out { + SpvInlineAsmOperandRef::Out { reg, late: _, place, @@ -957,7 +1008,7 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> { None } } - InlineAsmOperandRef::InOut { + SpvInlineAsmOperandRef::InOut { reg, late: _, in_value: _, @@ -971,28 +1022,22 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> { None } } - InlineAsmOperandRef::Const { string: _ } => { + SpvInlineAsmOperandRef::Const { .. } => { self.tcx .dcx() .span_err(span, "cannot write to const asm argument"); None } - InlineAsmOperandRef::SymFn { instance: _ } => { - self.tcx - .dcx() - .span_err(span, "cannot write to function asm argument"); - None - } - InlineAsmOperandRef::SymStatic { def_id: _ } => { + SpvInlineAsmOperandRef::Label { label: _ } => { self.tcx .dcx() - .span_err(span, "cannot write to static variable asm argument"); + .span_err(span, "cannot write to label asm argument"); None } - InlineAsmOperandRef::Label { label: _ } => { + SpvInlineAsmOperandRef::SymThreadLocalStatic { .. } => { self.tcx .dcx() - .span_err(span, "cannot write to label asm argument"); + .span_err(span, "cannot write to SymThreadLocalStatic asm argument"); None } }, @@ -1002,7 +1047,7 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> { fn parse_id_in<'a>( &mut self, id_map: &mut FxHashMap<&'a str, Word>, - token: Token<'a, 'cx, 'tcx>, + token: Token<'a, 'tcx>, ) -> Option { match token { Token::Word(word) => { @@ -1018,7 +1063,7 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> { None } Token::Typeof(hole, span, kind) => match hole { - InlineAsmOperandRef::In { reg, value } => { + SpvInlineAsmOperandRef::In { reg, value } => { self.check_reg(span, reg); let ty = value.immediate().ty; Some(match kind { @@ -1038,7 +1083,7 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> { }, }) } - InlineAsmOperandRef::Out { + SpvInlineAsmOperandRef::Out { reg, late: _, place, @@ -1065,7 +1110,7 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> { None } } - InlineAsmOperandRef::InOut { + SpvInlineAsmOperandRef::InOut { reg, late: _, in_value, @@ -1074,38 +1119,31 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> { self.check_reg(span, reg); Some(in_value.immediate().ty) } - InlineAsmOperandRef::Const { string: _ } => { + SpvInlineAsmOperandRef::Const { .. } => { self.tcx .dcx() .span_err(span, "cannot take the type of a const asm argument"); None } - InlineAsmOperandRef::SymFn { instance: _ } => { + SpvInlineAsmOperandRef::Label { label: _ } => { self.tcx .dcx() - .span_err(span, "cannot take the type of a function asm argument"); - None - } - InlineAsmOperandRef::SymStatic { def_id: _ } => { - self.tcx.dcx().span_err( - span, - "cannot take the type of a static variable asm argument", - ); + .span_err(span, "cannot take the type of a label asm argument"); None } - InlineAsmOperandRef::Label { label: _ } => { + SpvInlineAsmOperandRef::SymThreadLocalStatic { .. } => { self.tcx .dcx() - .span_err(span, "cannot take the type of a label asm argument"); + .span_err(span, "cannot write to SymThreadLocalStatic asm argument"); None } }, Token::Placeholder(hole, span) => match hole { - InlineAsmOperandRef::In { reg, value } => { + SpvInlineAsmOperandRef::In { reg, value } => { self.check_reg(span, reg); Some(value.immediate().def(self)) } - InlineAsmOperandRef::Out { + SpvInlineAsmOperandRef::Out { reg, late: _, place: _, @@ -1116,7 +1154,7 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> { .span_err(span, "out register cannot be used as a value"); None } - InlineAsmOperandRef::InOut { + SpvInlineAsmOperandRef::InOut { reg, late: _, in_value, @@ -1125,28 +1163,22 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> { self.check_reg(span, reg); Some(in_value.immediate().def(self)) } - InlineAsmOperandRef::Const { string: _ } => { + SpvInlineAsmOperandRef::Const { .. } => { self.tcx .dcx() .span_err(span, "const asm argument not supported yet"); None } - InlineAsmOperandRef::SymFn { instance: _ } => { + SpvInlineAsmOperandRef::Label { label: _ } => { self.tcx .dcx() - .span_err(span, "function asm argument not supported yet"); - None - } - InlineAsmOperandRef::SymStatic { def_id: _ } => { - self.tcx - .dcx() - .span_err(span, "static variable asm argument not supported yet"); + .span_err(span, "label asm argument not supported yet"); None } - InlineAsmOperandRef::Label { label: _ } => { + SpvInlineAsmOperandRef::SymThreadLocalStatic { .. } => { self.tcx .dcx() - .span_err(span, "label asm argument not supported yet"); + .span_err(span, "cannot write to SymThreadLocalStatic asm argument"); None } }, @@ -1158,7 +1190,7 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> { id_map: &mut FxHashMap<&'a str, Word>, inst: &mut dr::Instruction, kind: OperandKind, - tokens: &mut impl Iterator>, + tokens: &mut impl Iterator>, ) -> bool where 'cx: 'a, diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 560c5bb4d99..73f32a8eb37 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,7 +1,7 @@ [toolchain] -channel = "nightly-2026-07-19" +channel = "nightly-2026-07-30" components = ["rust-src", "rustc-dev", "llvm-tools"] -# commit_hash = eff8269f797067c30555e77f160ec84c0ed15cd9 +# commit_hash = 1a833e16546c2eb012758ddd499964fd8afee29e # Whenever changing the nightly channel, update the commit hash above, and # change `REQUIRED_RUST_TOOLCHAIN` in `crates/rustc_codegen_spirv/build.rs` too. From 35914d82bb4870653fbf284fc4028e920ae0238a Mon Sep 17 00:00:00 2001 From: firestar99 Date: Thu, 6 Aug 2026 16:30:50 +0200 Subject: [PATCH 07/11] update to nightly-2026-08-06, requires build-dir-new-layout support --- crates/rustc_codegen_spirv/build.rs | 4 ++-- crates/rustc_codegen_spirv/src/abi.rs | 2 +- crates/rustc_codegen_spirv/src/lib.rs | 5 +++-- crates/rustc_codegen_spirv/src/linker/test.rs | 2 +- rust-toolchain.toml | 4 ++-- .../ui/arch/debug_printf_type_checking.stderr | 5 ++++- tests/compiletests/ui/dis/ptr_copy.normal.stderr | 8 ++++---- tests/compiletests/ui/dis/ptr_read.stderr | 2 +- tests/compiletests/ui/dis/ptr_read_method.stderr | 2 +- tests/compiletests/ui/dis/ptr_write.stderr | 2 +- tests/compiletests/ui/dis/ptr_write_method.stderr | 2 +- .../compiletests/ui/lang/core/intrinsics/black_box.stderr | 2 +- 12 files changed, 22 insertions(+), 18 deletions(-) diff --git a/crates/rustc_codegen_spirv/build.rs b/crates/rustc_codegen_spirv/build.rs index ba59d59fbe9..070f8682201 100644 --- a/crates/rustc_codegen_spirv/build.rs +++ b/crates/rustc_codegen_spirv/build.rs @@ -19,9 +19,9 @@ use std::{env, fs, mem}; /// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/ //const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain.toml"); const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain] -channel = "nightly-2026-07-30" +channel = "nightly-2026-08-06" components = ["rust-src", "rustc-dev", "llvm-tools"] -# commit_hash = 1a833e16546c2eb012758ddd499964fd8afee29e"#; +# commit_hash = 7608eb7b07eaf93f16d7cf5bcb2098eca87503df"#; fn rustc_output(arg: &str) -> Result> { let rustc = env::var("RUSTC").unwrap_or_else(|_| "rustc".into()); diff --git a/crates/rustc_codegen_spirv/src/abi.rs b/crates/rustc_codegen_spirv/src/abi.rs index 0dafc0bf355..3cf1feabca8 100644 --- a/crates/rustc_codegen_spirv/src/abi.rs +++ b/crates/rustc_codegen_spirv/src/abi.rs @@ -444,7 +444,7 @@ impl<'tcx> ConvSpirvType<'tcx> for TyAndLayout<'tcx> { let elem_spirv = trans_scalar(cx, span, *self, element, Size::ZERO); SpirvType::Vector { element: elem_spirv, - count: count as u32, + count: count.as_u32(), size: self.size, align: self.align.abi, } diff --git a/crates/rustc_codegen_spirv/src/lib.rs b/crates/rustc_codegen_spirv/src/lib.rs index 9eb9fae4b6a..bbcf14e7f02 100644 --- a/crates/rustc_codegen_spirv/src/lib.rs +++ b/crates/rustc_codegen_spirv/src/lib.rs @@ -159,8 +159,8 @@ use rustc_middle::dep_graph::{WorkProduct, WorkProductMap}; use rustc_middle::mono::{MonoItem, MonoItemData}; use rustc_middle::ty::print::with_no_trimmed_paths; use rustc_middle::ty::{InstanceKind, TyCtxt}; -use rustc_session::Session; use rustc_session::config::{self, OutputFilenames, OutputType}; +use rustc_session::{IncrCompSession, Session}; use rustc_span::symbol::Symbol; use std::any::Any; use std::fs; @@ -255,13 +255,14 @@ impl CodegenBackend for SpirvCodegenBackend { &self, ongoing_codegen: Box, sess: &Session, + incr_comp_session: Option<&IncrCompSession>, _outputs: &OutputFilenames, crate_info: &CrateInfo, ) -> (CompiledModules, WorkProductMap) { ongoing_codegen .downcast::>() .expect("Expected OngoingCodegen, found Box") - .join(sess, crate_info) + .join(sess, incr_comp_session, crate_info) } fn link( diff --git a/crates/rustc_codegen_spirv/src/linker/test.rs b/crates/rustc_codegen_spirv/src/linker/test.rs index d1560409b21..e06a861e3c3 100644 --- a/crates/rustc_codegen_spirv/src/linker/test.rs +++ b/crates/rustc_codegen_spirv/src/linker/test.rs @@ -98,7 +98,7 @@ fn link_with_linker_opts( // is really a silent unwinding device, that should be treated the same as // `Err(ErrorGuaranteed)` returns from `link`). rustc_driver::catch_fatal_errors(|| { - rustc_data_structures::jobserver::initialize_checked(|err| { + rustc_data_structures::jobserver::initialize(99, |err| { unreachable!("jobserver error: {err}"); }); diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 73f32a8eb37..f5f633ab355 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,7 +1,7 @@ [toolchain] -channel = "nightly-2026-07-30" +channel = "nightly-2026-08-06" components = ["rust-src", "rustc-dev", "llvm-tools"] -# commit_hash = 1a833e16546c2eb012758ddd499964fd8afee29e +# commit_hash = 7608eb7b07eaf93f16d7cf5bcb2098eca87503df # Whenever changing the nightly channel, update the commit hash above, and # change `REQUIRED_RUST_TOOLCHAIN` in `crates/rustc_codegen_spirv/build.rs` too. diff --git a/tests/compiletests/ui/arch/debug_printf_type_checking.stderr b/tests/compiletests/ui/arch/debug_printf_type_checking.stderr index 0e6cd5e4546..4def80e80af 100644 --- a/tests/compiletests/ui/arch/debug_printf_type_checking.stderr +++ b/tests/compiletests/ui/arch/debug_printf_type_checking.stderr @@ -112,7 +112,10 @@ error[E0277]: the trait bound `{float}: spirv_std::Vector` is not satisf --> $DIR/debug_printf_type_checking.rs:24:9 | LL | debug_printf!("%v2f", 11.0); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `spirv_std::Vector` is not implemented for `{float}` + | ^^^^^^^^^^^^^^^^^^^^^^----^ + | | | + | | `{float}` doesn't satisfy the trait bound + | the trait `spirv_std::Vector` is not implemented for `{float}` | help: the trait `spirv_std::Vector` is implemented for `Vec2` --> $SPIRV_STD_SRC/vector.rs:71:12 diff --git a/tests/compiletests/ui/dis/ptr_copy.normal.stderr b/tests/compiletests/ui/dis/ptr_copy.normal.stderr index f012f7b74e7..f94204759ab 100644 --- a/tests/compiletests/ui/dis/ptr_copy.normal.stderr +++ b/tests/compiletests/ui/dis/ptr_copy.normal.stderr @@ -1,11 +1,11 @@ error: cannot memcpy dynamically sized data - --> <$CORE_SRC/ptr/mod.rs>:645:9 + --> <$CORE_SRC/ptr/mod.rs>:664:9 | LL | crate::intrinsics::copy(src, dst, count) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: used from within `core::ptr::copy::` - --> <$CORE_SRC/ptr/mod.rs>:630:21 + --> <$CORE_SRC/ptr/mod.rs>:649:21 | LL | pub const unsafe fn copy(src: *const T, dst: *mut T, count: usize) { | ^^^^ @@ -28,7 +28,7 @@ LL | pub fn main(i: f32, o: &mut f32) { error: cannot cast between pointer types from `*f32` to `*struct () { }` - --> <$CORE_SRC/ptr/mod.rs>:633:9 + --> <$CORE_SRC/ptr/mod.rs>:652:9 | LL | / ub_checks::assert_unsafe_precondition!( LL | | check_language_ub, @@ -39,7 +39,7 @@ LL | | ); | |_________^ | note: used from within `core::ptr::copy::` - --> <$CORE_SRC/ptr/mod.rs>:633:9 + --> <$CORE_SRC/ptr/mod.rs>:652:9 | LL | / ub_checks::assert_unsafe_precondition!( LL | | check_language_ub, diff --git a/tests/compiletests/ui/dis/ptr_read.stderr b/tests/compiletests/ui/dis/ptr_read.stderr index 3676866746b..0a6e73aa798 100644 --- a/tests/compiletests/ui/dis/ptr_read.stderr +++ b/tests/compiletests/ui/dis/ptr_read.stderr @@ -2,7 +2,7 @@ %4 = OpFunctionParameter %5 %6 = OpFunctionParameter %5 %7 = OpLabel - OpLine %8 1736 8 + OpLine %8 1755 8 %9 = OpLoad %10 %4 OpLine %11 7 13 OpStore %6 %9 diff --git a/tests/compiletests/ui/dis/ptr_read_method.stderr b/tests/compiletests/ui/dis/ptr_read_method.stderr index 3676866746b..0a6e73aa798 100644 --- a/tests/compiletests/ui/dis/ptr_read_method.stderr +++ b/tests/compiletests/ui/dis/ptr_read_method.stderr @@ -2,7 +2,7 @@ %4 = OpFunctionParameter %5 %6 = OpFunctionParameter %5 %7 = OpLabel - OpLine %8 1736 8 + OpLine %8 1755 8 %9 = OpLoad %10 %4 OpLine %11 7 13 OpStore %6 %9 diff --git a/tests/compiletests/ui/dis/ptr_write.stderr b/tests/compiletests/ui/dis/ptr_write.stderr index 493a413de6e..6c0a63b4546 100644 --- a/tests/compiletests/ui/dis/ptr_write.stderr +++ b/tests/compiletests/ui/dis/ptr_write.stderr @@ -4,7 +4,7 @@ %7 = OpLabel OpLine %8 7 35 %9 = OpLoad %10 %4 - OpLine %11 1944 40 + OpLine %11 1963 40 OpStore %6 %9 OpNoLine OpReturn diff --git a/tests/compiletests/ui/dis/ptr_write_method.stderr b/tests/compiletests/ui/dis/ptr_write_method.stderr index 407c1008ceb..5a09df7d418 100644 --- a/tests/compiletests/ui/dis/ptr_write_method.stderr +++ b/tests/compiletests/ui/dis/ptr_write_method.stderr @@ -4,7 +4,7 @@ %7 = OpLabel OpLine %8 7 37 %9 = OpLoad %10 %4 - OpLine %11 1944 40 + OpLine %11 1963 40 OpStore %6 %9 OpNoLine OpReturn diff --git a/tests/compiletests/ui/lang/core/intrinsics/black_box.stderr b/tests/compiletests/ui/lang/core/intrinsics/black_box.stderr index af7314f9f1c..34d9e7d8420 100644 --- a/tests/compiletests/ui/lang/core/intrinsics/black_box.stderr +++ b/tests/compiletests/ui/lang/core/intrinsics/black_box.stderr @@ -8,7 +8,7 @@ warning: black_box intrinsic does not prevent optimization in Rust GPU %10 = OpIAdd %7 %11 %12 OpLine %5 47 8 %13 = OpBitcast %7 %14 - OpLine %15 1245 17 + OpLine %15 1284 17 %16 = OpBitcast %7 %17 OpLine %5 46 4 %18 = OpCompositeConstruct %2 %13 %16 %19 %20 %21 %22 %6 %23 %10 %24 %24 %24 From 90d28841fb0f26e69fa48f739f81344334cc80e8 Mon Sep 17 00:00:00 2001 From: firestar99 Date: Tue, 11 Aug 2026 13:11:41 +0200 Subject: [PATCH 08/11] fix example-runner-wgpu on android and wasm --- examples/runners/wgpu/build.rs | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/examples/runners/wgpu/build.rs b/examples/runners/wgpu/build.rs index f01def125ed..748cd201dbe 100644 --- a/examples/runners/wgpu/build.rs +++ b/examples/runners/wgpu/build.rs @@ -1,6 +1,5 @@ use std::env; use std::error::Error; -use std::path::PathBuf; fn main() -> Result<(), Box> { let target_os = env::var("CARGO_CFG_TARGET_OS")?; @@ -12,27 +11,8 @@ fn main() -> Result<(), Box> { if target_os != "android" && target_arch != "wasm32" { return Ok(()); } - let profile = env::var("PROFILE").unwrap(); - let mut dir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); - // Strip `$profile/build/*/out`. - let ok = dir.ends_with("out") - && dir.pop() - && dir.pop() - && dir.ends_with("build") - && dir.pop() - && dir.ends_with(profile) - && dir.pop(); - assert!(ok); - let dir = dir.join("example-runner-wgpu-builder"); let status = std::process::Command::new("cargo") - .args([ - "run", - "--release", - "-p", - "example-runner-wgpu-builder", - "--target-dir", - ]) - .arg(dir) + .args(["run", "--release", "-p", "example-runner-wgpu-builder"]) .env_remove("CARGO_ENCODED_RUSTFLAGS") .stderr(std::process::Stdio::inherit()) .stdout(std::process::Stdio::inherit()) From 7dbd7a1e87db929b98d8e2b428e1683bf931099f Mon Sep 17 00:00:00 2001 From: firestar99 Date: Mon, 14 Sep 2026 01:20:51 +0200 Subject: [PATCH 09/11] fixup compiletests emitting invalid spv --- tests/compiletests/ui/lang/abi/transparent_array.rs | 2 +- tests/compiletests/ui/lang/abi/transparent_array.stderr | 2 +- tests/compiletests/ui/lang/abi/transparent_nested.rs | 2 +- tests/compiletests/ui/lang/abi/transparent_nested.stderr | 2 +- tests/compiletests/ui/lang/abi/transparent_u32.rs | 2 +- tests/compiletests/ui/lang/abi/transparent_u32.stderr | 2 +- tests/compiletests/ui/lang/abi/transparent_vec.rs | 2 +- tests/compiletests/ui/lang/abi/transparent_vec.stderr | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/compiletests/ui/lang/abi/transparent_array.rs b/tests/compiletests/ui/lang/abi/transparent_array.rs index 1b129c942e6..76d43c8ba44 100644 --- a/tests/compiletests/ui/lang/abi/transparent_array.rs +++ b/tests/compiletests/ui/lang/abi/transparent_array.rs @@ -23,7 +23,7 @@ pub struct A([u32; 3]); pub struct AT([u32; 3]); #[spirv(vertex)] -pub fn main(a: &mut A, at: &mut AT, #[spirv(local_invocation_index)] tid: u32) { +pub fn main(a: &mut A, at: &mut AT, #[spirv(vertex_index)] tid: u32) { *a = A([tid, 1, 2]); a.0 = [tid, 1, 2]; a.0[2] += 4; diff --git a/tests/compiletests/ui/lang/abi/transparent_array.stderr b/tests/compiletests/ui/lang/abi/transparent_array.stderr index 5a814ba069a..d3e241612ea 100644 --- a/tests/compiletests/ui/lang/abi/transparent_array.stderr +++ b/tests/compiletests/ui/lang/abi/transparent_array.stderr @@ -8,7 +8,7 @@ OpName %AT "AT" OpName %a "a" OpName %at "at" - OpDecorate %tid BuiltIn LocalInvocationIndex + OpDecorate %tid BuiltIn VertexIndex OpDecorate %AT ArrayStride 4 OpDecorate %a Location 0 OpDecorate %at Location 3 diff --git a/tests/compiletests/ui/lang/abi/transparent_nested.rs b/tests/compiletests/ui/lang/abi/transparent_nested.rs index fdd96fda213..c838d8f5748 100644 --- a/tests/compiletests/ui/lang/abi/transparent_nested.rs +++ b/tests/compiletests/ui/lang/abi/transparent_nested.rs @@ -33,7 +33,7 @@ pub struct AT(UVec3); pub struct BT(AT); #[spirv(vertex)] -pub fn main(a: &mut B, at: &mut BT, #[spirv(local_invocation_index)] tid: u32) { +pub fn main(a: &mut B, at: &mut BT, #[spirv(vertex_index)] tid: u32) { *a = B(A(UVec3::new(tid, 1, 2))); a.0.0.y = tid + 1; a.0.0.x += 4; diff --git a/tests/compiletests/ui/lang/abi/transparent_nested.stderr b/tests/compiletests/ui/lang/abi/transparent_nested.stderr index cee72e7fcd0..3129823bf44 100644 --- a/tests/compiletests/ui/lang/abi/transparent_nested.stderr +++ b/tests/compiletests/ui/lang/abi/transparent_nested.stderr @@ -13,7 +13,7 @@ OpMemberName %B 0 "0" OpName %a "a" OpName %at "at" - OpDecorate %tid BuiltIn LocalInvocationIndex + OpDecorate %tid BuiltIn VertexIndex OpMemberDecorate %A 0 Offset 0 OpMemberDecorate %B 0 Offset 0 OpDecorate %a Location 0 diff --git a/tests/compiletests/ui/lang/abi/transparent_u32.rs b/tests/compiletests/ui/lang/abi/transparent_u32.rs index 5518f64da25..c23961c8fd0 100644 --- a/tests/compiletests/ui/lang/abi/transparent_u32.rs +++ b/tests/compiletests/ui/lang/abi/transparent_u32.rs @@ -25,7 +25,7 @@ pub struct A(u32); pub struct AT(u32); #[spirv(vertex)] -pub fn main(a: &mut A, at: &mut AT, #[spirv(local_invocation_index)] tid: u32) { +pub fn main(a: &mut A, at: &mut AT, #[spirv(vertex_index)] tid: u32) { *a = A(tid); a.0 = tid + 1; a.0 += 4; diff --git a/tests/compiletests/ui/lang/abi/transparent_u32.stderr b/tests/compiletests/ui/lang/abi/transparent_u32.stderr index cb5f2b66afa..17337a63e45 100644 --- a/tests/compiletests/ui/lang/abi/transparent_u32.stderr +++ b/tests/compiletests/ui/lang/abi/transparent_u32.stderr @@ -6,7 +6,7 @@ OpName %tid "tid" OpName %a "a" OpName %at "at" - OpDecorate %tid BuiltIn LocalInvocationIndex + OpDecorate %tid BuiltIn VertexIndex OpDecorate %a Location 0 OpDecorate %at Location 1 %u32 = OpTypeInt 32 0 diff --git a/tests/compiletests/ui/lang/abi/transparent_vec.rs b/tests/compiletests/ui/lang/abi/transparent_vec.rs index fb8691dfb25..597040a41fd 100644 --- a/tests/compiletests/ui/lang/abi/transparent_vec.rs +++ b/tests/compiletests/ui/lang/abi/transparent_vec.rs @@ -25,7 +25,7 @@ pub struct A(UVec3); pub struct AT(UVec3); #[spirv(vertex)] -pub fn main(a: &mut A, at: &mut AT, #[spirv(local_invocation_index)] tid: u32) { +pub fn main(a: &mut A, at: &mut AT, #[spirv(vertex_index)] tid: u32) { *a = A(UVec3::new(tid, 1, 2)); a.0 = UVec3::new(tid, 1, 3); a.0.y += 10; diff --git a/tests/compiletests/ui/lang/abi/transparent_vec.stderr b/tests/compiletests/ui/lang/abi/transparent_vec.stderr index f00d00206b8..60e052225d7 100644 --- a/tests/compiletests/ui/lang/abi/transparent_vec.stderr +++ b/tests/compiletests/ui/lang/abi/transparent_vec.stderr @@ -7,7 +7,7 @@ OpName %tid "tid" OpName %a "a" OpName %at "at" - OpDecorate %tid BuiltIn LocalInvocationIndex + OpDecorate %tid BuiltIn VertexIndex OpDecorate %a Location 0 OpDecorate %at Location 1 %u32 = OpTypeInt 32 0 From b88a32369decaccf152302c366f7ee4ebed2ce3d Mon Sep 17 00:00:00 2001 From: firestar99 Date: Mon, 14 Sep 2026 01:20:51 +0200 Subject: [PATCH 10/11] fixup memset_fill_u128 --- crates/rustc_codegen_spirv/src/builder/builder_methods.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/rustc_codegen_spirv/src/builder/builder_methods.rs b/crates/rustc_codegen_spirv/src/builder/builder_methods.rs index ab94b5217a0..364c8faec54 100644 --- a/crates/rustc_codegen_spirv/src/builder/builder_methods.rs +++ b/crates/rustc_codegen_spirv/src/builder/builder_methods.rs @@ -310,7 +310,7 @@ fn memset_fill_u64(b: u8) -> u64 { fn memset_fill_u128(b: u8) -> u128 { let b64 = memset_fill_u64(b) as u128; - b64 | b64 >> 64 + b64 | b64 << 64 } fn memset_dynamic_scalar( @@ -484,6 +484,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { 16 => memset_dynamic_scalar(self, fill_var, 2, false), 32 => memset_dynamic_scalar(self, fill_var, 4, false), 64 => memset_dynamic_scalar(self, fill_var, 8, false), + 128 => memset_dynamic_scalar(self, fill_var, 16, false), _ => self.fatal(format!( "memset on integer width {width} not implemented yet" )), From 55099ec06181f6b7056f1c0a274f5e40de8f7555 Mon Sep 17 00:00:00 2001 From: firestar99 Date: Mon, 14 Sep 2026 01:02:53 +0200 Subject: [PATCH 11/11] update to nightly-2026-08-15 --- crates/rustc_codegen_spirv/build.rs | 4 ++-- crates/rustc_codegen_spirv/src/abi.rs | 11 ++++++++++- crates/rustc_codegen_spirv/src/codegen_cx/mod.rs | 2 +- crates/rustc_codegen_spirv/src/lib.rs | 9 ++------- rust-toolchain.toml | 4 ++-- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/crates/rustc_codegen_spirv/build.rs b/crates/rustc_codegen_spirv/build.rs index 070f8682201..ff2fa7abf8e 100644 --- a/crates/rustc_codegen_spirv/build.rs +++ b/crates/rustc_codegen_spirv/build.rs @@ -19,9 +19,9 @@ use std::{env, fs, mem}; /// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/ //const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain.toml"); const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain] -channel = "nightly-2026-08-06" +channel = "nightly-2026-08-15" components = ["rust-src", "rustc-dev", "llvm-tools"] -# commit_hash = 7608eb7b07eaf93f16d7cf5bcb2098eca87503df"#; +# commit_hash = d453bdd8f092d099bc336f0bda4163f809ad18e0"#; fn rustc_output(arg: &str) -> Result> { let rustc = env::var("RUSTC").unwrap_or_else(|_| "rustc".into()); diff --git a/crates/rustc_codegen_spirv/src/abi.rs b/crates/rustc_codegen_spirv/src/abi.rs index 3cf1feabca8..22ca4e314ac 100644 --- a/crates/rustc_codegen_spirv/src/abi.rs +++ b/crates/rustc_codegen_spirv/src/abi.rs @@ -90,7 +90,16 @@ pub(crate) fn provide(providers: &mut Providers) { let mut arg = ArgAbi::new(arg.layout, |_, _| ArgAttributes::new()); // FIXME: this is bad! https://github.com/rust-lang/rust/issues/115666 // - arg.make_direct_deprecated(); + // replaces removed `arg.make_direct_deprecated();` + arg.mode = if let PassMode::Indirect { .. } = arg.mode { + PassMode::Direct(ArgAttributes::new()) + } else if arg.layout.is_zst() { + PassMode::Ignore + } else if let PassMode::Ignore | PassMode::Direct(..) | PassMode::Pair(..) = arg.mode { + arg.mode + } else { + panic!("Tried to make {:?} direct", arg.mode) + }; // Avoid pointlessly passing ZSTs, just like the official Rust ABI. if arg.layout.is_zst() { diff --git a/crates/rustc_codegen_spirv/src/codegen_cx/mod.rs b/crates/rustc_codegen_spirv/src/codegen_cx/mod.rs index 236bc5f4adf..577889bce69 100644 --- a/crates/rustc_codegen_spirv/src/codegen_cx/mod.rs +++ b/crates/rustc_codegen_spirv/src/codegen_cx/mod.rs @@ -205,7 +205,7 @@ impl<'tcx> CodegenCx<'tcx> { let mut feature_names = tcx .sess - .target_features + .internal_target_features .iter() .map(|s| s.as_str()) .collect::>(); diff --git a/crates/rustc_codegen_spirv/src/lib.rs b/crates/rustc_codegen_spirv/src/lib.rs index bbcf14e7f02..3e77dbc81c1 100644 --- a/crates/rustc_codegen_spirv/src/lib.rs +++ b/crates/rustc_codegen_spirv/src/lib.rs @@ -212,14 +212,9 @@ impl CodegenBackend for SpirvCodegenBackend { .map(Symbol::intern) .collect(); - // HACK(eddyb) this should be a superset of `target_features`, - // which *additionally* also includes unstable target features, - // but there is no reason to make a distinction for SPIR-V ones. - let unstable_target_features = target_features.clone(); - TargetConfig { - target_features, - unstable_target_features, + // There is no stable/unstable distinction for SPIR-V target features. + internal_target_features: target_features.into_iter().collect(), // FIXME(eddyb) support and/or emulate `f16` and `f128`. has_reliable_f16: false, diff --git a/rust-toolchain.toml b/rust-toolchain.toml index f5f633ab355..7fe8bbc1f04 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,7 +1,7 @@ [toolchain] -channel = "nightly-2026-08-06" +channel = "nightly-2026-08-15" components = ["rust-src", "rustc-dev", "llvm-tools"] -# commit_hash = 7608eb7b07eaf93f16d7cf5bcb2098eca87503df +# commit_hash = d453bdd8f092d099bc336f0bda4163f809ad18e0 # Whenever changing the nightly channel, update the commit hash above, and # change `REQUIRED_RUST_TOOLCHAIN` in `crates/rustc_codegen_spirv/build.rs` too.