about summary refs log tree commit diff
path: root/compiler/rustc_error_codes/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-04-12 17:41:35 +0200
committerGitHub <noreply@github.com>2024-04-12 17:41:35 +0200
commit38283bc295167fbbddf9b45c6161ab6725825938 (patch)
tree2ba6bba287f645b6de0391f5990dcc2ae63b4dd1 /compiler/rustc_error_codes/src
parent15a8b490ea3a365bb6c3113415e945b685772c3a (diff)
parent0b5653f0986a005a558bc552091f1b3f030f00f5 (diff)
downloadrust-38283bc295167fbbddf9b45c6161ab6725825938.tar.gz
rust-38283bc295167fbbddf9b45c6161ab6725825938.zip
Rollup merge of #123849 - JimmyOhn:first_contribution, r=pnkfelix
Update E0384.md

Add an example for the shadowing usage.
Diffstat (limited to 'compiler/rustc_error_codes/src')
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0384.md13
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0384.md b/compiler/rustc_error_codes/src/error_codes/E0384.md
index e21fac0797c..6680dbed3dd 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0384.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0384.md
@@ -18,3 +18,16 @@ fn main() {
     x = 5;
 }
 ```
+
+Alternatively, you might consider initializing a new variable: either with a new
+bound name or (by [shadowing]) with the bound name of your existing variable.
+For example:
+
+[shadowing]: https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html#shadowing
+
+```
+fn main() {
+    let x = 3;
+    let x = 5;
+}
+```