We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1a5f8bc commit de4dddfCopy full SHA for de4dddf
tests/ui/mir/addrof_alignment.rs
@@ -0,0 +1,15 @@
1
+// run-pass
2
+// ignore-wasm32-bare: No panic messages
3
+// compile-flags: -C debug-assertions
4
+
5
+struct Misalignment {
6
+ a: u32,
7
+}
8
9
+fn main() {
10
+ let items: [Misalignment; 2] = [Misalignment { a: 0 }, Misalignment { a: 1 }];
11
+ unsafe {
12
+ let ptr: *const Misalignment = items.as_ptr().cast::<u8>().add(1).cast::<Misalignment>();
13
+ let _ptr = core::ptr::addr_of!((*ptr).a);
14
+ }
15
0 commit comments