place.hash_stable(hcx, hasher);
rvalue.hash_stable(hcx, hasher);
}
+ mir::StatementKind::ReadForMatch(ref place) => {
+ place.hash_stable(hcx, hasher);
+ }
mir::StatementKind::SetDiscriminant { ref place, variant_index } => {
place.hash_stable(hcx, hasher);
variant_index.hash_stable(hcx, hasher);
/// Write the RHS Rvalue to the LHS Place.
Assign(Place<'tcx>, Rvalue<'tcx>),
+ /// This represents all the reading that a pattern match may do
+ /// (e.g. inspecting constants and discriminant values).
+ ReadForMatch(Place<'tcx>),
+
/// Write the discriminant for a variant to the enum Place.
SetDiscriminant { place: Place<'tcx>, variant_index: usize },
use self::StatementKind::*;
match self.kind {
Assign(ref place, ref rv) => write!(fmt, "{:?} = {:?}", place, rv),
+ ReadForMatch(ref place) => write!(fmt, "ReadForMatch({:?})", place),
// (reuse lifetime rendering policy from ppaux.)
EndRegion(ref ce) => write!(fmt, "EndRegion({})", ty::ReScope(*ce)),
Validate(ref op, ref places) => write!(fmt, "Validate({:?}, {:?})", op, places),
EnumTypeFoldableImpl! {
impl<'tcx> TypeFoldable<'tcx> for StatementKind<'tcx> {
(StatementKind::Assign)(a, b),
+ (StatementKind::ReadForMatch)(place),
(StatementKind::SetDiscriminant) { place, variant_index },
(StatementKind::StorageLive)(a),
(StatementKind::StorageDead)(a),
ref $($mutability)* rvalue) => {
self.visit_assign(block, place, rvalue, location);
}
+ StatementKind::ReadForMatch(ref $($mutability)* place) => {
+ self.visit_place(place,
+ PlaceContext::Inspect,
+ location);
+ }
StatementKind::EndRegion(_) => {}
StatementKind::Validate(_, ref $($mutability)* places) => {
for operand in places {
asm::codegen_inline_asm(&bx, asm, outputs, input_vals);
bx
}
+ mir::StatementKind::ReadForMatch(_) |
mir::StatementKind::EndRegion(_) |
mir::StatementKind::Validate(..) |
mir::StatementKind::UserAssertTy(..) |
flow_state,
);
}
+ StatementKind::ReadForMatch(ref place) => {
+ self.access_place(ContextKind::ReadForMatch.new(location),
+ (place, span),
+ (Deep, Read(ReadKind::Borrow(BorrowKind::Shared))),
+ LocalMutationIsAllowed::No,
+ flow_state,
+ );
+ }
StatementKind::SetDiscriminant {
ref place,
variant_index: _,
CallDest,
Assert,
Yield,
+ ReadForMatch,
StorageDead,
}
JustWrite
);
}
+ StatementKind::ReadForMatch(ref place) => {
+ self.access_place(
+ ContextKind::ReadForMatch.new(location),
+ place,
+ (Deep, Read(ReadKind::Borrow(BorrowKind::Shared))),
+ LocalMutationIsAllowed::No,
+ );
+ }
StatementKind::SetDiscriminant {
ref place,
variant_index: _,
);
}
}
- StatementKind::StorageLive(_)
+ StatementKind::ReadForMatch(_)
+ | StatementKind::StorageLive(_)
| StatementKind::StorageDead(_)
| StatementKind::InlineAsm { .. }
| StatementKind::EndRegion(_)
}
}
+ mir::StatementKind::ReadForMatch(..) |
mir::StatementKind::SetDiscriminant { .. } |
mir::StatementKind::StorageLive(..) |
mir::StatementKind::Validate(..) |
}
self.gather_rvalue(rval);
}
+ StatementKind::ReadForMatch(ref place) => {
+ self.create_move_path(place);
+ }
StatementKind::InlineAsm { ref outputs, ref inputs, ref asm } => {
for (output, kind) in outputs.iter().zip(&asm.outputs) {
if !kind.is_indirect {
self.deallocate_local(old_val)?;
}
+ // FIXME: is there some dynamic semantics we should attach to
+ // these? Or am I correct in thinking that the inerpreter
+ // is solely intended for borrowck'ed code?
+ ReadForMatch(..) => {}
+
// Validity checks.
Validate(op, ref places) => {
for operand in places {
self.source_info = statement.source_info;
match statement.kind {
StatementKind::Assign(..) |
+ StatementKind::ReadForMatch(..) |
StatementKind::SetDiscriminant { .. } |
StatementKind::StorageLive(..) |
StatementKind::StorageDead(..) |
StatementKind::Assign(ref place, ref rvalue) => {
this.visit_assign(bb, place, rvalue, location);
}
+ StatementKind::ReadForMatch(..) |
StatementKind::SetDiscriminant { .. } |
StatementKind::StorageLive(_) |
StatementKind::StorageDead(_) |
{
for stmt in &mir[bb].statements {
match stmt.kind {
+ StatementKind::ReadForMatch(_) |
StatementKind::StorageLive(_) |
StatementKind::StorageDead(_) |
StatementKind::EndRegion(_) |
mir::StatementKind::Assign(ref place, ref rvalue) => {
(place, rvalue)
}
+ mir::StatementKind::ReadForMatch(_) |
mir::StatementKind::StorageLive(_) |
mir::StatementKind::StorageDead(_) |
mir::StatementKind::InlineAsm { .. } |
self.record("Statement", statement);
self.record(match statement.kind {
StatementKind::Assign(..) => "StatementKind::Assign",
+ StatementKind::ReadForMatch(..) => "StatementKind::ReadForMatch",
StatementKind::EndRegion(..) => "StatementKind::EndRegion",
StatementKind::Validate(..) => "StatementKind::Validate",
StatementKind::SetDiscriminant { .. } => "StatementKind::SetDiscriminant",