Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,18 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
exp_span, exp_found.expected, exp_found.found,
);

match self.tcx.coroutine_kind(cause.body_id) {
Some(hir::CoroutineKind::Desugared(
hir::CoroutineDesugaring::Async | hir::CoroutineDesugaring::AsyncGen,
_,
)) => (),
None
| Some(
hir::CoroutineKind::Coroutine(_)
| hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Gen, _),
) => return,
}

if let ObligationCauseCode::CompareImplItem { .. } = cause.code() {
return;
}
Expand Down
1 change: 0 additions & 1 deletion tests/ui/async-await/coroutine-desc.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ LL | fun(one(), two());
| | expected all arguments to be this future type because they need to match the type of this parameter
| arguments to this function are incorrect
|
= help: consider `await`ing on both `Future`s
= note: distinct uses of `impl Trait` result in different opaque types
note: function defined here
--> $DIR/coroutine-desc.rs:7:4
Expand Down
9 changes: 0 additions & 9 deletions tests/ui/async-await/dont-suggest-missing-await.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,11 @@ LL | take_u32(x)
| |
| arguments to this function are incorrect
|
note: calling an async function returns a future
--> $DIR/dont-suggest-missing-await.rs:14:18
|
LL | take_u32(x)
| ^
note: function defined here
--> $DIR/dont-suggest-missing-await.rs:5:4
|
LL | fn take_u32(x: u32) {}
| ^^^^^^^^ ------
help: consider `await`ing on the `Future`
|
LL | take_u32(x.await)
| ++++++

error: aborting due to 1 previous error

Expand Down
9 changes: 0 additions & 9 deletions tests/ui/impl-trait/issue-102605.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,11 @@ LL | convert_result(foo())
| |
| arguments to this function are incorrect
|
note: calling an async function returns a future
--> $DIR/issue-102605.rs:13:20
|
LL | convert_result(foo())
| ^^^^^
note: function defined here
--> $DIR/issue-102605.rs:7:4
|
LL | fn convert_result<T, E>(r: Result<T, E>) -> Option<T> {
| ^^^^^^^^^^^^^^ ---------------
help: consider `await`ing on the `Future`
|
LL | convert_result(foo().await)
| ++++++
help: try wrapping the expression in `Err`
|
LL | convert_result(Err(foo()))
Expand Down
Loading