Skip to content

Commit f86ac59

Browse files
committed
Match on coroutine kind, include AsyncGen coroutines for suggestion
1 parent 233f832 commit f86ac59

File tree

1 file changed

+6
-6
lines changed
  • compiler/rustc_trait_selection/src/error_reporting/infer

1 file changed

+6
-6
lines changed

compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,12 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
167167
exp_span, exp_found.expected, exp_found.found,
168168
);
169169

170-
let is_async_block = matches!(
171-
self.tcx.coroutine_kind(cause.body_id),
172-
Some(rustc_hir::CoroutineKind::Desugared(rustc_hir::CoroutineDesugaring::Async, _)),
173-
);
174-
if !is_async_block {
175-
return;
170+
match self.tcx.coroutine_kind(cause.body_id) {
171+
Some(hir::CoroutineKind::Desugared(
172+
hir::CoroutineDesugaring::Async | hir::CoroutineDesugaring::AsyncGen,
173+
_,
174+
)) => (),
175+
_ => return,
176176
}
177177

178178
if let ObligationCauseCode::CompareImplItem { .. } = cause.code() {

0 commit comments

Comments
 (0)