From: Guillaume Gomez Date: Tue, 7 Apr 2020 12:07:57 +0000 (+0200) Subject: Clean up E0507 explanation X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=6569a2ec1bef59bd409b13967278c95afb4bec28;p=rust.git Clean up E0507 explanation --- diff --git a/src/librustc_error_codes/error_codes/E0507.md b/src/librustc_error_codes/error_codes/E0507.md index 1e3457e96c5..254751fc45e 100644 --- a/src/librustc_error_codes/error_codes/E0507.md +++ b/src/librustc_error_codes/error_codes/E0507.md @@ -1,9 +1,4 @@ -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. +A borrowed value was moved out. Erroneous code example: @@ -32,6 +27,11 @@ you have three choices: * Somehow reclaim the ownership. * Implement the `Copy` trait on the type. +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. + Examples: ```