about summary refs log tree commit diff
path: root/compiler/rustc_error_codes/src
diff options
context:
space:
mode:
author1000teslas <47207223+1000teslas@users.noreply.github.com>2021-01-14 17:15:04 +1100
committer1000teslas <47207223+1000teslas@users.noreply.github.com>2021-01-14 17:15:04 +1100
commit174135fb3b212f53c4b24ffb243398306b9146d0 (patch)
treea7dad96681b7342f2a6607f225b5fd8056fbd023 /compiler/rustc_error_codes/src
parenta9ead34371e92767f0dfcf0d6d347a65988420af (diff)
Fix error E0373 documentation
Diffstat (limited to 'compiler/rustc_error_codes/src')
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0373.md30
1 files changed, 23 insertions, 7 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0373.md b/compiler/rustc_error_codes/src/error_codes/E0373.md
index 8da16eb6e52..0723897614f 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0373.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0373.md
@@ -54,19 +54,35 @@ about safety.
 This error may also be encountered while using `async` blocks:
 
 ```compile_fail,E0373
-use std::sync::Arc;
-use tokio::runtime::Runtime; // 0.3.1
+use std::{sync::Arc, future::Future, pin::Pin, task::{Context, Poll}};
 
 async fn f() {
-    let room_ref = Arc::new(Vec::new());
+    let v = Arc::new(Vec::new());
 
-    let gameloop_handle = Runtime::new().unwrap().spawn(async {
-        game_loop(Arc::clone(&room_ref))
+    let handle = spawn(async { //~ ERROR E0373
+        g(Arc::clone(&v))
     });
-    gameloop_handle.await;
+    handle.await;
 }
 
-fn game_loop(v: Arc<Vec<usize>>) {}
+fn g(v: Arc<Vec<usize>>) {}
+
+fn spawn<F>(future: F) -> JoinHandle
+where
+    F: Future + Send + 'static,
+    F::Output: Send + 'static,
+{
+    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