Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 10 pull requests #81068

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
5ccef56
Explain why borrows can't be held across yield point in async blocks
sledgehammervampire Jan 2, 2021
12f1795
Fix location of error message explanation
sledgehammervampire Jan 2, 2021
2b9c8ff
Update issue-78938-async-block.rs
sledgehammervampire Jan 2, 2021
9e345a5
Revise async block error message
sledgehammervampire Jan 9, 2021
757bd23
Remove trailing whitespace
sledgehammervampire Jan 9, 2021
04b6036
Make `--color always` apply to logging too
jyn514 Jan 11, 2021
3ee3071
Update src/test/ui/async-await/issues/issue-78938-async-block.stderr
sledgehammervampire Jan 12, 2021
b2f5048
stabilize the poll_map feature
KodrAus Jan 13, 2021
c200036
Put all feature gate tests under `feature-gates/`
camelid Jan 13, 2021
7f41465
Move help link to error index
sledgehammervampire Jan 13, 2021
f5c4287
Bless test output
sledgehammervampire Jan 13, 2021
a9ead34
Fix whitespace
sledgehammervampire Jan 13, 2021
174135f
Fix error E0373 documentation
sledgehammervampire Jan 14, 2021
63deae5
Fix E0373 code example
sledgehammervampire Jan 14, 2021
5468d98
Simplify E0373 async code example
sledgehammervampire Jan 15, 2021
0660b8b
Introduce {Ref, RefMut}::try_map for optional projections
udoprog Oct 27, 2020
3e9c95b
Update compiler/rustc_mir/src/borrow_check/diagnostics/conflict_error…
sledgehammervampire Jan 15, 2021
e8757af
Use Result and rename to filter_map
udoprog Dec 17, 2020
e3274fd
Remove doctree::Import
CraftSpider Jan 14, 2021
2a0c9e2
Address nit
CraftSpider Jan 14, 2021
e42c1b9
Fix JSON test
CraftSpider Jan 15, 2021
31b17f5
Add warning to compare.py about error messages
CraftSpider Jan 15, 2021
32a20f4
Change rebuild heuristic in BinaryHeap::append
hanmertens Jan 15, 2021
c625b97
add tracking issue to cell_filter_map
KodrAus Jan 16, 2021
eef383f
doctest: Reset errors before dropping the parse session
osa1 Jan 15, 2021
0ef5557
Add a test
osa1 Jan 16, 2021
b681631
codegen_cranelift: Fix redundant semicolon warn
osa1 Jan 16, 2021
8797986
Add a regression test for #76281
JohnTitor Jan 11, 2021
d0f8553
Rollup merge of #77435 - hanmertens:binary_heap_append, r=scottmcm
JohnTitor Jan 16, 2021
0e5dcaf
Rollup merge of #78455 - udoprog:refcell-opt-map, r=KodrAus
JohnTitor Jan 16, 2021
0d901f2
Rollup merge of #80614 - 1000teslas:issue-78938-fix, r=tmandry
JohnTitor Jan 16, 2021
046da7a
Rollup merge of #80901 - jyn514:better-colors, r=Mark-Simulacrum
JohnTitor Jan 16, 2021
e9a6063
Rollup merge of #80902 - JohnTitor:issue-76281, r=Mark-Simulacrum
JohnTitor Jan 16, 2021
605557f
Rollup merge of #80968 - KodrAus:stabilize/poll_map, r=Mark-Simulacrum
JohnTitor Jan 16, 2021
32e9c33
Rollup merge of #80971 - camelid:feature-gate-testsuite-organization,…
JohnTitor Jan 16, 2021
58c1b90
Rollup merge of #81021 - CraftSpider:rustdoc-remove-import, r=jyn514
JohnTitor Jan 16, 2021
6a131cb
Rollup merge of #81040 - osa1:fix_80992, r=jyn514
JohnTitor Jan 16, 2021
c8bca90
Rollup merge of #81065 - osa1:cranelift_semicolon_warning, r=jyn514
JohnTitor Jan 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move help link to error index
  • Loading branch information
sledgehammervampire committed Jan 13, 2021
commit 7f41465f6d025445374626c14958f8181a54c639
22 changes: 22 additions & 0 deletions compiler/rustc_error_codes/src/error_codes/E0373.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,25 @@ fn foo() -> Box<Fn(u32) -> u32> {

Now that the closure has its own copy of the data, there's no need to worry
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

async fn f() {
let room_ref = Arc::new(Vec::new());

let gameloop_handle = Runtime::new().unwrap().spawn(async {
game_loop(Arc::clone(&room_ref))
});
gameloop_handle.await;
}

fn game_loop(v: Arc<Vec<usize>>) {}
```

Similarly to closures, `async` blocks are not executed immediately and may
capture closed-over data by reference. For more information, see
https://rust-lang.github.io/async-book/03_async_await/01_chapter.html.
Original file line number Diff line number Diff line change
Expand Up @@ -1335,11 +1335,9 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
if matches!(generator_kind, GeneratorKind::Async(_)))
{
err.note(
"async blocks are not executed immediately and either must take a \
"async blocks are not executed immediately and must either take a \
reference or ownership of outside variables they use",
);
err.help("see https://rust-lang.github.io/async-book/03_async_await/01_chapter.html#awaiting-on-a-multithreaded-executor \
for more information");
} else {
let msg = format!("function requires argument type to outlive `{}`", fr_name);
err.span_note(constraint_span, &msg);
Expand Down