Skip to content

Commit 85b6040

Browse files
committed
typed buffer: silly fix for TypedBuffer with slices deref()'ing
you'd think this shouldn't work as `&mut` is not `*mut`, but it actually compiles to correct bytecode
1 parent 240c681 commit 85b6040

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/spirv-std/src/typed_buffer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl<T> Deref for TypedBuffer<[T]> {
7272
"%result = OpCompositeConstruct typeof*{result_slot} %inner_ptr %inner_len",
7373
"OpStore {result_slot} %result",
7474
buffer = in(reg) self,
75-
result_slot = in(reg) result_slot.as_mut_ptr(),
75+
result_slot = in(reg) &mut result_slot,
7676
}
7777
result_slot.assume_init()
7878
}
@@ -92,7 +92,7 @@ impl<T> DerefMut for TypedBuffer<[T]> {
9292
"%result = OpCompositeConstruct typeof*{result_slot} %inner_ptr %inner_len",
9393
"OpStore {result_slot} %result",
9494
buffer = in(reg) self,
95-
result_slot = in(reg) result_slot.as_mut_ptr(),
95+
result_slot = in(reg) &mut result_slot,
9696
}
9797
result_slot.assume_init()
9898
}

0 commit comments

Comments
 (0)