Skip to content

Commit e2c96e9

Browse files
committed
Remove it to be safe
1 parent 69cba8c commit e2c96e9

File tree

1 file changed

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

1 file changed

+0
-19
lines changed

compiler/rustc_error_codes/src/error_codes/E0504.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,6 @@ closure.
55

66
Erroneous code example:
77

8-
```compile_fail
9-
struct FancyNum {
10-
s: String,
11-
}
12-
13-
fn main() {
14-
let fancy_num = FancyNum { s: "".into() };
15-
let fancy_ref = &fancy_num;
16-
17-
let x = move || {
18-
println!("child function: {}", fancy_num.s);
19-
// error: cannot move `fancy_num` into closure because it is borrowed
20-
};
21-
22-
x();
23-
println!("main function: {}", fancy_ref.s);
24-
}
25-
```
26-
278
Here, `fancy_num` is borrowed by `fancy_ref` and so cannot be moved into
289
the closure `x`. There is no way to move a value into a closure while it is
2910
borrowed, as that would invalidate the borrow.

0 commit comments

Comments
 (0)