Skip to content

Commit c981c99

Browse files
Move E0594 to new error code system
1 parent cd13335 commit c981c99

File tree

3 files changed

+24
-2578
lines changed

3 files changed

+24
-2578
lines changed

src/librustc_error_codes/error_codes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ E0590: include_str!("./error_codes/E0590.md"),
318318
E0591: include_str!("./error_codes/E0591.md"),
319319
E0592: include_str!("./error_codes/E0592.md"),
320320
E0593: include_str!("./error_codes/E0593.md"),
321+
E0594: include_str!("./error_codes/E0594.md"),
321322
E0595: include_str!("./error_codes/E0595.md"),
322323
E0596: include_str!("./error_codes/E0596.md"),
323324
E0597: include_str!("./error_codes/E0597.md"),
@@ -566,7 +567,6 @@ E0744: include_str!("./error_codes/E0744.md"),
566567
// E0563, // cannot determine a type for this `impl Trait` removed in 6383de15
567568
// E0564, // only named lifetimes are allowed in `impl Trait`,
568569
// but `{}` was found in the type `{}`
569-
E0594, // cannot assign to {}
570570
// E0598, // lifetime of {} is too short to guarantee its contents can be...
571571
// E0611, // merged into E0616
572572
// E0612, // merged into E0609
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
A non-mutable value was assigned a value.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0594
6+
struct SolarSystem {
7+
earth: i32,
8+
}
9+
10+
let ss = SolarSystem { earth: 3 };
11+
ss.earth = 2; // error!
12+
```
13+
14+
To fix this error, declare `ss` as mutable by using the `mut` keyword:
15+
16+
```
17+
struct SolarSystem {
18+
earth: i32,
19+
}
20+
21+
let mut ss = SolarSystem { earth: 3 }; // declaring `ss` as mutable
22+
ss.earth = 2; // ok!
23+
```

0 commit comments

Comments
 (0)