Skip to content

Commit d008616

Browse files
Add MutatingUseContext::Yield
...emulating `MutatingUseContext::Call`
1 parent e5f35df commit d008616

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/librustc_codegen_ssa/mir/analyze.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
269269

270270
fn visit_local(&mut self, &local: &mir::Local, context: PlaceContext, location: Location) {
271271
match context {
272-
PlaceContext::MutatingUse(MutatingUseContext::Call) => {
272+
PlaceContext::MutatingUse(MutatingUseContext::Call)
273+
| PlaceContext::MutatingUse(MutatingUseContext::Yield) => {
273274
self.assign(local, location);
274275
}
275276

src/librustc_middle/mir/visit.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ macro_rules! make_mir_visitor {
510510
self.visit_operand(value, source_location);
511511
self.visit_place(
512512
resume_arg,
513-
PlaceContext::MutatingUse(MutatingUseContext::Store),
513+
PlaceContext::MutatingUse(MutatingUseContext::Yield),
514514
source_location,
515515
);
516516
}
@@ -1052,6 +1052,8 @@ pub enum MutatingUseContext {
10521052
AsmOutput,
10531053
/// Destination of a call.
10541054
Call,
1055+
/// Destination of a yield.
1056+
Yield,
10551057
/// Being dropped.
10561058
Drop,
10571059
/// Mutable borrow.

src/librustc_mir/util/liveness.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ pub fn categorize(context: PlaceContext) -> Option<DefUse> {
133133
// the def in call only to the input from the success
134134
// path and not the unwind path. -nmatsakis
135135
PlaceContext::MutatingUse(MutatingUseContext::Call) |
136+
PlaceContext::MutatingUse(MutatingUseContext::Yield) |
136137

137138
// Storage live and storage dead aren't proper defines, but we can ignore
138139
// values that come before them.

0 commit comments

Comments
 (0)