File tree 1 file changed +7
-1
lines changed
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:
379
379
0usize; // type usize
380
380
```
381
381
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
+
382
386
##### Floating-point literals
383
387
384
388
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
2776
2780
before the expression they apply to.
2777
2781
2778
2782
* ` - `
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 ` .
2780
2786
* ` * `
2781
2787
: Dereference. When applied to a [ pointer] ( #pointer-types ) it denotes the
2782
2788
pointed-to location. For pointers to mutable locations, the resulting
You can’t perform that action at this time.
0 commit comments