Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add long error explanation for E0594 #66155

Merged
merged 3 commits into from
Nov 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustc_error_codes/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ E0590: include_str!("./error_codes/E0590.md"),
E0591: include_str!("./error_codes/E0591.md"),
E0592: include_str!("./error_codes/E0592.md"),
E0593: include_str!("./error_codes/E0593.md"),
E0594: include_str!("./error_codes/E0594.md"),
E0595: include_str!("./error_codes/E0595.md"),
E0596: include_str!("./error_codes/E0596.md"),
E0597: include_str!("./error_codes/E0597.md"),
Expand Down Expand Up @@ -566,7 +567,6 @@ E0744: include_str!("./error_codes/E0744.md"),
// E0563, // cannot determine a type for this `impl Trait` removed in 6383de15
// E0564, // only named lifetimes are allowed in `impl Trait`,
// but `{}` was found in the type `{}`
E0594, // cannot assign to {}
// E0598, // lifetime of {} is too short to guarantee its contents can be...
// E0611, // merged into E0616
// E0612, // merged into E0609
Expand Down
23 changes: 23 additions & 0 deletions src/librustc_error_codes/error_codes/E0594.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
A non-mutable value was assigned a value.

Erroneous code example:

```compile_fail,E0594
struct SolarSystem {
earth: i32,
}

let ss = SolarSystem { earth: 3 };
ss.earth = 2; // error!
```

To fix this error, declare `ss` as mutable by using the `mut` keyword:

```
struct SolarSystem {
earth: i32,
}

let mut ss = SolarSystem { earth: 3 }; // declaring `ss` as mutable
ss.earth = 2; // ok!
```
3 changes: 2 additions & 1 deletion src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,5 @@ LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); })

error: aborting due to 6 previous errors

For more information about this error, try `rustc --explain E0596`.
Some errors have detailed explanations: E0594, E0596.
For more information about an error, try `rustc --explain E0594`.
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ LL | *s.pointer += 1;

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0594`.
1 change: 1 addition & 0 deletions src/test/ui/borrowck/borrowck-assign-to-constants.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ LL | foo = 6;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0594`.
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ LL | let x: &mut isize = &mut **t0;

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0502, E0596.
Some errors have detailed explanations: E0502, E0594, E0596.
For more information about an error, try `rustc --explain E0502`.
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,5 @@ LL | *x.y_mut() = 3;

error: aborting due to 14 previous errors

For more information about this error, try `rustc --explain E0596`.
Some errors have detailed explanations: E0594, E0596.
For more information about an error, try `rustc --explain E0594`.
3 changes: 2 additions & 1 deletion src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ LL | **x = 3;

error: aborting due to 7 previous errors

For more information about this error, try `rustc --explain E0596`.
Some errors have detailed explanations: E0594, E0596.
For more information about an error, try `rustc --explain E0594`.
2 changes: 1 addition & 1 deletion src/test/ui/borrowck/borrowck-closures-unique.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ LL | let c1 = |y: &'static mut isize| x = y;

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0500, E0524.
Some errors have detailed explanations: E0500, E0524, E0594.
For more information about an error, try `rustc --explain E0500`.
3 changes: 2 additions & 1 deletion src/test/ui/borrowck/borrowck-issue-14498.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,5 @@ LL | drop(p);

error: aborting due to 9 previous errors

For more information about this error, try `rustc --explain E0506`.
Some errors have detailed explanations: E0506, E0594.
For more information about an error, try `rustc --explain E0506`.
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ LL | s[2] = 20;

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0502`.
Some errors have detailed explanations: E0502, E0594.
For more information about an error, try `rustc --explain E0502`.
3 changes: 2 additions & 1 deletion src/test/ui/borrowck/index-mut-help.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ LL | let _ = &mut map["peter"];

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0596`.
Some errors have detailed explanations: E0594, E0596.
For more information about an error, try `rustc --explain E0594`.
1 change: 1 addition & 0 deletions src/test/ui/borrowck/issue-45983.nll.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ LL | give_any(|y| x = Some(y));

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0594`.
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,5 @@ LL | v.y = 2;

error: aborting due to 9 previous errors

For more information about this error, try `rustc --explain E0382`.
Some errors have detailed explanations: E0382, E0594.
For more information about an error, try `rustc --explain E0382`.
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ LL | || { &mut x.0; };

error: aborting due to 6 previous errors

For more information about this error, try `rustc --explain E0596`.
Some errors have detailed explanations: E0594, E0596.
For more information about an error, try `rustc --explain E0594`.
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ LL | || { &mut x.0; };

error: aborting due to 6 previous errors

For more information about this error, try `rustc --explain E0596`.
Some errors have detailed explanations: E0594, E0596.
For more information about an error, try `rustc --explain E0594`.
3 changes: 2 additions & 1 deletion src/test/ui/borrowck/mutability-errors.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -375,4 +375,5 @@ LL | &mut X.0;

error: aborting due to 38 previous errors

For more information about this error, try `rustc --explain E0596`.
Some errors have detailed explanations: E0594, E0596.
For more information about an error, try `rustc --explain E0594`.
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ LL | x.b = 22;

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0381`.
Some errors have detailed explanations: E0381, E0594.
For more information about an error, try `rustc --explain E0381`.
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ LL | x.0 = 1;

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0381`.
Some errors have detailed explanations: E0381, E0594.
For more information about an error, try `rustc --explain E0381`.
3 changes: 2 additions & 1 deletion src/test/ui/cannot-mutate-captured-non-mut-var.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ LL | to_fn_once(move|| { s.read_to_end(&mut Vec::new()); });

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0596`.
Some errors have detailed explanations: E0594, E0596.
For more information about an error, try `rustc --explain E0594`.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | foo(Box::new(move || y = false) as Box<_>);

