You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of #98259 - jyn514:improve-obligation-errors, r=estebank
Greatly improve error reporting for futures and generators in `note_obligation_cause_code`
Most futures don't go through this code path, because they're caught by
`maybe_note_obligation_cause_for_async_await`. But all generators do,
and `maybe_note` is imperfect and doesn't catch all futures. Improve the error message for those it misses.
At some point, we may want to consider unifying this with the code for `maybe_note_async_await`,
so that `async_await` notes all parent constraints, and `note_obligation` can point to yield points.
But both functions are quite complicated, and it's not clear to me how to combine them;
this seems like a good incremental improvement.
Helps with #97332.
r? ``@estebank`` cc ``@eholk`` ``@compiler-errors``
Copy file name to clipboardexpand all lines: src/test/ui/async-await/partial-drop-partial-reinit.stderr
+14-6
Original file line number
Diff line number
Diff line change
@@ -11,13 +11,21 @@ LL | async fn foo() {
11
11
|
12
12
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `NotSend`
13
13
= note: required because it appears within the type `(NotSend,)`
14
-
= note: required because it appears within the type `{ResumeTy, (NotSend,), impl Future<Output = ()>, ()}`
15
-
= note: required because it appears within the type `[static generator@$DIR/partial-drop-partial-reinit.rs:22:16: 27:2]`
16
-
= note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@$DIR/partial-drop-partial-reinit.rs:22:16: 27:2]>`
17
-
= note: required because it appears within the type `impl Future<Output = ()>`
18
-
= note: required because it appears within the type `impl Future<Output = ()>`
14
+
= note: required because it captures the following types: `ResumeTy`, `(NotSend,)`, `impl Future<Output = ()>`, `()`
15
+
note: required because it's used within this async block
0 commit comments