Skip to content

Commit

Permalink
Add error explanation for E0070
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed May 17, 2015
1 parent 8b7c17d commit e533190
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/librustc_typeck/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,30 @@ Since `return;` is just like `return ();`, there is a mismatch between the
function's return type and the value being returned.
"##,

E0070: r##"
You tried to change the value of a const variable, which is not possible. Bad
example:
```
const SOME_CONST : i32 = 12;
fn some_function() {
SOME_CONST = 14; // error !
}
```
Constant variables' value can be changed once it has been set. Please take a
look to static keyword if you want something similar but mutable:
```
static mut SOME_NOT_CONST : i32 = 12;
fn some_function() {
SOME_NOT_CONST = 14; // that's good !
}
```
"##,

E0081: r##"
Enum discriminants are used to differentiate enum variants stored in memory.
This error indicates that the same value was used for two or more variants,
Expand Down Expand Up @@ -658,7 +682,6 @@ register_diagnostics! {
E0060,
E0061,
E0068,
E0070,
E0071,
E0072,
E0073,
Expand Down

0 comments on commit e533190

Please sign in to comment.