diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-04-02 10:54:24 -0700 |
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-05-03 11:36:11 -0700 |
| commit | d0086166b725d184b84b84b6270446998f6656cc (patch) | |
| tree | 2e61512e6e0f7a5550922cf9b805f67ce04f47ed | |
| parent | e5f35df2c6944b843b08369c4b2ff3bdb0beb2d2 (diff) | |
| download | rust-d0086166b725d184b84b84b6270446998f6656cc.tar.gz rust-d0086166b725d184b84b84b6270446998f6656cc.zip | |
Add `MutatingUseContext::Yield`
...emulating `MutatingUseContext::Call`
| -rw-r--r-- | src/librustc_codegen_ssa/mir/analyze.rs | 3 | ||||
| -rw-r--r-- | src/librustc_middle/mir/visit.rs | 4 | ||||
| -rw-r--r-- | src/librustc_mir/util/liveness.rs | 1 |
3 files changed, 6 insertions, 2 deletions
diff --git a/src/librustc_codegen_ssa/mir/analyze.rs b/src/librustc_codegen_ssa/mir/analyze.rs index a677ffea3af..9fcaf2818e8 100644 --- a/src/librustc_codegen_ssa/mir/analyze.rs +++ b/src/librustc_codegen_ssa/mir/analyze.rs @@ -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); } diff --git a/src/librustc_middle/mir/visit.rs b/src/librustc_middle/mir/visit.rs index d32a8d43445..97f7cccdb60 100644 --- a/src/librustc_middle/mir/visit.rs +++ b/src/librustc_middle/mir/visit.rs @@ -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. diff --git a/src/librustc_mir/util/liveness.rs b/src/librustc_mir/util/liveness.rs index c6eefcc5eca..c261219cc73 100644 --- a/src/librustc_mir/util/liveness.rs +++ b/src/librustc_mir/util/liveness.rs @@ -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. |
