Skip to content

reference.md: clarify negation. #31664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down