rephrase dangling section

This commit is contained in:
Steve Klabnik 2016-01-20 16:01:06 -05:00
parent 14c284e6d8
commit fbffce8a6e

View File

@ -210,9 +210,11 @@ from under them! Multiple immutable references are okay, however.
## Dangling references
Rusts references must always be valid. In other words, if we have a reference
to something, it must not go out of scope before the reference does. Dangling
references are a pervasive problem in languages that support them.
In languages with pointers, its easy to crate a “dangling pointer” by freeing
some memory while keeping around a pointer to that memory. In Rust, by
contrast, the compiler guarantees that references will never be dangling: if we
have a reference the something, the compiler will ensure that it will not go
out of scope before the reference does.
Lets try to create a dangling reference: