Add missing check for async body when suggesting await on futures.
This commit is contained in:
parent
a48e7b0057
commit
ab2c8ffda9
4 changed files with 12 additions and 19 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue