diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2012-10-11 13:11:07 -0700 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2012-10-11 13:11:07 -0700 |
| commit | c46706fffdfc54fcb19fee543e6ad8a4c4b79ca4 (patch) | |
| tree | 267d8bb4946ef4be34f7ee9d3c981bfb09f18fbe | |
| parent | e257f390e12f3eb414152a474259ccd8641627aa (diff) | |
manual: add borrow operator to symbolic unary operator list; mention copy and move.
| -rw-r--r-- | doc/rust.md | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/doc/rust.md b/doc/rust.md index feed0a81778..a01a28f68a3 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -1636,8 +1636,9 @@ task in a _failing state_. ### Unary operator expressions -Rust defines five unary operators. They are all written as prefix -operators, before the expression they apply to. +Rust defines six symbolic unary operators, +in addition to the unary [copy](#unary-copy-expressions) and [move](#unary-move-expressions) operators. +They are all written as prefix operators, before the expression they apply to. `-` : Negation. May only be applied to numeric types. @@ -1652,9 +1653,12 @@ operators, before the expression they apply to. `false`. On integer types, this inverts the individual bits in the two's complement representation of the value. `@` and `~` - : [Boxing](#box-types) operators. Allocate a box to hold the value - they are applied to, and store the value in it. `@` creates a - shared, reference-counted box, whereas `~` creates a unique box. + : [Boxing](#pointer-types) operators. Allocate a box to hold the value they are applied to, + and store the value in it. `@` creates a managed box, whereas `~` creates an owned box. +`&` + : Borrow operator. Returns a borrowed pointer, pointing to its operand. + The operand of a borrowed pointer is statically proven to outlive the resulting pointer. + If the borrow-checker cannot prove this, it is a compilation error. ### Binary operator expressions |
