Skip to content

Commit 35c24b4

Browse files
authored
Rollup merge of #64330 - Mark-Simulacrum:clarify-E0507, r=GuillaumeGomez
Clarify E0507 to note Fn/FnMut relationship to borrowing Fixes #37904.
2 parents ce3e824 + 6eb7b69 commit 35c24b4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/librustc_mir/error_codes.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -1646,7 +1646,14 @@ fn print_fancy_ref(fancy_ref: &FancyNum){
16461646
"##,
16471647

16481648
E0507: r##"
1649-
You tried to move out of a value which was borrowed. Erroneous code example:
1649+
You tried to move out of a value which was borrowed.
1650+
1651+
This can also happen when using a type implementing `Fn` or `FnMut`, as neither
1652+
allows moving out of them (they usually represent closures which can be called
1653+
more than once). Much of the text following applies equally well to non-`FnOnce`
1654+
closure bodies.
1655+
1656+
Erroneous code example:
16501657
16511658
```compile_fail,E0507
16521659
use std::cell::RefCell;

0 commit comments

Comments
 (0)