Skip to content

Commit

Permalink
Correct description of E0502
Browse files Browse the repository at this point in the history
  • Loading branch information
trevyn authored Jul 6, 2024
1 parent 51917e2 commit 09b3fce
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions compiler/rustc_error_codes/src/error_codes/E0502.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
A variable already borrowed as immutable was borrowed as mutable.
A variable already borrowed with a certain mutability (either mutable or
immutable) was borrowed again with a different mutability.

Erroneous code example:

Expand All @@ -13,7 +14,7 @@ fn foo(a: &mut i32) {
```

To fix this error, ensure that you don't have any other references to the
variable before trying to access it mutably:
variable before trying to access it with a different mutability:

```
fn bar(x: &mut i32) {}
Expand Down

0 comments on commit 09b3fce

Please sign in to comment.