Skip to content

Commit 707de59

Browse files
committed
update toolchain to nightly-2026-04-08
1 parent ddb039b commit 707de59

File tree

8 files changed

+31
-84
lines changed

8 files changed

+31
-84
lines changed

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-04-02"
22+
channel = "nightly-2026-04-08"
2323
components = ["rust-src", "rustc-dev", "llvm-tools"]
24-
# commit_hash = 7e46c5f6fb87f8cf4353e058479cef15d1d952b4"#;
24+
# commit_hash = c756124775121dea0e640652c5ee3c89e3dd0eb4"#;
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/builder_methods.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use crate::maybe_pqp_cg_ssa as rustc_codegen_ssa;
33

44
use super::Builder;
55
use crate::abi::ConvSpirvType;
6+
use crate::builder::format_args_decompiler::{CodegenPanic, DecodedFormatArgs};
67
use crate::builder_spirv::{
78
SpirvBlockCursor, SpirvConst, SpirvValue, SpirvValueExt, SpirvValueKind,
89
};
@@ -26,14 +27,13 @@ use rustc_codegen_ssa::traits::{
2627
};
2728
use rustc_middle::bug;
2829
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
30+
use rustc_middle::ty::layout::TyAndLayout;
2931
use rustc_middle::ty::{self, AtomicOrdering, Ty};
3032
use rustc_span::Span;
3133
use rustc_target::callconv::FnAbi;
3234
use smallvec::SmallVec;
3335
use std::iter::{self, empty};
3436
use std::ops::{BitAnd, BitOr, BitXor, Not, RangeInclusive};
35-
36-
use crate::builder::format_args_decompiler::{CodegenPanic, DecodedFormatArgs};
3737
use tracing::{Level, instrument, span};
3838
use tracing::{trace, warn};
3939

@@ -1825,10 +1825,6 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
18251825
self.declare_func_local_var(self.type_array(self.type_i8(), size.bytes()), align)
18261826
}
18271827

