Add MutatingUseContext::Yield

...emulating `MutatingUseContext::Call`
This commit is contained in:
Dylan MacKenzie 2020-04-02 10:54:24 -07:00
parent e5f35df2c6
commit d0086166b7
3 changed files with 6 additions and 2 deletions

View File

@ -269,7 +269,8 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
fn visit_local(&mut self, &local: &mir::Local, context: PlaceContext, location: Location) {
match context {
PlaceContext::MutatingUse(MutatingUseContext::Call) => {
PlaceContext::MutatingUse(MutatingUseContext::Call)
| PlaceContext::MutatingUse(MutatingUseContext::Yield) => {
self.assign(local, location);
}

View File

@ -510,7 +510,7 @@ macro_rules! make_mir_visitor {
self.visit_operand(value, source_location);
self.visit_place(
resume_arg,
PlaceContext::MutatingUse(MutatingUseContext::Store),
PlaceContext::MutatingUse(MutatingUseContext::Yield),
source_location,
);
}
@ -1052,6 +1052,8 @@ pub enum MutatingUseContext {
AsmOutput,
/// Destination of a call.
Call,
/// Destination of a yield.
Yield,
/// Being dropped.
Drop,
/// Mutable borrow.

View File

@ -133,6 +133,7 @@ pub fn categorize(context: PlaceContext) -> Option<DefUse> {
// the def in call only to the input from the success
// path and not the unwind path. -nmatsakis
PlaceContext::MutatingUse(MutatingUseContext::Call) |
PlaceContext::MutatingUse(MutatingUseContext::Yield) |
// Storage live and storage dead aren't proper defines, but we can ignore
// values that come before them.