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 8 pull requests #70325

Closed
wants to merge 26 commits into from
Closed

Conversation

Centril
Copy link
Contributor

@Centril Centril commented Mar 23, 2020

Successful merges:

Failed merges:

r? @ghost

GuillaumeGomez and others added 26 commits February 26, 2020 22:08
Currently, constructing a waker requires calling the unsafe
`Waker::from_raw` API. This API requires the user to manually construct
a vtable for the waker themself - which is both cumbersome and very
error prone. This API would provide an ergonomic, straightforward and
guaranteed memory-safe way of constructing a waker.

It has been our longstanding intention that the `Waker` type essentially
function as an `Arc<dyn Wake>`, with a `Wake` trait as defined here. Two
considerations prevented the original API from being shipped as simply
an `Arc<dyn Wake>`:

- We want to support futures on embedded systems, which may not have an
  allocator, and in optimized executors for which this API may not be
  best-suited. Therefore, we have always explicitly supported the
  maximally-flexible (but also memory-unsafe) `RawWaker` API, and
  `Waker` has always lived in libcore.
- Because `Waker` lives in libcore and `Arc` lives in liballoc, it has
  not been feasible to provide a constructor for `Waker` from `Arc<dyn
  Wake>`.

Therefore, the Wake trait was left out of the initial version of the
task waker API.

However, as Rust 1.41, it is possible under the more flexible orphan
rules to implement `From<Arc<W>> for Waker where W: Wake` in liballoc.
Therefore, we can now define this constructor even though `Waker` lives
in libcore.

This PR adds these APIs:

- A `Wake` trait, which contains two methods
    - A required method `wake`, which is called by `Waker::wake`
    - A provided method `wake_by_ref`, which is called by
      `Waker::wake_by_ref` and which implementors can override if they
      can optimize this use case.
- An implementation of `From<Arc<W>> for Waker where W: Wake + Send +
  Sync + 'static`
- A similar implementation of `From<Arc<W>> for RawWaker`.
Co-Authored-By: Ashley Mannix <[email protected]>
Co-Authored-By: Ashley Mannix <[email protected]>
…oats

Add Wake trait for safe construction of Wakers.

Currently, constructing a waker requires calling the unsafe `Waker::from_raw` API. This API requires the user to manually construct a vtable for the waker themself - which is both cumbersome and very error prone. This API would provide an ergonomic, straightforward and guaranteed memory-safe way of constructing a waker.

It has been our longstanding intention that the `Waker` type essentially function as an `Arc<dyn Wake>`, with a `Wake` trait as defined here. Two considerations prevented the original API from being shipped as simply an `Arc<dyn Wake>`:

- We want to support futures on embedded systems, which may not have an allocator, and in optimized executors for which this API may not be best-suited. Therefore, we have always explicitly supported the maximally-flexible (but also memory-unsafe) `RawWaker` API, and `Waker` has always lived in libcore.
- Because `Waker` lives in libcore and `Arc` lives in liballoc, it has not been feasible to provide a constructor for `Waker` from `Arc<dyn Wake>`.

Therefore, the Wake trait was left out of the initial version of the task waker API.

However, as Rust 1.41, it is possible under the more flexible orphan rules to implement `From<Arc<W>> for Waker where W: Wake` in liballoc. Therefore, we can now define this constructor even though `Waker` lives in libcore.

This PR adds these APIs:

- A `Wake` trait, which contains two methods
    - A required method `wake`, which is called by `Waker::wake`
    - A provided method `wake_by_ref`, which is called by `Waker::wake_by_ref` and which implementors can override if they can optimize this use case.
- An implementation of `From<Arc<W>> for Waker where W: Wake + Send + Sync + 'static`
- A similar implementation of `From<Arc<W>> for RawWaker`.
…ion, r=ehuss,aleksator,ollie27

Stabilize --crate-version option in rustdoc

I don't see any reason to not stabilize it anymore, so let's go!

cc @kinnison @ehuss

r? @ollie27
…atthewjasper

Make `needs_drop` less pessimistic on generators

Generators only have non-trivial drop logic when they may store (in upvars or across yields) a type that does.

This prevents generation of some unnecessary MIR in simple generators. There might be some impact on compile times, but this is probably limited in real-world applications.

~~This builds off of rust-lang#69814 since that contains some fixes that are made relevant by *this* PR (see rust-lang#69814 (comment) (this has been merged)
rustc_mir: remove extra space when pretty-printing MIR.
add err_machine_stop macro

We have that for all other error kinds, but here I somehow forgot it.

r? @oli-obk
Rename remaining occurences of Void to Opaque.

Two mentions of the type were missed when the type was renamed.
Split long derive lists into two derive attributes.
@Centril Centril added the rollup A PR which is a rollup label Mar 23, 2020
@Centril
Copy link
Contributor Author

Centril commented Mar 23, 2020

@bors r+ p=8 rollup=never

@bors
Copy link
Contributor

bors commented Mar 23, 2020