1828-
fn scalable_alloca(&mut self, _elt: u64, _align: Align, _element_ty: Ty<'_>) -> Self::Value {
1829-
bug!("scalable alloca is not supported in SPIR-V backend")
1830-
}
1831-
18321828
fn load(&mut self, ty: Self::Type, ptr: Self::Value, _align: Align) -> Self::Value {
18331829
let (ptr, access_ty) = self.adjust_pointer_for_typed_access(ptr, ty);
18341830
let loaded_val = ptr.const_fold_load(self).unwrap_or_else(|| {
@@ -3081,10 +3077,6 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
30813077
bug!("Funclets are not supported")
30823078
}
30833079

3084-
fn get_funclet_cleanuppad(&self, _funclet: &Self::Funclet) -> Self::Value {
3085-
bug!("Funclets are not supported")
3086-
}
3087-
30883080
fn atomic_cmpxchg(
30893081
&mut self,
30903082
dst: Self::Value,
@@ -3466,4 +3458,8 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
34663458
fn apply_attrs_to_cleanup_callsite(&mut self, _llret: Self::Value) {
34673459
// Ignore
34683460
}
3461+
3462+
fn alloca_with_ty(&mut self, _layout: TyAndLayout<'tcx>) -> Self::Value {
3463+
bug!("scalable alloca is not supported in SPIR-V backend")
3464+
}
34693465
}

crates/rustc_codegen_spirv/src/codegen_cx/constant.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ impl ConstCodegenMethods for CodegenCx<'_> {
141141
fn const_i32(&self, i: i32) -> Self::Value {
142142
self.constant_i32(DUMMY_SP, i)
143143
}
144+
fn const_i64(&self, i: i64) -> Self::Value {
145+
self.constant_i64(DUMMY_SP, i)
146+
}
147+
fn const_u8(&self, i: u8) -> Self::Value {
148+
self.constant_u8(DUMMY_SP, i)
149+
}
144150
fn const_u32(&self, i: u32) -> Self::Value {
145151
self.constant_u32(DUMMY_SP, i)
146152
}
@@ -156,9 +162,6 @@ impl ConstCodegenMethods for CodegenCx<'_> {
156162
let t = SpirvType::Integer(ptr_size, false).def(DUMMY_SP, self);
157163
self.constant_int(t, i.into())
158164
}
159-
fn const_u8(&self, i: u8) -> Self::Value {
160-
self.constant_u8(DUMMY_SP, i)
161-
}
162165
fn const_real(&self, t: Self::Type, val: f64) -> Self::Value {
163166
self.constant_float(t, val)
164167
}

crates/rustc_codegen_spirv/src/codegen_cx/declare.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_hir::attrs::{InlineAttr, Linkage};
1414
use rustc_middle::bug;
1515
use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
1616
use rustc_middle::mir::interpret::ConstAllocation;
17-
use rustc_middle::mir::mono::{MonoItem, Visibility};
17+
use rustc_middle::mono::{MonoItem, Visibility};
1818
use rustc_middle::ty::layout::{FnAbiOf, LayoutOf};
1919
use rustc_middle::ty::{self, Instance, TypeVisitableExt, TypingEnv};
2020
use rustc_span::Span;

crates/rustc_codegen_spirv/src/codegen_cx/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use rustc_codegen_ssa::traits::{
2828
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
2929
use rustc_hir::def_id::DefId;
3030
use rustc_middle::mir;
31-
use rustc_middle::mir::mono::CodegenUnit;
31+
use rustc_middle::mono::CodegenUnit;
3232
use rustc_middle::ty::layout::{HasTyCtxt, HasTypingEnv};
3333
use rustc_middle::ty::{self, Instance, Ty, TyCtxt, TypingEnv};
3434
use rustc_session::Session;

crates/rustc_codegen_spirv/src/lib.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,10 @@ mod symbols;
133133
mod target;
134134
mod target_feature;
135135

136+
use crate::maybe_pqp_cg_ssa::back::write::ThinLtoInput;
136137
use builder::Builder;
137138
use codegen_cx::CodegenCx;
138-
use maybe_pqp_cg_ssa::back::lto::{SerializedModule, ThinModule};
139+
use maybe_pqp_cg_ssa::back::lto::ThinModule;
139140
use maybe_pqp_cg_ssa::back::write::{
140141
CodegenContext, FatLtoInput, ModuleConfig, OngoingCodegen, SharedEmitter,
141142
TargetMachineFactoryFn,
@@ -152,10 +153,11 @@ use rspirv::binary::Assemble;
152153
use rustc_ast::expand::allocator::AllocatorMethod;
153154
use rustc_data_structures::fx::FxIndexMap;
154155
use rustc_data_structures::profiling::SelfProfilerRef;
156+
use rustc_errors::DiagCtxtHandle;
155157
use rustc_metadata::EncodedMetadata;
156158
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
157-
use rustc_middle::mir::mono::{MonoItem, MonoItemData};
158159
use rustc_middle::mir::pretty::write_mir_pretty;
160+
use rustc_middle::mono::{MonoItem, MonoItemData};
159161
use rustc_middle::ty::print::with_no_trimmed_paths;
160162
use rustc_middle::ty::{InstanceKind, TyCtxt};
161163
use rustc_session::Session;
@@ -338,16 +340,15 @@ impl WriteBackendMethods for SpirvCodegenBackend {
338340
}
339341

340342
fn run_thin_lto(
341-
cgcx: &CodegenContext,
343+
_cgcx: &CodegenContext,
342344
_prof: &SelfProfilerRef,
343-
_dcx: rustc_errors::DiagCtxtHandle<'_>,
344-
// FIXME(bjorn3): Limit LTO exports to these symbols
345+
_dcx: DiagCtxtHandle<'_>,
345346
_exported_symbols_for_lto: &[String],
346-
_each_linked_rlib_for_lto: &[PathBuf], // njn: ?
347-
modules: Vec<(String, Self::ModuleBuffer)>,
348-
cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>,
347+
_each_linked_rlib_for_lto: &[PathBuf],
348+
_modules: Vec<ThinLtoInput<Self>>,
349349
) -> (Vec<ThinModule<Self>>, Vec<WorkProduct>) {
350-
link::run_thin(cgcx, modules, cached_modules)
350+
// Note(@firestar99): gcc impl this as unreachable as well
351+
unreachable!()
351352
}
352353

353354
fn optimize(

crates/rustc_codegen_spirv/src/link.rs

Lines changed: 3 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,33 @@
22
use crate::maybe_pqp_cg_ssa as rustc_codegen_ssa;
33

44
use crate::codegen_cx::{CodegenArgs, SpirvMetadata};
5-
use crate::{SpirvCodegenBackend, SpirvModuleBuffer, linker};
5+
use crate::linker;
66
use ar::{Archive, GnuBuilder, Header};
77
use rspirv::binary::Assemble;
88
use rspirv::dr::Module;
99
use rustc_attr_parsing::eval_config_entry;
1010
use rustc_codegen_spirv_types::{CompileResult, ModuleResult};
11-
use rustc_codegen_ssa::back::lto::{SerializedModule, ThinModule, ThinShared};
12-
use rustc_codegen_ssa::back::write::CodegenContext;
1311
use rustc_codegen_ssa::{CompiledModules, CrateInfo, NativeLib};
1412
use rustc_data_structures::fx::FxHashSet;
1513
use rustc_errors::Diag;
1614
use rustc_hir::attrs::NativeLibKind;
1715
use rustc_metadata::{EncodedMetadata, fs::METADATA_FILENAME};
1816
use rustc_middle::bug;
19-
use rustc_middle::dep_graph::WorkProduct;
2017
use rustc_middle::middle::dependency_format::Linkage;
2118
use rustc_session::Session;
2219
use rustc_session::config::{
23-
CrateType, DebugInfo, Lto, OptLevel, OutFileName, OutputFilenames, OutputType,
20+
CrateType, DebugInfo, OptLevel, OutFileName, OutputFilenames, OutputType,
2421
};
2522
use rustc_session::output::{check_file_is_writeable, invalid_output_for_target, out_filename};
2623
use rustc_span::Symbol;
2724
use spirv_tools::TargetEnv;
2825
use std::collections::BTreeMap;
29-
use std::ffi::{CString, OsStr};
26+
use std::ffi::OsStr;
3027
use std::fs::File;
3128
use std::io::{BufWriter, Read};
3229
use std::iter;
3330
use std::path::{Path, PathBuf};
3431
use std::str::FromStr;
35-
use std::sync::Arc;
3632

3733
pub fn link(
3834
sess: &Session,
@@ -624,52 +620,3 @@ fn do_link(
624620
bug!("Linker errored, but no error reported");
625621
}
626622
}
627-
628-
/// As of right now, this is essentially a no-op, just plumbing through all the files.
629-
// TODO: WorkProduct impl
630-
pub(crate) fn run_thin(
631-
cgcx: &CodegenContext,
632-
modules: Vec<(String, SpirvModuleBuffer)>,
633-
cached_modules: Vec<(SerializedModule<SpirvModuleBuffer>, WorkProduct)>,
634-
) -> (Vec<ThinModule<SpirvCodegenBackend>>, Vec<WorkProduct>) {
635-
if cgcx.use_linker_plugin_lto {
636-
unreachable!("We should never reach this case if the LTO step is deferred to the linker");
637-
}
638-
assert!(
639-
cgcx.lto == Lto::ThinLocal,
640-
"no actual LTO implemented in Rust-GPU"
641-
);
642-
let mut thin_buffers = Vec::with_capacity(modules.len());
643-
let mut module_names = Vec::with_capacity(modules.len() + cached_modules.len());
644-
645-
for (name, buffer) in modules {
646-
let cname = CString::new(name.clone()).unwrap();
647-
thin_buffers.push(buffer);
648-
module_names.push(cname);
649-
}
650-
651-
let mut serialized_modules = Vec::with_capacity(cached_modules.len());
652-
653-
for (sm, wp) in cached_modules {
654-
let _slice_u8 = sm.data();
655-
serialized_modules.push(sm);
656-
module_names.push(CString::new(wp.cgu_name).unwrap());
657-
}
658-
659-
let shared = Arc::new(ThinShared {
660-
data: (),
661-
thin_buffers,
662-
serialized_modules,
663-
module_names,
664-
});
665-
666-
let mut opt_jobs = vec![];
667-
for (module_index, _) in shared.module_names.iter().enumerate() {
668-
opt_jobs.push(ThinModule {
669-
shared: shared.clone(),
670-
idx: module_index,
671-
});
672-
}
673-
674-
(opt_jobs, vec![])
675-
}

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-04-02"
2+
channel = "nightly-2026-04-08"
33
components = ["rust-src", "rustc-dev", "llvm-tools"]
4-
# commit_hash = 7e46c5f6fb87f8cf4353e058479cef15d1d952b4
4+
# commit_hash = c756124775121dea0e640652c5ee3c89e3dd0eb4
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)