Skip to content

Commit 5468d98

Browse files
Simplify E0373 async code example
1 parent 63deae5 commit 5468d98

File tree

1 file changed

+5
-22
lines changed
  • compiler/rustc_error_codes/src/error_codes

1 file changed

+5
-22
lines changed

compiler/rustc_error_codes/src/error_codes/E0373.md

+5-22
Original file line numberDiff line numberDiff line change
@@ -54,35 +54,18 @@ about safety.
5454
This error may also be encountered while using `async` blocks:
5555

5656
```compile_fail,E0373,edition2018
57-
use std::{sync::Arc, future::Future, pin::Pin, task::{Context, Poll}};
57+
use std::future::Future;
5858
5959
async fn f() {
60-
let v = Arc::new(Vec::new());
61-
62-
let handle = spawn(async { //~ ERROR E0373
63-
g(Arc::clone(&v))
60+
let v = vec![1, 2, 3i32];
61+
spawn(async { //~ ERROR E0373
62+
println!("{:?}", v)
6463
});
65-
handle.await;
6664
}
6765
68-
fn g(v: Arc<Vec<usize>>) {}
69-
70-
fn spawn<F>(future: F) -> JoinHandle
71-
where
72-
F: Future + Send + 'static,
73-
F::Output: Send + 'static,
74-
{
66+
fn spawn<F: Future + Send + 'static>(future: F) {
7567
unimplemented!()
7668
}
77-
78-
struct JoinHandle;
79-
80-
impl Future for JoinHandle {
81-
type Output = ();
82-
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
83-
unimplemented!()
84-
}
85-
}
8669
```
8770

8871
Similarly to closures, `async` blocks are not executed immediately and may

0 commit comments

Comments
 (0)