Skip to content

Commit d86d39c

Browse files
authored
Merge pull request #178 from RalfJung/aliasing
Edit aliasing section
2 parents 71f8b1c + af56d0a commit d86d39c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

reference/src/glossary.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22

33
#### Aliasing
44

5-
(Please note: a full aliasing model for Rust has not yet been constructed, but
6-
at the moment we can give the following definition. The most developed potential
7-
aliasing model so far is known as "Stacked Borrows", and can be found
8-
[here](https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md).)
9-
10-
*Aliasing* is any time one pointer or reference points to a "span" of memory
5+
*Aliasing* occurs when one pointer or reference points to a "span" of memory
116
that overlaps with the span of another pointer or reference. A span of memory is
127
similar to how a slice works: there's a base byte address as well as a length in
138
bytes.
149

10+
**Note**: a full aliasing model for Rust, defining when aliasing is allowed
11+
and when not, has not yet been defined. The purpose of this definition is to
12+
define when aliasing *happens*, not when it is *allowed*. The most developed
13+
potential aliasing model so far is known as "Stacked Borrows", and can be found
14+
[here](https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md).
15+
1516
Consider the following example:
1617

1718
```rust
@@ -33,7 +34,6 @@ byte of `u` and `tail` points to the other seven bytes of `u` after it. Both `he
3334
and `tail` alias `s`, any overlap is sufficient to count as an alias.
3435

3536
The span of a pointer or reference is the size of the value being pointed to or referenced.
36-
3737
Depending on the type, you can determine the size as follows:
3838

3939
* For a type `T` that is [`Sized`](https://doc.rust-lang.org/core/marker/trait.Sized.html)

0 commit comments

Comments
 (0)