error: aborting due to previous error

For more information about this error, try `rustc --explain E0594`.
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ LL | *OH_YES = 99;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0594`.
3 changes: 2 additions & 1 deletion src/test/ui/did_you_mean/issue-35937.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ LL | s.x += 1;

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0596`.
Some errors have detailed explanations: E0594, E0596.
For more information about an error, try `rustc --explain E0594`.
3 changes: 2 additions & 1 deletion src/test/ui/did_you_mean/issue-39544.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,5 @@ LL | *x.0 = 1;

error: aborting due to 12 previous errors

For more information about this error, try `rustc --explain E0596`.
Some errors have detailed explanations: E0594, E0596.
For more information about an error, try `rustc --explain E0594`.
1 change: 1 addition & 0 deletions src/test/ui/error-codes/E0389.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | fancy_ref.num = 6;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0594`.
1 change: 1 addition & 0 deletions src/test/ui/error-codes/E0594.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ LL | NUM = 20;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0594`.
1 change: 1 addition & 0 deletions src/test/ui/fn/fn-closure-mutable-capture.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ LL | bar(move || x = 1);

error: aborting due to previous error

For more information about this error, try `rustc --explain E0594`.
1 change: 1 addition & 0 deletions src/test/ui/immut-function-arguments.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ LL | let _frob = |q: Box<isize>| { *q = 2; };

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0594`.
1 change: 1 addition & 0 deletions src/test/ui/issues/issue-46023.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ LL | x = 1;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0594`.
3 changes: 2 additions & 1 deletion src/test/ui/issues/issue-46604.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ LL | buf[0]=2;

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0017`.
Some errors have detailed explanations: E0017, E0594.
For more information about an error, try `rustc --explain E0017`.
1 change: 1 addition & 0 deletions src/test/ui/issues/issue-51244.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | *my_ref = 0;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0594`.
1 change: 1 addition & 0 deletions src/test/ui/issues/issue-51515.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ LL | *bar = 64;

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0594`.
1 change: 1 addition & 0 deletions src/test/ui/mut/mutable-class-fields-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | self.how_hungry -= 5;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0594`.
1 change: 1 addition & 0 deletions src/test/ui/mut/mutable-class-fields.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | nyan.how_hungry = 0;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0594`.
3 changes: 2 additions & 1 deletion src/test/ui/nll/closure-captures.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,5 @@ LL | | *x = 1;});

error: aborting due to 12 previous errors

For more information about this error, try `rustc --explain E0596`.
Some errors have detailed explanations: E0594, E0596.
For more information about an error, try `rustc --explain E0594`.
1 change: 1 addition & 0 deletions src/test/ui/nll/constant-thread-locals-issue-47053.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ LL | FOO = 6;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0594`.
1 change: 1 addition & 0 deletions src/test/ui/nll/generator-upvar-mutability.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ LL | x = 1;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0594`.
1 change: 1 addition & 0 deletions src/test/ui/nll/issue-47388.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | fancy_ref.num = 6;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0594`.
1 change: 1 addition & 0 deletions src/test/ui/nll/issue-51244.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ LL | *my_ref = 0;

error: aborting due to previous error

For more information about this error, try `rustc --explain E0594`.
3 changes: 2 additions & 1 deletion src/test/ui/nll/issue-57989.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ LL | g;

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0506`.
Some errors have detailed explanations: E0506, E0594.
For more information about an error, try `rustc --explain E0506`.
1 change: 1 addition & 0 deletions src/test/ui/rfc-2005-default-binding-mode/enum.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ LL | *x += 1;

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0594`.
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ LL | *n += 1;

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0594`.
1 change: 1 addition & 0 deletions src/test/ui/suggestions/suggest-ref-mut.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ LL | ref quo => { *quo = 32; },

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0594`.
1 change: 1 addition & 0 deletions src/test/ui/thread-local-mutation.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ LL | S = "after";

error: aborting due to previous error

For more information about this error, try `rustc --explain E0594`.
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,5 @@ LL | || set(&mut x);

error: aborting due to 8 previous errors

For more information about this error, try `rustc --explain E0596`.
Some errors have detailed explanations: E0594, E0596.
For more information about an error, try `rustc --explain E0594`.
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ LL | | });

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0594`.
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ LL | | });

error: aborting due to previous error

For more information about this error, try `rustc --explain E0594`.