reference.md: clarify negation.

Signed-off-by: NODA, Kai <nodakai@gmail.com>
This commit is contained in:
NODA, Kai 2016-02-15 08:05:07 +08:00
parent 71f4658c14
commit 559683cded
No known key found for this signature in database
GPG key ID: D53E75D4C4451FC2

View file

@ -379,6 +379,10 @@ Examples of integer literals of various forms:
0usize; // type usize
```
Note that the Rust syntax considers `-1i8` as an application of the [unary minus
operator](#unary-operator-expressions) to an integer literal `1i8`, rather than
a single integer literal.
##### Floating-point literals
A _floating-point literal_ has one of two forms:
@ -2776,7 +2780,9 @@ Rust defines the following unary operators. They are all written as prefix opera
before the expression they apply to.
* `-`
: Negation. May only be applied to numeric types.
: Negation. Signed integer types and floating-point types support negation. It
is an error to apply negation to unsigned types; for example, the compiler
rejects `-1u32`.
* `*`
: Dereference. When applied to a [pointer](#pointer-types) it denotes the
pointed-to location. For pointers to mutable locations, the resulting