Skip to content

Commit e3a060c

Browse files
committed
Update to nightly-2025-07-14.
- `BuilderMethods::dynamic_alloca` was removed. - `TargetDataLayout::pointer_{size,align}` were changed from fields to methods. - `AddressSpace::DATA` was renamed `AddressSpace::ZERO`.
1 parent 7d65239 commit e3a060c

File tree

7 files changed

+27
-19
lines changed

7 files changed

+27
-19
lines changed

crates/rustc_codegen_spirv/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ use std::{env, fs, mem};
1818
/// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/
1919
//const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain.toml");
2020
const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain]
21-
channel = "nightly-2025-07-07"
21+
channel = "nightly-2025-07-14"
2222
components = ["rust-src", "rustc-dev", "llvm-tools"]
23-
# commit_hash = a84ab0ce6c4557a2f01a3a6c3fdb0f92098db78d"#;
23+
# commit_hash = e9182f195b8505c87c4bd055b9f6e114ccda0981"#;
2424

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

crates/rustc_codegen_spirv/src/abi.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ fn trans_intrinsic_type<'tcx>(
791791
let sampled_type = match args.type_at(0).kind() {
792792
TyKind::Int(int) => match int {
793793
IntTy::Isize => {
794-
SpirvType::Integer(cx.tcx.data_layout.pointer_size.bits() as u32, true)
794+
SpirvType::Integer(cx.tcx.data_layout.pointer_size().bits() as u32, true)
795795
.def(span, cx)
796796
}
797797
IntTy::I8 => SpirvType::Integer(8, true).def(span, cx),
@@ -802,7 +802,7 @@ fn trans_intrinsic_type<'tcx>(
802802
},
803803
TyKind::Uint(uint) => match uint {
804804
UintTy::Usize => {
805-
SpirvType::Integer(cx.tcx.data_layout.pointer_size.bits() as u32, false)
805+
SpirvType::Integer(cx.tcx.data_layout.pointer_size().bits() as u32, false)
806806
.def(span, cx)
807807
}
808808
UintTy::U8 => SpirvType::Integer(8, false).def(span, cx),

crates/rustc_codegen_spirv/src/builder/builder_methods.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,10 +1828,6 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
18281828
self.declare_func_local_var(self.type_array(self.type_i8(), size.bytes()), align)
18291829
}
18301830

1831-
fn dynamic_alloca(&mut self, _len: Self::Value, _align: Align) -> Self::Value {
1832-
self.fatal("dynamic alloca not supported yet")
1833-
}
1834-
18351831
fn load(&mut self, ty: Self::Type, ptr: Self::Value, _align: Align) -> Self::Value {
18361832
let (ptr, access_ty) = self.adjust_pointer_for_typed_access(ptr, ty);
18371833
let loaded_val = ptr.const_fold_load(self).unwrap_or_else(|| {

crates/rustc_codegen_spirv/src/codegen_cx/constant.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl ConstCodegenMethods for CodegenCx<'_> {
152152
self.const_uint_big(ty, i)
153153
}
154154
fn const_usize(&self, i: u64) -> Self::Value {
155-
let ptr_size = self.tcx.data_layout.pointer_size.bits() as u32;
155+
let ptr_size = self.tcx.data_layout.pointer_size().bits() as u32;
156156
let t = SpirvType::Integer(ptr_size, false).def(DUMMY_SP, self);
157157
self.constant_int(t, i.into())
158158
}
@@ -263,7 +263,7 @@ impl ConstCodegenMethods for CodegenCx<'_> {
263263
.try_read_from_const_alloc(alloc, pointee)
264264
.unwrap_or_else(|| self.const_data_from_alloc(alloc));
265265
let value = self.static_addr_of(init, alloc.inner().align, None);
266-
(value, AddressSpace::DATA)
266+
(value, AddressSpace::ZERO)
267267
}
268268
GlobalAlloc::Function { instance } => (
269269
self.get_fn_addr(instance),
@@ -292,12 +292,24 @@ impl ConstCodegenMethods for CodegenCx<'_> {
292292
.try_read_from_const_alloc(alloc, pointee)
293293
.unwrap_or_else(|| self.const_data_from_alloc(alloc));
294294
let value = self.static_addr_of(init, alloc.inner().align, None);
295-
(value, AddressSpace::DATA)
295+
(value, AddressSpace::ZERO)
296296
}
297297
GlobalAlloc::Static(def_id) => {
298298
assert!(self.tcx.is_static(def_id));
299299
assert!(!self.tcx.is_thread_local_static(def_id));
300-
(self.get_static(def_id), AddressSpace::DATA)
300+
(self.get_static(def_id), AddressSpace::ZERO)
301+
}
302+
GlobalAlloc::TypeId { .. } => {
303+
return if offset.bytes() == 0 {
304+
self.constant_null(ty)
305+
} else {
306+
let result = self.undef(ty);
307+
self.zombie_no_span(
308+
result.def_cx(self),
309+
"pointer has non-null integer address",
310+
);
311+
result
312+
};
301313
}
302314
};
303315
self.const_bitcast(self.const_ptr_byte_offset(base_addr, offset), ty)
@@ -430,7 +442,7 @@ impl<'tcx> CodegenCx<'tcx> {
430442
.fatal(format!("invalid size for float: {other}"));
431443
}
432444
}),
433-
SpirvType::Pointer { .. } => Primitive::Pointer(AddressSpace::DATA),
445+
SpirvType::Pointer { .. } => Primitive::Pointer(AddressSpace::ZERO),
434446
_ => unreachable!(),
435447
};
436448

