File tree Expand file tree Collapse file tree 2 files changed +15
-13
lines changed
branches/stable/src/librustc Expand file tree Collapse file tree 2 files changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -29,5 +29,5 @@ refs/heads/tmp: 378a370ff2057afeb1eae86eb6e78c476866a4a6
29
29
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
30
30
refs/tags/homu-tmp: a5286998df566e736b32f6795bfc3803bdaf453d
31
31
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32
- refs/heads/stable: 4420f318080e116dc4bf75a1a3568fe8bf4157b7
32
+ refs/heads/stable: 4174aa40f40e05195d73d3eb09b12d9359444f5d
33
33
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
Original file line number Diff line number Diff line change @@ -307,18 +307,20 @@ a compile-time constant.
307
307
308
308
E0308 : r##"
309
309
This error occurs when the compiler was unable to infer the concrete type of a
310
- variable. This error can occur for several cases, the most common of which is
311
- that there is a mismatch in the expected type that the compiler inferred, and
312
- the actual type that the user defined a variable as.
313
-
314
- let a: char = 7; // An integral type can't be contained in a character, so
315
- // there is a mismatch.
316
-
317
- let b: u32 = 7; // Either use the right type...
318
- let c = 7; // ...or let the compiler infer it.
319
-
320
- let d: char = c; // This also causes a mismatch because c is some sort
321
- // of number whereas d is definitely a character.
310
+ variable. This error can occur for several cases, the most common of which is a
311
+ mismatch in the expected type that the compiler inferred for a variable's
312
+ initializing expression, and the actual type explicitly assigned to the
313
+ variable.
314
+
315
+ For example:
316
+
317
+ let x: i32 = "I am not a number!";
318
+ // ~~~ ~~~~~~~~~~~~~~~~~~~~
319
+ // | |
320
+ // | initializing expression;
321
+ // | compiler infers type `&str`
322
+ // |
323
+ // type `i32` assigned to variable `x`
322
324
"## ,
323
325
324
326
E0309 : r##"
You can’t perform that action at this time.
0 commit comments