Skip to content

Commit 0b5653f

Browse files
committed
Update compiler/rustc_error_codes/src/error_codes/E0384.md
Add an example for the shadowing usage.
1 parent ab71ee7 commit 0b5653f

File tree

1 file changed

+13
-0
lines changed
  • compiler/rustc_error_codes/src/error_codes

1 file changed

+13
-0
lines changed

compiler/rustc_error_codes/src/error_codes/E0384.md

+13
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,16 @@ fn main() {
1818
x = 5;
1919
}
2020
```
21+
22+
Alternatively, you might consider initializing a new variable: either with a new
23+
bound name or (by [shadowing]) with the bound name of your existing variable.
24+
For example:
25+
26+
[shadowing]: https://doc.rust-lang.org/book/ch03-01-variables-and-mutability.html#shadowing
27+
28+
```
29+
fn main() {
30+
let x = 3;
31+
let x = 5;
32+
}
33+
```

0 commit comments

Comments
 (0)