about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-08-09 06:41:39 +0900
committerGitHub <noreply@github.com>2020-08-09 06:41:39 +0900
commite6dfd308d39dc07affe3f35b0473de5f2affec6a (patch)
tree87612da469f20ff8d0e9e0fa2cac429e5eb3a075
parentbc3ee48fd2a14e6b6d9a30bd98723daafa39960a (diff)
parentd8cf9aa6931e33a3bdbe21c41e84a27a03406d1f (diff)
downloadrust-e6dfd308d39dc07affe3f35b0473de5f2affec6a.tar.gz
rust-e6dfd308d39dc07affe3f35b0473de5f2affec6a.zip
Rollup merge of #75292 - slanterns:cleanup-E0502, r=GuillaumeGomez
Clean up E0502

`ref` on an entire `let` pattern is discouraged, take a reference with `&` instead.
-rw-r--r--src/librustc_error_codes/error_codes/E0502.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc_error_codes/error_codes/E0502.md b/src/librustc_error_codes/error_codes/E0502.md
index b90c59f5807..dc3ffdfddd9 100644
--- a/src/librustc_error_codes/error_codes/E0502.md
+++ b/src/librustc_error_codes/error_codes/E0502.md
@@ -5,7 +5,7 @@ Erroneous code example:
 ```compile_fail,E0502
 fn bar(x: &mut i32) {}
 fn foo(a: &mut i32) {
-    let ref y = a; // a is borrowed as immutable.
+    let y = &a; // a is borrowed as immutable.
     bar(a); // error: cannot borrow `*a` as mutable because `a` is also borrowed
             //        as immutable
     println!("{}", y);
@@ -19,7 +19,7 @@ variable before trying to access it mutably:
 fn bar(x: &mut i32) {}
 fn foo(a: &mut i32) {
     bar(a);
-    let ref y = a; // ok!
+    let y = &a; // ok!
     println!("{}", y);
 }
 ```