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

async/await: improve not-send errors #64895

Merged

Conversation

@davidtwco
Copy link
Member

commented Sep 29, 2019

cc #64130.

note: future does not implement `std::marker::Send` because this value is used across an await
  --> $DIR/issue-64130-non-send-future-diags.rs:15:5
   |
LL |     let g = x.lock().unwrap();
   |         - has type `std::sync::MutexGuard<'_, u32>`
LL |     baz().await;
   |     ^^^^^^^^^^^ await occurs here, with `g` maybe used later
LL | }
   | - `g` is later dropped here

r? @nikomatsakis

@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

commented Sep 29, 2019

The job mingw-check of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-09-29T13:41:17.1276217Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-09-29T13:41:17.1476184Z ##[command]git config gc.auto 0
2019-09-29T13:41:17.1544349Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-09-29T13:41:17.1624608Z ##[command]git config --get-all http.proxy
2019-09-29T13:41:17.1782855Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/64895/merge:refs/remotes/pull/64895/merge
---
2019-09-29T13:49:54.5009471Z     Checking syntax_ext v0.0.0 (/checkout/src/libsyntax_ext)
2019-09-29T13:50:13.4274786Z error[E0609]: no field `sty` on type `&ty::TyS<'_>`
2019-09-29T13:50:13.4275645Z     --> src/librustc/traits/error_reporting.rs:1658:74
2019-09-29T13:50:13.4275983Z      |
2019-09-29T13:50:13.4276515Z 1658 | ...                   derived_obligation.parent_trait_ref.self_ty().sty);
2019-09-29T13:50:13.4277069Z 
2019-09-29T13:50:13.4277382Z error[E0609]: no field `sty` on type `&ty::TyS<'_>`
2019-09-29T13:50:13.4277682Z     --> src/librustc/traits/error_reporting.rs:1659:73
2019-09-29T13:50:13.4277943Z      |
2019-09-29T13:50:13.4277943Z      |
2019-09-29T13:50:13.4278290Z 1659 |                     match derived_obligation.parent_trait_ref.self_ty().sty {
2019-09-29T13:50:13.4278723Z 
2019-09-29T13:50:13.4302770Z error[E0026]: struct `hir::Item` does not have a field named `node`
2019-09-29T13:50:13.4303605Z     --> src/librustc/traits/error_reporting.rs:1681:13
2019-09-29T13:50:13.4304154Z      |
---
2019-09-29T13:50:21.7088869Z == clock drift check ==
2019-09-29T13:50:21.7104654Z   local time: Sun Sep 29 13:50:21 UTC 2019
2019-09-29T13:50:21.7973981Z   network time: Sun, 29 Sep 2019 13:50:21 GMT
2019-09-29T13:50:21.7980669Z == end clock drift check ==
2019-09-29T13:50:22.3982398Z ##[error]Bash exited with code '1'.
2019-09-29T13:50:22.4063490Z ##[section]Starting: Checkout
2019-09-29T13:50:22.4066058Z ==============================================================================
2019-09-29T13:50:22.4066121Z Task         : Get sources
2019-09-29T13:50:22.4066176Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@davidtwco davidtwco force-pushed the davidtwco:issue-64130-async-error-definition branch from 42ce06e to f7cb10d Sep 29, 2019
Copy link
Member

left a comment

Just some nits.

src/librustc/traits/error_reporting.rs Outdated Show resolved Hide resolved
src/librustc/traits/error_reporting.rs Outdated Show resolved Hide resolved
src/librustc/traits/error_reporting.rs Outdated Show resolved Hide resolved
src/librustc/traits/error_reporting.rs Outdated Show resolved Hide resolved
src/librustc/traits/error_reporting.rs Outdated Show resolved Hide resolved
src/librustc/traits/error_reporting.rs Outdated Show resolved Hide resolved
src/librustc/traits/error_reporting.rs Outdated Show resolved Hide resolved
@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

commented Sep 29, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-09-29T17:37:08.3077340Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-09-29T17:37:08.3269705Z ##[command]git config gc.auto 0
2019-09-29T17:37:08.3352510Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-09-29T17:37:08.3412629Z ##[command]git config --get-all http.proxy
2019-09-29T17:37:08.3566234Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/64895/merge:refs/remotes/pull/64895/merge
---
2019-09-29T18:42:10.1814709Z .................................................................................................... 1500/9073
2019-09-29T18:42:17.1132142Z .................................................................................................... 1600/9073
2019-09-29T18:42:27.3818084Z ................................................................................................i... 1700/9073
2019-09-29T18:42:36.4484290Z ............i....................................................................................... 1800/9073
2019-09-29T18:42:43.8600231Z .......................................................................................iiiii........ 1900/9073
2019-09-29T18:43:07.5991052Z .................................................................................................... 2100/9073
2019-09-29T18:43:10.2324248Z .................................................................................................... 2200/9073
2019-09-29T18:43:13.0137138Z .................................................................................................... 2300/9073
2019-09-29T18:43:20.8182641Z .................................................................................................... 2400/9073
---
2019-09-29T18:46:29.4525159Z ...........................................................................i...............i........ 4700/9073
2019-09-29T18:46:38.6797447Z .................................................................................................... 4800/9073
2019-09-29T18:46:48.8404242Z .................................................................................................... 4900/9073
2019-09-29T18:46:55.4056658Z .................................................................................................... 5000/9073
2019-09-29T18:47:07.1130936Z ...............................................................ii.ii................................ 5100/9073
2019-09-29T18:47:17.5520038Z .................................................................................................... 5300/9073
2019-09-29T18:47:27.6725855Z .................................................................................................... 5400/9073
2019-09-29T18:47:35.8258000Z .............................i...................................................................... 5500/9073
2019-09-29T18:47:42.1946299Z .................................................................................................... 5600/9073
2019-09-29T18:47:42.1946299Z .................................................................................................... 5600/9073
2019-09-29T18:47:55.0355909Z .................................................................................................... 5700/9073
2019-09-29T18:48:06.9571465Z ........................ii...i..ii...........i...................................................... 5800/9073
2019-09-29T18:48:30.3354142Z .................................................................................................... 6000/9073
2019-09-29T18:48:39.2356687Z .................................................................................................... 6100/9073
2019-09-29T18:48:39.2356687Z .................................................................................................... 6100/9073
2019-09-29T18:48:55.5296426Z ...........................i..ii.................................................................... 6200/9073
2019-09-29T18:49:16.1105641Z ......................................................................................i............. 6400/9073
2019-09-29T18:49:18.6246069Z .................................................................................................... 6500/9073
2019-09-29T18:49:21.9110516Z ..........................................................i......................................... 6600/9073
2019-09-29T18:49:24.4853960Z .................................................................................................... 6700/9073
---
2019-09-29T18:54:10.9381183Z  finished in 5.667
2019-09-29T18:54:10.9565672Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-29T18:54:11.1189976Z 
2019-09-29T18:54:11.1190809Z running 150 tests
2019-09-29T18:54:14.5839901Z i....iii......iii..iiii....i.............................i..i..................i....i.........ii.i.i 100/150
2019-09-29T18:54:16.7132540Z ..iiii..............i.........iii.i.......ii......
2019-09-29T18:54:17.4962063Z 
2019-09-29T18:54:17.4962380Z  finished in 5.757
2019-09-29T18:54:17.4962939Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-29T18:54:17.4963128Z 
---
2019-09-29T18:54:19.1223780Z  finished in 2.389
2019-09-29T18:54:19.1422217Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-29T18:54:19.3062736Z 
2019-09-29T18:54:19.3064193Z running 9 tests
2019-09-29T18:54:19.3065878Z iiiiiiiii
2019-09-29T18:54:19.3067357Z 
2019-09-29T18:54:19.3070118Z  finished in 0.164
2019-09-29T18:54:19.3260511Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-29T18:54:19.9996204Z 
---
2019-09-29T18:54:38.6863496Z  finished in 19.360
2019-09-29T18:54:38.7115697Z Check compiletest suite=debuginfo mode=debuginfo-gdb+lldb (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-29T18:54:38.8886918Z 
2019-09-29T18:54:38.8888094Z running 123 tests
2019-09-29T18:55:05.5083934Z .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....ii..........iiii..........i...ii...i.......ii. 100/123
2019-09-29T18:55:09.5025352Z i.i.i......iii.i.....ii
2019-09-29T18:55:09.5032398Z 
2019-09-29T18:55:09.5032630Z  finished in 30.790
2019-09-29T18:55:09.5039765Z Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-29T18:55:09.5040140Z Copying stage2 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
---
2019-09-29T19:09:01.4120824Z 
2019-09-29T19:09:01.4125231Z    Doc-tests core
2019-09-29T19:09:07.0937093Z 
2019-09-29T19:09:07.0937893Z running 2405 tests
2019-09-29T19:09:19.2509629Z ......iiiii......................................................................................... 100/2405
2019-09-29T19:09:30.9958991Z ...............................................................................ii................... 200/2405
2019-09-29T19:09:59.2323946Z .i.................................................................................................. 400/2405
2019-09-29T19:09:59.2323946Z .i.................................................................................................. 400/2405
2019-09-29T19:10:10.8073441Z ................................................i..i.................iiii........................... 500/2405
2019-09-29T19:10:32.9864590Z .................................................................................................... 700/2405
2019-09-29T19:10:44.2617624Z .................................................................................................... 800/2405
2019-09-29T19:10:55.5622906Z .................................................................................................... 900/2405
2019-09-29T19:11:06.8834871Z .................................................................................................... 1000/2405
---
2019-09-29T19:13:58.7654486Z 
2019-09-29T19:13:58.7721810Z  finished in 4.083
2019-09-29T19:13:58.7739026Z Testing std stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-29T19:13:59.0198047Z    Compiling std v0.0.0 (/checkout/src/libstd)
2019-09-29T19:14:24.7262149Z error: duplicate diagnostic item found: `gen_future`.
2019-09-29T19:14:24.7263673Z   --> src/libstd/future.rs:30:1
2019-09-29T19:14:24.7264372Z    |
2019-09-29T19:14:24.7265087Z 30 | struct GenFuture<T: Generator<Yield = ()>>(T);
2019-09-29T19:14:24.7267137Z    |
2019-09-29T19:14:24.7267845Z    = note: first defined in crate `std`.
2019-09-29T19:14:24.7268175Z 
2019-09-29T19:14:25.2971174Z error: aborting due to previous error
---
2019-09-29T19:14:25.5836670Z == clock drift check ==
2019-09-29T19:14:25.5849388Z   local time: Sun Sep 29 19:14:25 UTC 2019
2019-09-29T19:14:25.7488141Z   network time: Sun, 29 Sep 2019 19:14:25 GMT
2019-09-29T19:14:25.7492859Z == end clock drift check ==
2019-09-29T19:14:26.3814576Z ##[error]Bash exited with code '1'.
2019-09-29T19:14:26.3870221Z ##[section]Starting: Checkout
2019-09-29T19:14:26.3873918Z ==============================================================================
2019-09-29T19:14:26.3873985Z Task         : Get sources
2019-09-29T19:14:26.3874039Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@davidtwco davidtwco force-pushed the davidtwco:issue-64130-async-error-definition branch from f7cb10d to bdaec6a Sep 29, 2019
@davidtwco

This comment has been minimized.

Copy link
Member Author

commented Sep 29, 2019

I'm not sure where the duplicate diagnostic item error is coming from, a quick glance only found the rustc_diagnostic_item attribute that I added.

@Centril

This comment has been minimized.

Copy link
Member

commented Sep 29, 2019

cc @oli-obk ^---

@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

commented Sep 29, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-09-29T19:18:57.3941767Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-09-29T19:18:58.2552642Z ##[command]git config gc.auto 0
2019-09-29T19:18:58.2559851Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-09-29T19:18:58.2565372Z ##[command]git config --get-all http.proxy
2019-09-29T19:18:58.2568658Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/64895/merge:refs/remotes/pull/64895/merge
---
2019-09-29T20:22:58.1202067Z .................................................................................................... 1500/9073
2019-09-29T20:23:04.8629881Z .................................................................................................... 1600/9073
2019-09-29T20:23:14.8394697Z ................................................................................................i... 1700/9073
2019-09-29T20:23:23.6036142Z ............i....................................................................................... 1800/9073
2019-09-29T20:23:30.9184870Z .......................................................................................iiiii........ 1900/9073
2019-09-29T20:23:53.7509084Z .................................................................................................... 2100/9073
2019-09-29T20:23:56.4056240Z .................................................................................................... 2200/9073
2019-09-29T20:23:59.1228485Z .................................................................................................... 2300/9073
2019-09-29T20:24:05.9488654Z .................................................................................................... 2400/9073
---
2019-09-29T20:27:09.8973724Z ...........................................................................i...............i........ 4700/9073
2019-09-29T20:27:18.8170684Z .................................................................................................... 4800/9073
2019-09-29T20:27:28.7820639Z .................................................................................................... 4900/9073
2019-09-29T20:27:34.9996564Z .................................................................................................... 5000/9073
2019-09-29T20:27:46.4040680Z ...............................................................ii.ii................................ 5100/9073
2019-09-29T20:27:56.4758293Z .................................................................................................... 5300/9073
2019-09-29T20:28:06.4983330Z .................................................................................................... 5400/9073
2019-09-29T20:28:14.3620300Z .............................i...................................................................... 5500/9073
2019-09-29T20:28:20.6306552Z .................................................................................................... 5600/9073
2019-09-29T20:28:20.6306552Z .................................................................................................... 5600/9073
2019-09-29T20:28:33.1774362Z .................................................................................................... 5700/9073
2019-09-29T20:28:44.8633598Z ........................ii...i..ii...........i...................................................... 5800/9073
2019-09-29T20:29:07.5389904Z .................................................................................................... 6000/9073
2019-09-29T20:29:16.0060107Z .................................................................................................... 6100/9073
2019-09-29T20:29:16.0060107Z .................................................................................................... 6100/9073
2019-09-29T20:29:31.9281492Z ...........................i..ii.................................................................... 6200/9073
2019-09-29T20:29:51.7182271Z ......................................................................................i............. 6400/9073
2019-09-29T20:29:54.1043294Z .................................................................................................... 6500/9073
2019-09-29T20:29:56.5091146Z ..........................................................i......................................... 6600/9073
2019-09-29T20:29:59.6950821Z .................................................................................................... 6700/9073
---
2019-09-29T20:34:38.5865850Z  finished in 5.583
2019-09-29T20:34:38.6069762Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-29T20:34:38.7705305Z 
2019-09-29T20:34:38.7706385Z running 150 tests
2019-09-29T20:34:42.1659439Z i....iii......iii..iiii....i.............................i..i..................i....i.........ii.i.i 100/150
2019-09-29T20:34:44.2102797Z ..iiii..............i.........iii..i......ii......
2019-09-29T20:34:44.2103837Z 
2019-09-29T20:34:44.2106558Z  finished in 5.603
2019-09-29T20:34:44.2286305Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-29T20:34:44.3872316Z 
---
2019-09-29T20:34:46.5276420Z  finished in 2.299
2019-09-29T20:34:46.5483679Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-29T20:34:46.7276200Z 
2019-09-29T20:34:46.7277809Z running 9 tests
2019-09-29T20:34:46.7278653Z iiiiiiiii
2019-09-29T20:34:46.7279015Z 
2019-09-29T20:34:46.7279060Z  finished in 0.179
2019-09-29T20:34:46.7467286Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-29T20:34:46.9290380Z 
---
2019-09-29T20:35:05.4688449Z  finished in 18.722
2019-09-29T20:35:05.4896017Z Check compiletest suite=debuginfo mode=debuginfo-gdb+lldb (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-29T20:35:05.6637841Z 
2019-09-29T20:35:05.6638120Z running 123 tests
2019-09-29T20:35:31.4841679Z .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....ii..........iiii..........i...ii...i.......ii. 100/123
2019-09-29T20:35:36.5252581Z i.i.i......iii.i.....ii
2019-09-29T20:35:36.5253184Z 
2019-09-29T20:35:36.5256410Z  finished in 31.036
2019-09-29T20:35:36.5265378Z Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-29T20:35:36.5268671Z Copying stage2 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
---
2019-09-29T20:49:02.9785685Z 
2019-09-29T20:49:02.9787702Z    Doc-tests core
2019-09-29T20:49:08.1811920Z 
2019-09-29T20:49:08.1812431Z running 2405 tests
2019-09-29T20:49:20.0402069Z ......iiiii......................................................................................... 100/2405
2019-09-29T20:49:31.1718650Z ...............................................................................ii................... 200/2405
2019-09-29T20:49:58.3167068Z .i.................................................................................................. 400/2405
2019-09-29T20:49:58.3167068Z .i.................................................................................................. 400/2405
2019-09-29T20:50:09.4279236Z ................................................i..i.................iiii........................... 500/2405
2019-09-29T20:50:30.9741305Z .................................................................................................... 700/2405
2019-09-29T20:50:41.8913154Z .................................................................................................... 800/2405
2019-09-29T20:50:52.9743005Z .................................................................................................... 900/2405
2019-09-29T20:51:04.1300705Z .................................................................................................... 1000/2405
---
2019-09-29T20:53:52.4897401Z 
2019-09-29T20:53:52.4958899Z  finished in 3.900
2019-09-29T20:53:52.4980664Z Testing std stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-29T20:53:52.7606994Z    Compiling std v0.0.0 (/checkout/src/libstd)
2019-09-29T20:54:17.0395418Z error: duplicate diagnostic item found: `gen_future`.
2019-09-29T20:54:17.0397013Z   --> src/libstd/future.rs:30:1
2019-09-29T20:54:17.0397599Z    |
2019-09-29T20:54:17.0398158Z 30 | struct GenFuture<T: Generator<Yield = ()>>(T);
2019-09-29T20:54:17.0399222Z    |
2019-09-29T20:54:17.0399754Z    = note: first defined in crate `std`.
2019-09-29T20:54:17.0399978Z 
2019-09-29T20:54:17.8386695Z error: aborting due to previous error
---
2019-09-29T20:54:17.8413486Z == clock drift check ==
2019-09-29T20:54:17.8433215Z   local time: Sun Sep 29 20:54:17 UTC 2019
2019-09-29T20:54:17.9420970Z   network time: Sun, 29 Sep 2019 20:54:17 GMT
2019-09-29T20:54:17.9421667Z == end clock drift check ==
2019-09-29T20:54:18.4740310Z ##[error]Bash exited with code '1'.
2019-09-29T20:54:18.4787470Z ##[section]Starting: Checkout
2019-09-29T20:54:18.4789443Z ==============================================================================
2019-09-29T20:54:18.4789500Z Task         : Get sources
2019-09-29T20:54:18.4789548Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

src/libstd/future.rs Outdated Show resolved Hide resolved
@davidtwco davidtwco force-pushed the davidtwco:issue-64130-async-error-definition branch from bdaec6a to e0f08b5 Sep 30, 2019
@davidtwco davidtwco force-pushed the davidtwco:issue-64130-async-error-definition branch from e0f08b5 to 28be5ae Sep 30, 2019
@oli-obk

This comment has been minimized.

Copy link
Contributor

commented Sep 30, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

commented Sep 30, 2019

📌 Commit 28be5ae has been approved by oli-obk

Copy link
Contributor

left a comment

This is awesome. Beautiful work. My one concern is that I think we can do better still with the error, but I'm sort of inclined to land this PR and continue that work afterwards.

@davidtwco davidtwco force-pushed the davidtwco:issue-64130-async-error-definition branch from 28be5ae to 9076646 Sep 30, 2019
src/librustc/ty/context.rs Outdated Show resolved Hide resolved
src/librustc/ty/context.rs Outdated Show resolved Hide resolved
This commit improves obligation errors for async/await:

```
note: future does not implement `std::marker::Send` because this value is used across an
      await
  --> $DIR/issue-64130-non-send-future-diags.rs:15:5
   |
LL |     let g = x.lock().unwrap();
   |         - has type `std::sync::MutexGuard<'_, u32>`
LL |     baz().await;
   |     ^^^^^^^^^^^ await occurs here, with `g` maybe used later
LL | }
   | - `g` is later dropped here
```

Signed-off-by: David Wood <david@davidtw.co>
@davidtwco davidtwco force-pushed the davidtwco:issue-64130-async-error-definition branch from 9076646 to 04fa9b1 Sep 30, 2019
@nikomatsakis

This comment has been minimized.

Copy link
Contributor

commented Sep 30, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

commented Sep 30, 2019

📌 Commit 04fa9b1 has been approved by nikomatsakis

Centril added a commit to Centril/rust that referenced this pull request Oct 1, 2019
…efinition, r=nikomatsakis

async/await: improve not-send errors

cc rust-lang#64130.

```
note: future does not implement `std::marker::Send` because this value is used across an await
  --> $DIR/issue-64130-non-send-future-diags.rs:15:5
   |
LL |     let g = x.lock().unwrap();
   |         - has type `std::sync::MutexGuard<'_, u32>`
LL |     baz().await;
   |     ^^^^^^^^^^^ await occurs here, with `g` maybe used later
LL | }
   | - `g` is later dropped here
```

r? @nikomatsakis
bors added a commit that referenced this pull request Oct 1, 2019
Rollup of 10 pull requests

Successful merges:

 - #63674 (syntax: Support modern attribute syntax in the `meta` matcher)
 - #63931 (Stabilize macros in some more positions)
 - #64887 (syntax: recover trailing `|` in or-patterns)
 - #64895 (async/await: improve not-send errors)
 - #64896 (Remove legacy grammar)
 - #64907 (A small amount of tidying-up factored out from PR #64648)
 - #64928 (Add tests for some issues)
 - #64930 (Silence unreachable code lint from await desugaring)
 - #64935 (Improve code clarity)
 - #64937 (Deduplicate closure type errors)

Failed merges:

r? @ghost
@bors bors merged commit 04fa9b1 into rust-lang:master Oct 1, 2019
4 checks passed
4 checks passed
pr Build #20190930.84 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-6.0) Linux x86_64-gnu-llvm-6.0 succeeded
Details
pr (LinuxTools) LinuxTools succeeded
Details
@bors

This comment has been minimized.

Copy link
Contributor

commented Oct 1, 2019

☔️ The latest upstream changes (presumably #64946) made this pull request unmergeable. Please resolve the merge conflicts.

@davidtwco davidtwco deleted the davidtwco:issue-64130-async-error-definition branch Oct 1, 2019
@ghost

This comment has been minimized.

Copy link

commented Oct 2, 2019

It appears that this causes ICE #64964 (comment)

I'm currently retesting that by applying this PR on top of the rust compilation that succeeded without it.confirmed

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

commented Oct 3, 2019

I'd like to nominate this PR (and the follow-up #64989) for inclusion in beta. It's not the sort of thing I would normally include, but this error is (a) one of the most common problems I hear people complaining about with async-await and (b) particularly opaque without this fix. Moreover, it is early in the cycle, so it will presumably get a reasonable amount of testing before landing. The change is relatively low risk, in that it is confined to error reporting.

@nikomatsakis nikomatsakis referenced this pull request Oct 3, 2019
@Centril Centril added the T-compiler label Oct 3, 2019
@pnkfelix

This comment has been minimized.

Copy link
Member

commented Oct 3, 2019

discussed at rustc meeting. accepted for beta backport in tandem with PR #64989 (since that fixes an ICE this injected).

bors added a commit that referenced this pull request Oct 23, 2019
[beta] backport rollup

This includes a bunch of PRs:
 *  Fix redundant semicolon lint interaction with proc macro attributes #64387
 *  Upgrade async/await to "used" keywords. #64875
 *  syntax: fix dropping of attribute on first param of non-method assocated fn #64894
 *  async/await: improve not-send errors #64895
 *  Silence unreachable code lint from await desugaring #64930
 *  Always mark rust and rust-call abi's as unwind #65020
 *  Account for macro invocation in `let mut $pat` diagnostic. #65123
 *  Ensure that associated `async fn`s have unique fresh param names #65142
 *  Add troubleshooting section to PGO chapter in rustc book. #65402
 *  Upgrade GCC to 8.3.0, glibc to 1.17.0 and crosstool-ng to 1.24.0 for dist-armv7-linux #65302
 *  Optimize `try_expand_impl_trait_type` #65293
 *  use precalculated dominators in explain_borrow #65172
 *  Fix ICE #64964 #64989
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.