Don't ICE when dumping MIR of a synthetic coroutine body

This commit is contained in:
Michael Goulet 2024-08-28 18:28:46 -04:00
parent d6c8169c18
commit a4f2a311db

View File

@ -612,7 +612,9 @@ fn write_mir_sig(tcx: TyCtxt<'_>, body: &Body<'_>, w: &mut dyn io::Write) -> io:
let def_id = body.source.def_id(); let def_id = body.source.def_id();
let kind = tcx.def_kind(def_id); let kind = tcx.def_kind(def_id);
let is_function = match kind { let is_function = match kind {
DefKind::Fn | DefKind::AssocFn | DefKind::Ctor(..) => true, DefKind::Fn | DefKind::AssocFn | DefKind::Ctor(..) | DefKind::SyntheticCoroutineBody => {
true
}
_ => tcx.is_closure_like(def_id), _ => tcx.is_closure_like(def_id),
}; };
match (kind, body.source.promoted) { match (kind, body.source.promoted) {