about summary refs log tree commit diff
path: root/src/docs/ptr_eq.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/docs/ptr_eq.txt')
-rw-r--r--src/docs/ptr_eq.txt22
1 files changed, 0 insertions, 22 deletions
diff --git a/src/docs/ptr_eq.txt b/src/docs/ptr_eq.txt
deleted file mode 100644
index 06b36ca55e6..00000000000
--- a/src/docs/ptr_eq.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-### What it does
-Use `std::ptr::eq` when applicable
-
-### Why is this bad?
-`ptr::eq` can be used to compare `&T` references
-(which coerce to `*const T` implicitly) by their address rather than
-comparing the values they point to.
-
-### Example
-```
-let a = &[1, 2, 3];
-let b = &[1, 2, 3];
-
-assert!(a as *const _ as usize == b as *const _ as usize);
-```
-Use instead:
-```
-let a = &[1, 2, 3];
-let b = &[1, 2, 3];
-
-assert!(std::ptr::eq(a, b));
-```
\ No newline at end of file