@@ -465,13 +465,9 @@ An _integer literal_ has one of four forms:
465
465
466
466
Like any literal, an integer literal may be followed (immediately,
467
467
without any spaces) by an _ integer suffix_ , which forcibly sets the
468
- type of the literal. There are 10 valid values for an integer suffix:
469
-
470
- * Each of the signed and unsigned machine types ` u8 ` , ` i8 ` ,
471
- ` u16 ` , ` i16 ` , ` u32 ` , ` i32 ` , ` u64 ` and ` i64 `
472
- give the literal the corresponding machine type.
473
- * The ` is ` and ` us ` suffixes give the literal type ` isize ` or ` usize ` ,
474
- respectively.
468
+ type of the literal. The integer suffix must be the name of one of the
469
+ integral types: ` u8 ` , ` i8 ` , ` u16 ` , ` i16 ` , ` u32 ` , ` i32 ` , ` u64 ` , ` i64 ` ,
470
+ ` isize ` , or ` usize ` .
475
471
476
472
The type of an _ unsuffixed_ integer literal is determined by type inference.
477
473
If an integer type can be _ uniquely_ determined from the surrounding program
@@ -489,7 +485,7 @@ Examples of integer literals of various forms:
489
485
0xff_u8; // type u8
490
486
0o70_i16; // type i16
491
487
0b1111_1111_1001_0000_i32; // type i32
492
- 0us; // type usize
488
+ 0usize; // type usize
493
489
```
494
490
495
491
##### Floating-point literals
@@ -1001,8 +997,8 @@ fn foo<T>(_: T){}
1001
997
fn bar(map1: HashMap<String, usize>, map2: hash_map::HashMap<String, usize>){}
1002
998
1003
999
fn main() {
1004
- // Equivalent to 'std::iter::range_step(0us , 10, 2);'
1005
- range_step(0us , 10, 2);
1000
+ // Equivalent to 'std::iter::range_step(0 , 10, 2);'
1001
+ range_step(0 , 10, 2);
1006
1002
1007
1003
// Equivalent to 'foo(vec![std::option::Option::Some(1.0f64),
1008
1004
// std::option::Option::None]);'
@@ -3126,7 +3122,7 @@ conditional expression evaluates to `false`, the `while` expression completes.
3126
3122
An example:
3127
3123
3128
3124
```
3129
- let mut i = 0us ;
3125
+ let mut i = 0 ;
3130
3126
3131
3127
while i < 10 {
3132
3128
println!("hello");
@@ -3206,7 +3202,7 @@ An example of a for loop over a series of integers:
3206
3202
3207
3203
```
3208
3204
# fn bar(b:usize) { }
3209
- for i in 0us ..256 {
3205
+ for i in 0 ..256 {
3210
3206
bar(i);
3211
3207
}
3212
3208
```
0 commit comments