Making some more edits as a result of discussion

This commit is contained in:
Carol (Nichols || Goulding) 2016-11-08 15:15:55 -05:00
parent aceb7d00e5
commit f2c687dd88
2 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@ understand how ownership works in Rust. In this chapter well talk about
ownership as well as several related features: borrowing, slices, and how Rust ownership as well as several related features: borrowing, slices, and how Rust
lays things out in memory. lays things out in memory.
## Ownership of Memory ## What is Ownership?
Rusts central feature is *ownership*. It is a feature that is straightforward Rusts central feature is *ownership*. It is a feature that is straightforward
to explain, but has deep implications for the rest of the language. to explain, but has deep implications for the rest of the language.
@ -417,9 +417,9 @@ Rust has a special annotation called the `Copy` trait that we can place on
types like these (well talk more about traits in Chapter 10). If a type has types like these (well talk more about traits in Chapter 10). If a type has
the `Copy` trait, an older variable is still usable after assignment. Rust will the `Copy` trait, an older variable is still usable after assignment. Rust will
not let us annotate a type with the `Copy` trait if the type, or any of its not let us annotate a type with the `Copy` trait if the type, or any of its
parts, has implemented `drop`. <!-- Maybe pedantry, but “implemented X” sounds like X is a trait, and there is a trait (“Drop”, containing a method “drop”) so this could get confusing. On top of that, the drop function in the prelude is not directly related. /eddyb --> If the type needs something special to happen parts, has implemented the `Drop` trait. <!-- Maybe pedantry, but “implemented X” sounds like X is a trait, and there is a trait (“Drop”, containing a method “drop”) so this could get confusing. On top of that, the drop function in the prelude is not directly related. /eddyb --> If the type needs something special
when the value goes out of scope and we add the `Copy` annotation to that type, to happen when the value goes out of scope and we add the `Copy` annotation to
we will get a compile-time error. that type, we will get a compile-time error.
So what types are `Copy`? You can check the documentation for the given type to So what types are `Copy`? You can check the documentation for the given type to
be sure, but as a rule of thumb, any group of simple scalar values can be Copy, be sure, but as a rule of thumb, any group of simple scalar values can be Copy,

Binary file not shown.