Skip to content

Commit f35d001

Browse files
committed
Visit and print async_fut local for async drop.
1 parent 18eeac0 commit f35d001

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

compiler/rustc_middle/src/mir/pretty.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,10 @@ impl<'tcx> TerminatorKind<'tcx> {
929929
}
930930
Yield { value, resume_arg, .. } => write!(fmt, "{resume_arg:?} = yield({value:?})"),
931931
Unreachable => write!(fmt, "unreachable"),
932-
Drop { place, .. } => write!(fmt, "drop({place:?})"),
932+
Drop { place, async_fut: None, .. } => write!(fmt, "drop({place:?})"),
933+
Drop { place, async_fut: Some(async_fut), .. } => {
934+
write!(fmt, "async drop({place:?}; poll={async_fut:?})")
935+
}
933936
Call { func, args, destination, .. } => {
934937
write!(fmt, "{destination:?} = ")?;
935938
write!(fmt, "{func:?}(")?;

compiler/rustc_middle/src/mir/visit.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,13 +531,20 @@ macro_rules! make_mir_visitor {
531531
unwind: _,
532532
replace: _,
533533
drop: _,
534-
async_fut: _,
534+
async_fut,
535535
} => {
536536
self.visit_place(
537537
place,
538538
PlaceContext::MutatingUse(MutatingUseContext::Drop),
539539
location
540540
);
541+
if let Some(async_fut) = async_fut {
542+
self.visit_local(
543+
$(&$mutability)? *async_fut,
544+
PlaceContext::MutatingUse(MutatingUseContext::Borrow),
545+
location
546+
);
547+
}
541548
}
542549

543550
TerminatorKind::Call {

0 commit comments

Comments
 (0)