forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#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 rust-lang#97332. r? `@estebank` cc `@eholk` `@compiler-errors`
- Loading branch information
Showing
21 changed files
with
389 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/test/ui/async-await/issue-70935-complex-spans.drop_tracking.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
error[E0277]: `Sender<i32>` cannot be shared between threads safely | ||
--> $DIR/issue-70935-complex-spans.rs:13:45 | ||
| | ||
LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send { | ||
| ^^^^^^^^^^^^^^^^^^ `Sender<i32>` cannot be shared between threads safely | ||
| | ||
= help: the trait `Sync` is not implemented for `Sender<i32>` | ||
= note: required because of the requirements on the impl of `Send` for `&Sender<i32>` | ||
note: required because it's used within this closure | ||
--> $DIR/issue-70935-complex-spans.rs:25:13 | ||
| | ||
LL | baz(|| async{ | ||
| _____________^ | ||
LL | | foo(tx.clone()); | ||
LL | | }).await; | ||
| |_________^ | ||
note: required because it's used within this async block | ||
--> $DIR/issue-70935-complex-spans.rs:9:67 | ||
| | ||
LL | async fn baz<T>(_c: impl FnMut() -> T) where T: Future<Output=()> { | ||
| ___________________________________________________________________^ | ||
LL | | | ||
LL | | } | ||
| |_^ | ||
= note: required because it captures the following types: `ResumeTy`, `impl Future<Output = ()>`, `()` | ||
note: required because it's used within this async block | ||
--> $DIR/issue-70935-complex-spans.rs:23:16 | ||
| | ||
LL | async move { | ||
| ________________^ | ||
LL | | | ||
LL | | baz(|| async{ | ||
LL | | foo(tx.clone()); | ||
LL | | }).await; | ||
LL | | } | ||
| |_____^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
8 changes: 4 additions & 4 deletions
8
...nc-await/issue-70935-complex-spans.stderr → ...t/issue-70935-complex-spans.normal.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.