-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Pretty-print generators with their generator_kind
#104931
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
Conversation
r? @eholk (rustbot has picked a reviewer for you, use r? to override) |
@bors r+ |
📌 Commit daa4845365c5fce7566063552ee52ec8627fac10 has been approved by It is now in the queue for this repository. |
@@ -29,13 +29,13 @@ LL | | | |||
LL | | } | |||
| |_^ expected `u8`, found `()` | |||
|
|||
error[E0271]: expected `impl Future<Output = u8>` to be a future that resolves to `()`, but it resolves to `u8` | |||
error[E0271]: expected `[static `async` block@$DIR/async-block-control-flow-static-semantics.rs:23:17: 25:6]` to be a future that resolves to `()`, but it resolves to `u8` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the nested backticks in `async`
is a bit strange looking in these type errors.
Also, I'm not sure if we expect users to know what static
generator movability is -- if the generator kind is Async
, maybe we could just drop the static
(maybe unless we pass in -Zverbose
or something)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I pushed an updated version that does this.
Also now uses the descr()
method for explicit diagnostics that still print `async` block
, but when printing the type of the block itself, the output is cleaner now.
After removing `GenFuture`, I special-cased async generators to pretty-print as `impl Future<Output = X>` mainly to avoid too much diagnostics changes originally. This now reverses that change so that async fn/blocks are pretty-printed as `[$movability `async` $something@$source-position]` in various diagnostics, and updates the tests that this touches.
daa4845
to
c96d888
Compare
Another case that could maybe be improved further would be:
The |
@bors r+ Thanks for the improvements! |
Pretty-print generators with their `generator_kind` After removing `GenFuture`, I special-cased async generators to pretty-print as `impl Future<Output = X>` mainly to avoid too much diagnostics changes originally. This now reverses that change so that async fn/blocks are pretty-printed as `[$async-type@$source-position]` in various diagnostics, and updates the tests that this touches.
@bors r- failed in a rollup |
Hmm, looks like this was actually not the problem 😅 |
Pretty-print generators with their `generator_kind` After removing `GenFuture`, I special-cased async generators to pretty-print as `impl Future<Output = X>` mainly to avoid too much diagnostics changes originally. This now reverses that change so that async fn/blocks are pretty-printed as `[$async-type@$source-position]` in various diagnostics, and updates the tests that this touches.
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#95836 (Use `rust_out{exe_suffix}` for doctests) - rust-lang#104882 (notify lcnr on changes to `ObligationCtxt`) - rust-lang#104892 (Explain how to get the discriminant out of a `#[repr(T)] enum` with payload) - rust-lang#104917 (Allow non-org members to label `requires-debug-assertions`) - rust-lang#104931 (Pretty-print generators with their `generator_kind`) - rust-lang#104934 (Remove redundant `all` in cfg) - rust-lang#104944 (Support unit tests for jsondoclint) - rust-lang#104946 (rustdoc: improve popover focus handling JS) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
After removing
GenFuture
, I special-cased async generators to pretty-print asimpl Future<Output = X>
mainly to avoid too much diagnostics changes originally.This now reverses that change so that async fn/blocks are pretty-printed as
[$async-type@$source-position]
in various diagnostics, and updates the tests that this touches.