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

[Work in Progress] Clarify error for opaque type in async functions #82135

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1490,7 +1490,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
format!(
"{}{}{} {}{}",
if sp.is_desugaring(DesugaringKind::Async) {
"the `Output` of this `async fn`'s "
"checked the return type of this `async fn`, "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look any more clear to me. Maybe add .note("while checking the return type of this `async fn`") instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That does make sense! I'll get that incorporated in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Moved the changes to #82165

} else if count == 1 {
"the "
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/async-await/dont-suggest-missing-await.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/dont-suggest-missing-await.rs:14:18
|
LL | async fn make_u32() -> u32 {
| --- the `Output` of this `async fn`'s found opaque type
| --- checked the return type of this `async fn`, found opaque type
...
LL | take_u32(x)
| ^ expected `u32`, found opaque type
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/async-await/issue-61076.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ error[E0308]: mismatched types
--> $DIR/issue-61076.rs:92:9
|
LL | async fn tuple() -> Tuple {
| ----- the `Output` of this `async fn`'s expected opaque type
| ----- checked the return type of this `async fn`, expected opaque type
...
LL | Tuple(_) => {}
| ^^^^^^^^ expected opaque type, found struct `Tuple`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/suggest-missing-await-closure.rs:16:18
|
LL | async fn make_u32() -> u32 {
| --- the `Output` of this `async fn`'s found opaque type
| --- checked the return type of this `async fn`, found opaque type
...
LL | take_u32(x)
| ^ expected `u32`, found opaque type
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/async-await/suggest-missing-await.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> $DIR/suggest-missing-await.rs:12:14
|
LL | async fn make_u32() -> u32 {
| --- the `Output` of this `async fn`'s found opaque type
| --- checked the return type of this `async fn`, found opaque type
...
LL | take_u32(x)
| ^ expected `u32`, found opaque type
Expand All @@ -18,7 +18,7 @@ error[E0308]: mismatched types
--> $DIR/suggest-missing-await.rs:22:5
|
LL | async fn dummy() {}
| - the `Output` of this `async fn`'s found opaque type
| - checked the return type of this `async fn`, found opaque type
...
LL | dummy()
| ^^^^^^^ expected `()`, found opaque type
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/parser/fn-header-semantic-fail.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ LL | async fn ft1();
LL | async fn ft1() {}
| ^
| |
| the `Output` of this `async fn`'s found opaque type
| checked the return type of this `async fn`, found opaque type
| expected `()`, found opaque type
|
= note: expected fn pointer `fn()`
Expand All @@ -204,7 +204,7 @@ LL | const async unsafe extern "C" fn ft5();
LL | const async unsafe extern "C" fn ft5() {}
| ^
| |
| the `Output` of this `async fn`'s found opaque type
| checked the return type of this `async fn`, found opaque type
| expected `()`, found opaque type
|
= note: expected fn pointer `unsafe extern "C" fn()`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ LL | async fn associated();
LL | async fn associated();
| ^
| |
| the `Output` of this `async fn`'s found opaque type
| checked the return type of this `async fn`, found opaque type
| expected `()`, found opaque type
|
= note: expected fn pointer `fn()`
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/suggestions/match-prev-arm-needing-semi.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0308]: `match` arms have incompatible types
--> $DIR/match-prev-arm-needing-semi.rs:26:18
|
LL | async fn async_dummy() {}
| - the `Output` of this `async fn`'s found opaque type
| - checked the return type of this `async fn`, found opaque type
...
LL | let _ = match true {
| _____________-
Expand Down Expand Up @@ -36,7 +36,7 @@ error[E0308]: `match` arms have incompatible types
--> $DIR/match-prev-arm-needing-semi.rs:39:18
|
LL | async fn async_dummy2() {}
| - the `Output` of this `async fn`'s found opaque type
| - checked the return type of this `async fn`, found opaque type
...
LL | let _ = match true {
| _____________-
Expand Down Expand Up @@ -70,7 +70,7 @@ error[E0308]: `match` arms have incompatible types
--> $DIR/match-prev-arm-needing-semi.rs:50:18
|
LL | async fn async_dummy2() {}
| - the `Output` of this `async fn`'s found opaque type
| - checked the return type of this `async fn`, found opaque type
...
LL | let _ = match true {
| _____________-
Expand Down