diff options
| author | Jimmy Ohn <yongjin.ohn@lge.com> | 2024-04-12 20:58:10 +0900 |
|---|---|---|
| committer | Jimmy Ohn <yongjin.ohn@lge.com> | 2024-04-12 22:43:38 +0900 |
| commit | 0b5653f0986a005a558bc552091f1b3f030f00f5 (patch) | |
| tree | bb72fe18f3acdbc75147c040b30811dd89b5738b /compiler/rustc_error_codes | |
| parent | ab71ee7a9214c2793108a41efb065aa77aeb7326 (diff) | |
| download | rust-0b5653f0986a005a558bc552091f1b3f030f00f5.tar.gz rust-0b5653f0986a005a558bc552091f1b3f030f00f5.zip | |
Update compiler/rustc_error_codes/src/error_codes/E0384.md
Add an example for the shadowing usage.
Diffstat (limited to 'compiler/rustc_error_codes')
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0384.md | 13 |
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; +} +``` |
