Skip to content

Commit d3a9059

Browse files
committed
update to nightly-2026-06-09, codegen ICEs
1 parent fa9fa14 commit d3a9059

5 files changed

Lines changed: 32 additions & 24 deletions

File tree

crates/rustc_codegen_spirv/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ use std::{env, fs, mem};
1919
/// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/
2020
//const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain.toml");
2121
const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain]
22-
channel = "nightly-2026-05-22"
22+
channel = "nightly-2026-06-09"
2323
components = ["rust-src", "rustc-dev", "llvm-tools"]
24-
# commit_hash = e96c36b6f76833388c519561d145492d2c08db4e"#;
24+
# commit_hash = cb46fbb8c6ea799c6fba9188ed889275c35a8c28"#;
2525

2626
fn rustc_output(arg: &str) -> Result<String, Box<dyn Error>> {
2727
let rustc = env::var("RUSTC").unwrap_or_else(|_| "rustc".into());

crates/rustc_codegen_spirv/src/builder/intrinsics.rs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ use crate::spirv_type::SpirvType;
1010
use rspirv::dr::Operand;
1111
use rspirv::spirv::GLOp;
1212
use rustc_codegen_ssa::RetagInfo;
13+
use rustc_codegen_ssa::mir::IntrinsicResult;
1314
use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
14-
use rustc_codegen_ssa::mir::place::PlaceRef;
15+
use rustc_codegen_ssa::mir::place::{PlaceRef, PlaceValue};
1516
use rustc_codegen_ssa::traits::{BuilderMethods, IntrinsicCallBuilderMethods};
1617
use rustc_middle::ty::layout::LayoutOf;
1718
use rustc_middle::ty::{FnDef, Instance, Ty, TyKind, TypingEnv};
@@ -64,9 +65,14 @@ impl<'a, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'tcx> {
6465
&mut self,
6566
instance: Instance<'tcx>,
6667
args: &[OperandRef<'tcx, Self::Value>],
67-
result: PlaceRef<'tcx, Self::Value>,
68+
result_layout: ty::layout::TyAndLayout<'tcx>,
69+
result_place: Option<PlaceValue<Self::Value>>,
6870
_span: Span,
69-
) -> Result<(), ty::Instance<'tcx>> {
71+
) -> IntrinsicResult<'tcx, Self::Value> {
72+
let result = PlaceRef {
73+
val: result_place.unwrap(),
74+
layout: result_layout,
75+
};
7076
let callee_ty = instance.ty(self.tcx, TypingEnv::fully_monomorphized());
7177

7278
let (def_id, fn_args) = match *callee_ty.kind() {
@@ -95,7 +101,7 @@ impl<'a, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'tcx> {
95101
sym::breakpoint => {
96102
self.abort();
97103
assert!(result.layout.ty.is_unit());
98-
return Ok(());
104+
return IntrinsicResult::WroteIntoPlace;
99105
}
100106

101107
sym::volatile_load | sym::unaligned_volatile_load => {
@@ -105,7 +111,7 @@ impl<'a, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'tcx> {
105111
if !result.layout.is_zst() {
106112
self.store(load, result.val.llval, result.val.align);
107113
}
108-
return Ok(());
114+
return IntrinsicResult::WroteIntoPlace;
109115
}
110116

111117
sym::prefetch_read_data
@@ -114,7 +120,7 @@ impl<'a, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'tcx> {
114120
| sym::prefetch_write_instruction => {
115121
// ignore
116122
assert!(result.layout.ty.is_unit());
117-
return Ok(());
123+
return IntrinsicResult::WroteIntoPlace;
118124
}
119125

120126
sym::saturating_add => {
@@ -352,7 +358,10 @@ impl<'a, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'tcx> {
352358

353359
_ => {
354360
// Call the fallback body instead of generating the intrinsic code
355-
return Err(ty::Instance::new_raw(instance.def_id(), instance.args));
361+
return IntrinsicResult::Fallback(Instance::new_raw(
362+
instance.def_id(),
363+
instance.args,
364+
));
356365
}
357366
};
358367

@@ -368,7 +377,7 @@ impl<'a, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'tcx> {
368377
.val
369378
.store(self, result);
370379
}
371-
Ok(())
380+
IntrinsicResult::WroteIntoPlace
372381
}
373382

374383
fn codegen_llvm_intrinsic_call(
@@ -402,16 +411,9 @@ impl<'a, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'tcx> {
402411
todo!()
403412
}
404413

405-
fn va_start(&mut self, val: Self::Value) -> Self::Value {
406-
// SPIR-V backend has no variadic ABI support; keep the placeholder
407-
// operand unchanged so MIR lowering can proceed without crashing.
408-
val
409-
}
414+
fn va_start(&mut self, _val: Self::Value) {}
410415

411-
fn va_end(&mut self, val: Self::Value) -> Self::Value {
412-
// See `va_start` above.
413-
val
414-
}
416+
fn va_end(&mut self, _val: Self::Value) {}
415417

416418
fn retag_mem(&mut self, _place: Self::Value, _info: &RetagInfo<Self::Value>) {
417419
bug!("retag not supported")

crates/rustc_codegen_spirv/src/codegen_cx/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,10 @@ impl<'tcx> MiscCodegenMethods<'tcx> for CodegenCx<'tcx> {
930930
fn declare_c_main(&self, _fn_type: Self::FunctionSignature) -> Option<Self::Function> {
931931
todo!()
932932
}
933+
934+
fn intrinsic_call_expects_place_always(&self, _: Symbol) -> bool {
935+
true
936+
}
933937
}
934938

935939
impl<'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'tcx> {

crates/rustc_codegen_spirv/src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,10 @@ use maybe_pqp_cg_ssa::{
152152
};
153153
use rspirv::binary::Assemble;
154154
use rustc_ast::expand::allocator::AllocatorMethod;
155-
use rustc_data_structures::fx::FxIndexMap;
156155
use rustc_data_structures::profiling::SelfProfilerRef;
157156
use rustc_errors::DiagCtxtHandle;
158157
use rustc_metadata::EncodedMetadata;
159-
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
158+
use rustc_middle::dep_graph::{WorkProduct, WorkProductMap};
160159
use rustc_middle::mono::{MonoItem, MonoItemData};
161160
use rustc_middle::ty::print::with_no_trimmed_paths;
162161
use rustc_middle::ty::{InstanceKind, TyCtxt};
@@ -258,7 +257,7 @@ impl CodegenBackend for SpirvCodegenBackend {
258257
sess: &Session,
259258
_outputs: &OutputFilenames,
260259
crate_info: &CrateInfo,
261-
) -> (CompiledModules, FxIndexMap<WorkProductId, WorkProduct>) {
260+
) -> (CompiledModules, WorkProductMap) {
262261
ongoing_codegen
263262
.downcast::<OngoingCodegen<Self>>()
264263
.expect("Expected OngoingCodegen, found Box<Any>")
@@ -411,6 +410,7 @@ impl WriteBackendMethods for SpirvCodegenBackend {
411410
name,
412411
kind,
413412
object: Some(path),
413+
global_asm_object: None,
414414
dwarf_object: None,
415415
bytecode: None,
416416
assembly: None,
@@ -434,6 +434,8 @@ impl WriteBackendMethods for SpirvCodegenBackend {
434434
}
435435

436436
impl ExtraBackendMethods for SpirvCodegenBackend {
437+
type Module = rspirv::dr::Module;
438+
437439
fn codegen_allocator(&self, _: TyCtxt<'_>, _: &str, _: &[AllocatorMethod]) -> Self::Module {
438440
todo!()
439441
}

rust-toolchain.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[toolchain]
2-
channel = "nightly-2026-05-22"
2+
channel = "nightly-2026-06-09"
33
components = ["rust-src", "rustc-dev", "llvm-tools"]
4-
# commit_hash = e96c36b6f76833388c519561d145492d2c08db4e
4+
# commit_hash = cb46fbb8c6ea799c6fba9188ed889275c35a8c28
55

66
# Whenever changing the nightly channel, update the commit hash above, and
77
# change `REQUIRED_RUST_TOOLCHAIN` in `crates/rustc_codegen_spirv/build.rs` too.

0 commit comments

Comments
 (0)