about summary refs log tree commit diff
diff options
context:
space:
mode:
author1000teslas <47207223+1000teslas@users.noreply.github.com>2021-01-15 16:50:48 +1100
committer1000teslas <47207223+1000teslas@users.noreply.github.com>2021-01-15 16:50:48 +1100
commit5468d9805aba869e7712b5aadabb021e692ba1d0 (patch)
tree0787d5f86ae0a350a2392bc0aa6d0ed2a6e786c5
parent63deae5e2525ab7428b205d13953423a6cd91bdd (diff)
downloadrust-5468d9805aba869e7712b5aadabb021e692ba1d0.tar.gz
rust-5468d9805aba869e7712b5aadabb021e692ba1d0.zip
Simplify E0373 async code example
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0373.md27
1 files changed, 5 insertions, 22 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0373.md b/compiler/rustc_error_codes/src/error_codes/E0373.md
index 540a88a0d95..effa597aad9 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0373.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0373.md
@@ -54,35 +54,18 @@ about safety.
 This error may also be encountered while using `async` blocks:
 
 ```compile_fail,E0373,edition2018
-use std::{sync::Arc, future::Future, pin::Pin, task::{Context, Poll}};
+use std::future::Future;
 
 async fn f() {
-    let v = Arc::new(Vec::new());
-
-    let handle = spawn(async { //~ ERROR E0373
-        g(Arc::clone(&v))
+    let v = vec![1, 2, 3i32];
+    spawn(async { //~ ERROR E0373
+        println!("{:?}", v)
     });
-    handle.await;
 }
 
-fn g(v: Arc<Vec<usize>>) {}
-
-fn spawn<F>(future: F) -> JoinHandle
-where
-    F: Future + Send + 'static,
-    F::Output: Send + 'static,
-{
+fn spawn<F: Future + Send + 'static>(future: F) {
     unimplemented!()
 }
-
-struct JoinHandle;
-
-impl Future for JoinHandle {
-    type Output = ();
-    fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
-        unimplemented!()
-    }
-}
 ```
 
 Similarly to closures, `async` blocks are not executed immediately and may