Skip to content

Commit 7f41465

Browse files
Move help link to error index
1 parent 3ee3071 commit 7f41465

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

compiler/rustc_error_codes/src/error_codes/E0373.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,25 @@ fn foo() -> Box<Fn(u32) -> u32> {
5050

5151
Now that the closure has its own copy of the data, there's no need to worry
5252
about safety.
53+
54+
This error may also be encountered while using `async` blocks:
55+
56+
```compile_fail,E0373
57+
use std::sync::Arc;
58+
use tokio::runtime::Runtime; // 0.3.1
59+
60+
async fn f() {
61+
let room_ref = Arc::new(Vec::new());
62+
63+
let gameloop_handle = Runtime::new().unwrap().spawn(async {
64+
game_loop(Arc::clone(&room_ref))
65+
});
66+
gameloop_handle.await;
67+
}
68+
69+
fn game_loop(v: Arc<Vec<usize>>) {}
70+
```
71+
72+
Similarly to closures, `async` blocks are not executed immediately and may
73+
capture closed-over data by reference. For more information, see
74+
https://rust-lang.github.io/async-book/03_async_await/01_chapter.html.

compiler/rustc_mir/src/borrow_check/diagnostics/conflict_errors.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,11 +1335,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
13351335
if matches!(generator_kind, GeneratorKind::Async(_)))
13361336
{
13371337
err.note(
1338-
"async blocks are not executed immediately and either must take a \
1338+
"async blocks are not executed immediately and must either take a \
13391339
reference or ownership of outside variables they use",
13401340
);
1341-
err.help("see https://rust-lang.github.io/async-book/03_async_await/01_chapter.html#awaiting-on-a-multithreaded-executor \
1342-
for more information");
13431341
} else {
13441342
let msg = format!("function requires argument type to outlive `{}`", fr_name);
13451343
err.span_note(constraint_span, &msg);

0 commit comments

Comments
 (0)