about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2019-09-09 21:34:24 -0400
committerMark Rousskov <mark.simulacrum@gmail.com>2019-09-09 21:34:24 -0400
commit6eb7b698344cfdee6c25d2c6406db33a2ce87aa2 (patch)
tree8b4c4a9bbac67bebdd1459f820a59183c1b4d619
parent0b36e9dea3f2ff25b1d0df2669836c33cce89ae5 (diff)
downloadrust-6eb7b698344cfdee6c25d2c6406db33a2ce87aa2.tar.gz
rust-6eb7b698344cfdee6c25d2c6406db33a2ce87aa2.zip
Clarify E0507 to note Fn/FnMut relationship to borrowing
-rw-r--r--src/librustc_mir/error_codes.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/librustc_mir/error_codes.rs b/src/librustc_mir/error_codes.rs
index 908dd601df3..ba299e9463b 100644
--- a/src/librustc_mir/error_codes.rs
+++ b/src/librustc_mir/error_codes.rs
@@ -1646,7 +1646,14 @@ fn print_fancy_ref(fancy_ref: &FancyNum){
 "##,
 
 E0507: r##"
-You tried to move out of a value which was borrowed. Erroneous code example:
+You tried to move out of a value which was borrowed.
+
+This can also happen when using a type implementing `Fn` or `FnMut`, as neither
+allows moving out of them (they usually represent closures which can be called
+more than once). Much of the text following applies equally well to non-`FnOnce`
+closure bodies.
+
+Erroneous code example:
 
 ```compile_fail,E0507
 use std::cell::RefCell;