diff options
| author | Michael Goulet <michael@errs.io> | 2024-07-06 14:55:24 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-06 14:55:24 -0400 |
| commit | 9352026d26745c692b624b610f97ea6d9bce76f0 (patch) | |
| tree | 05464e3d6d4fe0c6bedf5a8f0a95550fc7b3ac84 | |
| parent | f664171cb57c30643a9c791e04e4d628d90160a6 (diff) | |
| parent | 09b3fcebf4939d19635b17a04a3d108a29b65149 (diff) | |
| download | rust-9352026d26745c692b624b610f97ea6d9bce76f0.tar.gz rust-9352026d26745c692b624b610f97ea6d9bce76f0.zip | |
Rollup merge of #127410 - trevyn:patch-1, r=compiler-errors
Correct description of E0502 Closes #126495
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0502.md | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0502.md b/compiler/rustc_error_codes/src/error_codes/E0502.md index dc3ffdfddd9..85f38b9286f 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0502.md +++ b/compiler/rustc_error_codes/src/error_codes/E0502.md @@ -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: @@ -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) {} |
