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) { fn visit_local(&mut self, &local: &mir::Local, context: PlaceContext, location: Location) {
match context { match context {
PlaceContext::MutatingUse(MutatingUseContext::Call) => { PlaceContext::MutatingUse(MutatingUseContext::Call)
| PlaceContext::MutatingUse(MutatingUseContext::Yield) => {
self.assign(local, location); self.assign(local, location);
} }

View File

@ -510,7 +510,7 @@ macro_rules! make_mir_visitor {
self.visit_operand(value, source_location); self.visit_operand(value, source_location);
self.visit_place( self.visit_place(
resume_arg, resume_arg,
PlaceContext::MutatingUse(MutatingUseContext::Store), PlaceContext::MutatingUse(MutatingUseContext::Yield),
source_location, source_location,
); );
} }
@ -1052,6 +1052,8 @@ pub enum MutatingUseContext {
AsmOutput, AsmOutput,
/// Destination of a call. /// Destination of a call.
Call, Call,
/// Destination of a yield.
Yield,
/// Being dropped. /// Being dropped.
Drop, Drop,
/// Mutable borrow. /// 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 // the def in call only to the input from the success
// path and not the unwind path. -nmatsakis // path and not the unwind path. -nmatsakis
PlaceContext::MutatingUse(MutatingUseContext::Call) | PlaceContext::MutatingUse(MutatingUseContext::Call) |
PlaceContext::MutatingUse(MutatingUseContext::Yield) |
// Storage live and storage dead aren't proper defines, but we can ignore // Storage live and storage dead aren't proper defines, but we can ignore
// values that come before them. // values that come before them.