File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -379,6 +379,10 @@ Examples of integer literals of various forms:
3793790usize; // type usize
380380```
381381
382+ Note that the Rust syntax considers ` -1i8 ` as an application of the [ unary minus
383+ operator] ( #unary-operator-expressions ) to an integer literal ` 1i8 ` , rather than
384+ a single integer literal.
385+
382386##### Floating-point literals
383387
384388A _ 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
27762780before the expression they apply to.
27772781
27782782* ` - `
2779- : Negation. May only be applied to numeric types.
2783+ : Negation. Signed integer types and floating-point types support negation. It
2784+ is an error to apply negation to unsigned types; for example, the compiler
2785+ rejects ` -1u32 ` .
27802786* ` * `
27812787 : Dereference. When applied to a [ pointer] ( #pointer-types ) it denotes the
27822788 pointed-to location. For pointers to mutable locations, the resulting
You can’t perform that action at this time.
0 commit comments