crates/rustc_codegen_spirv/src/codegen_cx/type_.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<'tcx> LayoutTypeCodegenMethods<'tcx> for CodegenCx<'tcx> {
124124

125125
impl<'tcx> CodegenCx<'tcx> {
126126
pub fn type_usize(&self) -> Word {
127-
let ptr_size = self.tcx.data_layout.pointer_size.bits() as u32;
127+
let ptr_size = self.tcx.data_layout.pointer_size().bits() as u32;
128128
SpirvType::Integer(ptr_size, false).def(DUMMY_SP, self)
129129
}
130130
}
@@ -146,7 +146,7 @@ impl BaseTypeCodegenMethods for CodegenCx<'_> {
146146
SpirvType::Integer(128, false).def(DUMMY_SP, self)
147147
}
148148
fn type_isize(&self) -> Self::Type {
149-
let ptr_size = self.tcx.data_layout.pointer_size.bits() as u32;
149+
let ptr_size = self.tcx.data_layout.pointer_size().bits() as u32;
150150
SpirvType::Integer(ptr_size, false).def(DUMMY_SP, self)
151151
}
152152

crates/rustc_codegen_spirv/src/spirv_type.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ impl SpirvType<'_> {
294294
.try_into()
295295
.unwrap()
296296
}
297-
Self::Pointer { .. } => cx.tcx.data_layout.pointer_size,
297+
Self::Pointer { .. } => cx.tcx.data_layout.pointer_size(),
298298
Self::Image { .. }
299299
| Self::AccelerationStructureKhr
300300
| Self::RayQueryKhr
@@ -316,7 +316,7 @@ impl SpirvType<'_> {
316316
Self::Array { element, .. }
317317
| Self::RuntimeArray { element }
318318
| Self::Matrix { element, .. } => cx.lookup_type(element).alignof(cx),
319-
Self::Pointer { .. } => cx.tcx.data_layout.pointer_align.abi,
319+
Self::Pointer { .. } => cx.tcx.data_layout.pointer_align().abi,
320320
Self::Image { .. }
321321
| Self::AccelerationStructureKhr
322322
| Self::RayQueryKhr

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-2025-07-07"
2+
channel = "nightly-2025-07-14"
33
components = ["rust-src", "rustc-dev", "llvm-tools"]
4-
# commit_hash = a84ab0ce6c4557a2f01a3a6c3fdb0f92098db78d
4+
# commit_hash = e9182f195b8505c87c4bd055b9f6e114ccda0981
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)