about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-02-27 14:38:08 +0900
committerGitHub <noreply@github.com>2020-02-27 14:38:08 +0900
commit6e66bfd4cc168a59e1c81f3b26105a8e41fa1c36 (patch)
treed21c9b57693a98d39cb05c762f15a9c68aafc00f
parentd4700a83ce1721b94f2aa3ce070cf86c82cb9979 (diff)
parent129ac011b538e09a4538bd5213e74c56f81067e7 (diff)
downloadrust-6e66bfd4cc168a59e1c81f3b26105a8e41fa1c36.tar.gz
rust-6e66bfd4cc168a59e1c81f3b26105a8e41fa1c36.zip
Rollup merge of #69480 - GuillaumeGomez:clean-up-e0373, r=Dylan-DPC
Clean up E0373 explanation

r? @Dylan-DPC
-rw-r--r--src/librustc_error_codes/error_codes/E0373.md10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/librustc_error_codes/error_codes/E0373.md b/src/librustc_error_codes/error_codes/E0373.md
index 808363e6eb0..fd969877931 100644
--- a/src/librustc_error_codes/error_codes/E0373.md
+++ b/src/librustc_error_codes/error_codes/E0373.md
@@ -1,6 +1,6 @@
-This error occurs when an attempt is made to use data captured by a closure,
-when that data may no longer exist. It's most commonly seen when attempting to
-return a closure:
+A captured variable in a closure may not live long enough.
+
+Erroneous code example:
 
 ```compile_fail,E0373
 fn foo() -> Box<Fn(u32) -> u32> {
@@ -9,6 +9,10 @@ fn foo() -> Box<Fn(u32) -> u32> {
 }
 ```
 
+This error occurs when an attempt is made to use data captured by a closure,
+when that data may no longer exist. It's most commonly seen when attempting to
+return a closure as shown in the previous code example.
+
 Notice that `x` is stack-allocated by `foo()`. By default, Rust captures
 closed-over data by reference. This means that once `foo()` returns, `x` no
 longer exists. An attempt to access `x` within the closure would thus be