fix crash in async-drop and async-gen (fix-#161101) - #161190
Conversation
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
r? @TaKO8Ki rustbot has assigned @TaKO8Ki. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| if place.local != RETURN_PLACE { | ||
| return; | ||
| } | ||
|
|
There was a problem hiding this comment.
One more remaining accidental edit
There was a problem hiding this comment.
thanks for reviewing 🫡
| } else if let Rvalue::Use(Operand::Constant(constant), _) = rvalue { | ||
| if let Some(async_gen_pending_def_id) = self.tcx.lang_items().async_gen_pending() | ||
| && let Const::Unevaluated(unevaluated, _) = constant.const_ | ||
| && unevaluated.def == async_gen_pending_def_id |
There was a problem hiding this comment.
How does this happen? Can we somehow either always cause this to happen or always take the above path by ensuring this never happens?
There was a problem hiding this comment.
this fixes the case when the compiler uses the AsyncGenPending lang item for async-gen suspension points. and i see you are saying the approach to make the compiler never use AsyncGenPending(if im not wrong) that kind of an experimental fix, cause we have to touch places where AsyncGenPending is generated... this part of the compiler is a bit sensitive that can demand larger changes and possibly cause performance impact too.. soo i think this approach is by far the simplest fix
handle
AsyncGenPendingconstants inFixReturnPendingVisitorrewriteAsyncGenPendingconstant uses toPoll::<()>::PendinginFutureDropPollshims, matching the existing aggregate pathalso added a regression test for #161101.
issue reproduce - https://godbolt.org/z/d1zb4j974