about summary refs log tree commit diff
path: root/src/docs/cast_ptr_alignment.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/docs/cast_ptr_alignment.txt')
-rw-r--r--src/docs/cast_ptr_alignment.txt21
1 files changed, 0 insertions, 21 deletions
diff --git a/src/docs/cast_ptr_alignment.txt b/src/docs/cast_ptr_alignment.txt
deleted file mode 100644
index 6a6d4dcaa2a..00000000000
--- a/src/docs/cast_ptr_alignment.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-### What it does
-Checks for casts, using `as` or `pointer::cast`,
-from a less-strictly-aligned pointer to a more-strictly-aligned pointer
-
-### Why is this bad?
-Dereferencing the resulting pointer may be undefined
-behavior.
-
-### Known problems
-Using `std::ptr::read_unaligned` and `std::ptr::write_unaligned` or similar
-on the resulting pointer is fine. Is over-zealous: Casts with manual alignment checks or casts like
-u64-> u8 -> u16 can be fine. Miri is able to do a more in-depth analysis.
-
-### Example
-```
-let _ = (&1u8 as *const u8) as *const u16;
-let _ = (&mut 1u8 as *mut u8) as *mut u16;
-
-(&1u8 as *const u8).cast::<u16>();
-(&mut 1u8 as *mut u8).cast::<u16>();
-```
\ No newline at end of file