mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Add MutatingUseContext::Yield
...emulating `MutatingUseContext::Call`
This commit is contained in:
parent
e5f35df2c6
commit
d0086166b7
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.
|
||||||
|
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user