Skip to content

Commit 028aba3

Browse files
Add E0102 error explanation
1 parent 050b8d3 commit 028aba3

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

src/librustc_typeck/diagnostics.rs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1118,6 +1118,36 @@ fn main() {
11181118
```
11191119
"##,
11201120

1121+
E0102: r##"
1122+
You hit this error because the compiler the compiler lacks information
1123+
to determine a type for this variable. Erroneous code example:
1124+
1125+
```
1126+
fn main() {
1127+
let x: &_; // error: cannot determine a type for this local variable
1128+
}
1129+
```
1130+
1131+
You have two possibilities to solve this situation:
1132+
* Give an explicit definition of the variable
1133+
* Infer the variable
1134+
1135+
Examples:
1136+
1137+
```
1138+
fn some_func(x: u32) {
1139+
// some code
1140+
}
1141+
1142+
fn main() {
1143+
let x = 0u32; // ok!
1144+
// or:
1145+
let x = 0;
1146+
some_func(x);
1147+
}
1148+
```
1149+
"##,
1150+
11211151
E0106: r##"
11221152
This error indicates that a lifetime is missing from a type. If it is an error
11231153
inside a function signature, the problem may be with failing to adhere to the
@@ -2303,7 +2333,6 @@ register_diagnostics! {
23032333
E0085,
23042334
E0086,
23052335
E0090,
2306-
E0102,
23072336
E0103,
23082337
E0104,
23092338
E0118,

0 commit comments

Comments
 (0)