📌 Commit 40c0ef4 has been approved by Centril

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Mar 23, 2020
@rust-highfive
Copy link
Collaborator

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.
2020-03-23T17:12:38.3705661Z ========================== Starting Command Output ===========================
2020-03-23T17:12:38.3707892Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/d2616e91-94b4-4ccf-a2d5-ca247ecaa58f.sh
2020-03-23T17:12:38.3708100Z 
2020-03-23T17:12:38.3712190Z ##[section]Finishing: Disable git automatic line ending conversion
2020-03-23T17:12:38.3730634Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/70325/merge to s
2020-03-23T17:12:38.3734369Z Task         : Get sources
2020-03-23T17:12:38.3734664Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-23T17:12:38.3735750Z Version      : 1.0.0
2020-03-23T17:12:38.3735920Z Author       : Microsoft
---
2020-03-23T17:12:39.4028826Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-03-23T17:12:39.4035325Z ##[command]git config gc.auto 0
2020-03-23T17:12:39.4040284Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-03-23T17:12:39.4050188Z ##[command]git config --get-all http.proxy
2020-03-23T17:12:39.4058518Z ##[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/70325/merge:refs/remotes/pull/70325/merge
---
2020-03-23T17:19:38.9580953Z     Checking rustc_ty v0.0.0 (/checkout/src/librustc_ty)
2020-03-23T17:19:39.1158613Z error[E0061]: this function takes 0 arguments but 2 arguments were supplied
2020-03-23T17:19:39.1165691Z    --> src/librustc_ty/needs_drop.rs:104:48
2020-03-23T17:19:39.1166550Z     |
2020-03-23T17:19:39.1167296Z 104 |                         for upvar_ty in substs.upvar_tys(def_id, tcx) {
2020-03-23T17:19:39.1169497Z     |                                                |
2020-03-23T17:19:39.1175439Z     |                                                expected 0 arguments
2020-03-23T17:19:39.1238108Z 
2020-03-23T17:19:39.1240174Z error[E0061]: this function takes 0 arguments but 2 arguments were supplied
2020-03-23T17:19:39.1240174Z error[E0061]: this function takes 0 arguments but 2 arguments were supplied
2020-03-23T17:19:39.1241387Z    --> src/librustc_ty/needs_drop.rs:108:46
2020-03-23T17:19:39.1241815Z     |
2020-03-23T17:19:39.1242337Z 108 |                         let witness = substs.witness(def_id, tcx);
2020-03-23T17:19:39.1244023Z     |                                              |
2020-03-23T17:19:39.1244639Z     |                                              expected 0 arguments
2020-03-23T17:19:39.1244919Z 
2020-03-23T17:19:39.1765186Z error: aborting due to 2 previous errors
2020-03-23T17:19:39.1765186Z error: aborting due to 2 previous errors
2020-03-23T17:19:39.1766127Z 
2020-03-23T17:19:39.1766727Z For more information about this error, try `rustc --explain E0061`.
2020-03-23T17:19:39.1802859Z error: could not compile `rustc_ty`.
2020-03-23T17:19:39.1803323Z 
2020-03-23T17:19:39.1804177Z To learn more, run the command again with --verbose.
2020-03-23T17:19:39.1804983Z warning: build failed, waiting for other jobs to finish...
2020-03-23T17:19:50.4341516Z error: build failed
2020-03-23T17:19:50.4350247Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "2" "--release" "--color" "always" "--features" " llvm" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json-render-diagnostics"
2020-03-23T17:19:50.4358341Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check
2020-03-23T17:19:50.4359100Z Build completed unsuccessfully in 0:04:30
2020-03-23T17:19:50.4403344Z == clock drift check ==
2020-03-23T17:19:50.4418718Z   local time: Mon Mar 23 17:19:50 UTC 2020
2020-03-23T17:19:50.4418718Z   local time: Mon Mar 23 17:19:50 UTC 2020
2020-03-23T17:19:50.7283331Z   network time: Mon, 23 Mar 2020 17:19:50 GMT
2020-03-23T17:19:50.7286149Z == end clock drift check ==
2020-03-23T17:19:51.5461151Z 
2020-03-23T17:19:51.5537218Z ##[error]Bash exited with code '1'.
2020-03-23T17:19:51.5554569Z ##[section]Finishing: Run build
2020-03-23T17:19:51.5604498Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/70325/merge to s
2020-03-23T17:19:51.5608667Z Task         : Get sources
2020-03-23T17:19:51.5608956Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-23T17:19:51.5609235Z Version      : 1.0.0
2020-03-23T17:19:51.5609418Z Author       : Microsoft
2020-03-23T17:19:51.5609418Z Author       : Microsoft
2020-03-23T17:19:51.5609710Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-03-23T17:19:51.5610065Z ==============================================================================
2020-03-23T17:19:51.8805402Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-03-23T17:19:51.8846134Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/70325/merge to s
2020-03-23T17:19:51.8931274Z Cleaning up task key
2020-03-23T17:19:51.8932638Z Start cleaning up orphan processes.
2020-03-23T17:19:51.9112542Z Terminate orphan process: pid (3679) (python)
2020-03-23T17:19:51.9244815Z ##[section]Finishing: Finalize Job

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 @rust-lang/infra. (Feature Requests)

@Centril Centril closed this Mar 23, 2020
@Centril Centril deleted the rollup-8z7w135 branch March 23, 2020 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants