-
Notifications
You must be signed in to change notification settings - Fork 14k
Description
The return terminator conceptually moves out of the return place _0, but this is not currently reflected by the visitor infrastructure.
This can lead to incorrect dataflow solutions for _0. For example, MaybeLiveLocals reports that _0 is dead before a return, which is wrong (it must always be live there). These don't currently cause any harm, since use of _0 is fairly limited, but they are an issue for destination propagation / NRVO, which can propagate _0 to arbitrary places in the function and needs to have correct information to do so soundly.
The simple fix of calling visit_local from within super_terminator_kind has the problem that the MutVisitor receives a &mut Local, but the local return reads from can not be changed. This can be caught with an assertion, but maybe there is a better solution for this?
cc @rust-lang/wg-mir-opt