You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this case, both `r` and `s` alias each other, since they both point to the
26
+
memory of `u`.
27
+
28
+
However, `head` and `tail` do not alias each other: `head` points to the first
29
+
byte of `u` and `tail` points to the other seven bytes of `u` after it.
30
+
31
+
* The span length of `&T`, `&mut T`, `*const T`, or `*mut T` when `T` is
32
+
[`Sized`](https://doc.rust-lang.org/core/marker/trait.Sized.html) is
33
+
`size_of<T>()`.
34
+
* When `T` is not `Sized` the span length is `size_of_val(t)`.
35
+
36
+
One interesting side effect of these rules is that references and pointers to
37
+
Zero Sized Types _never_ alias each other, because their span length is always 0
38
+
bytes.
39
+
3
40
#### Interior mutability
4
41
5
42
*Interior Mutation* means mutating memory where there also exists a live shared reference pointing to the same memory; or mutating memory through a pointer derived from a shared reference.
0 commit comments