@@ -338,12 +338,16 @@ type of the literal. The integer suffix must be the name of one of the
338338integral types: ` u8 ` , ` i8 ` , ` u16 ` , ` i16 ` , ` u32 ` , ` i32 ` , ` u64 ` , ` i64 ` ,
339339` isize ` , or ` usize ` .
340340
341- The type of an _ unsuffixed_ integer literal is determined by type inference.
342- If an integer type can be _ uniquely_ determined from the surrounding program
343- context, the unsuffixed integer literal has that type. If the program context
344- underconstrains the type, it defaults to the signed 32-bit integer ` i32 ` ; if
345- the program context overconstrains the type, it is considered a static type
346- error.
341+ The type of an _ unsuffixed_ integer literal is determined by type inference:
342+
343+ * If an integer type can be _ uniquely_ determined from the surrounding
344+ program context, the unsuffixed integer literal has that type.
345+
346+ * If the program context underconstrains the type, it defaults to the
347+ signed 32-bit integer ` i32 ` .
348+
349+ * If the program context overconstrains the type, it is considered a
350+ static type error.
347351
348352Examples of integer literals of various forms:
349353
@@ -371,12 +375,17 @@ The suffix forcibly sets the type of the literal. There are two valid
371375_ floating-point suffixes_ , ` f32 ` and ` f64 ` (the 32-bit and 64-bit floating point
372376types), which explicitly determine the type of the literal.
373377
374- The type of an _ unsuffixed_ floating-point literal is determined by type
375- inference. If a floating-point type can be _ uniquely_ determined from the
376- surrounding program context, the unsuffixed floating-point literal has that type.
377- If the program context underconstrains the type, it defaults to double-precision ` f64 ` ;
378- if the program context overconstrains the type, it is considered a static type
379- error.
378+ The type of an _ unsuffixed_ floating-point literal is determined by
379+ type inference:
380+
381+ * If a floating-point type can be _ uniquely_ determined from the
382+ surrounding program context, the unsuffixed floating-point literal
383+ has that type.
384+
385+ * If the program context underconstrains the type, it defaults to ` f64 ` .
386+
387+ * If the program context overconstrains the type, it is considered a
388+ static type error.
380389
381390Examples of floating-point literals of various forms:
382391
@@ -2963,14 +2972,12 @@ move values (depending on their type) from the environment into the lambda
29632972expression's captured environment.
29642973
29652974In this example, we define a function ` ten_times ` that takes a higher-order
2966- function argument, and call it with a lambda expression as an argument:
2975+ function argument, and we then call it with a lambda expression as an argument:
29672976
29682977```
29692978fn ten_times<F>(f: F) where F: Fn(i32) {
2970- let mut i = 0i32;
2971- while i < 10 {
2972- f(i);
2973- i += 1;
2979+ for index in 0..10 {
2980+ f(index);
29742981 }
29752982}
29762983
@@ -3319,10 +3326,13 @@ An example of a tuple type and its use:
33193326
33203327```
33213328type Pair<'a> = (i32, &'a str);
3322- let p: Pair<'static> = (10, "hello ");
3329+ let p: Pair<'static> = (10, "ten ");
33233330let (a, b) = p;
3324- assert!(b != "world");
3325- assert!(p.0 == 10);
3331+
3332+ assert_eq!(a, 10);
3333+ assert_eq!(b, "ten");
3334+ assert_eq!(p.0, 10);
3335+ assert_eq!(p.1, "ten");
33263336```
33273337
33283338For historical reasons and convenience, the tuple type with no elements (` () ` )
@@ -3332,8 +3342,8 @@ is often called ‘unit’ or ‘the unit type’.
33323342
33333343Rust has two different types for a list of items:
33343344
3335- * ` [T; N] ` , an 'array'.
3336- * ` &[T] ` , a 'slice'.
3345+ * ` [T; N] ` , an 'array'
3346+ * ` &[T] ` , a 'slice'
33373347
33383348An array has a fixed size, and can be allocated on either the stack or the
33393349heap.
@@ -3486,7 +3496,7 @@ x = bo(5,7);
34863496
34873497#### Function types for specific items
34883498
3489- Internally to the compiler, there are also function types that are specific to a particular
3499+ Internal to the compiler, there are also function types that are specific to a particular
34903500function item. In the following snippet, for example, the internal types of the functions
34913501` foo ` and ` bar ` are different, despite the fact that they have the same signature:
34923502
@@ -3643,7 +3653,7 @@ Coercions are defined in [RFC401]. A coercion is implicit and has no syntax.
36433653### Coercion sites
36443654
36453655A coercion can only occur at certain coercion sites in a program; these are
3646- typically places where the desired type is explicit or can be dervied by
3656+ typically places where the desired type is explicit or can be derived by
36473657propagation from explicit types (without type inference). Possible coercion
36483658sites are:
36493659
0 commit comments