use rustc_middle::mir::{InlineAsmOperand, Terminator, TerminatorKind};
use rustc_middle::mir::{Statement, StatementKind};
use rustc_middle::ty::TyCtxt;
-use std::iter;
use crate::{
borrow_set::BorrowSet, facts::AllFacts, location::LocationTable, path_utils::*, AccessDepth,
- Activation, ArtificialField, BorrowIndex, Deep, JustWrite, LocalMutationIsAllowed, MutateMode,
- Read, ReadKind, ReadOrWrite, Reservation, Shallow, Write, WriteAndRead, WriteKind,
+ Activation, ArtificialField, BorrowIndex, Deep, LocalMutationIsAllowed, Read, ReadKind,
+ ReadOrWrite, Reservation, Shallow, Write, WriteKind,
};
pub(super) fn generate_invalidates<'tcx>(
StatementKind::Assign(box (lhs, rhs)) => {
self.consume_rvalue(location, rhs);
- self.mutate_place(location, *lhs, Shallow(None), JustWrite);
+ self.mutate_place(location, *lhs, Shallow(None));
}
StatementKind::FakeRead(box (_, _)) => {
// Only relevant for initialized/liveness/safety checks.
}
StatementKind::SetDiscriminant { place, variant_index: _ } => {
- self.mutate_place(location, **place, Shallow(None), JustWrite);
- }
- StatementKind::LlvmInlineAsm(asm) => {
- for (o, output) in iter::zip(&asm.asm.outputs, &*asm.outputs) {
- if o.is_indirect {
- // FIXME(eddyb) indirect inline asm outputs should
- // be encoded through MIR place derefs instead.
- self.access_place(
- location,
- *output,
- (Deep, Read(ReadKind::Copy)),
- LocalMutationIsAllowed::No,
- );
- } else {
- self.mutate_place(
- location,
- *output,
- if o.is_rw { Deep } else { Shallow(None) },
- if o.is_rw { WriteAndRead } else { JustWrite },
- );
- }
- }
- for (_, input) in asm.inputs.iter() {
- self.consume_operand(location, input);
- }
+ self.mutate_place(location, **place, Shallow(None));
}
StatementKind::CopyNonOverlapping(box rustc_middle::mir::CopyNonOverlapping {
ref src,
target: _,
unwind: _,
} => {
- self.mutate_place(location, *drop_place, Deep, JustWrite);
+ self.mutate_place(location, *drop_place, Deep);
self.consume_operand(location, new_value);
}
TerminatorKind::Call {
self.consume_operand(location, arg);
}
if let Some((dest, _ /*bb*/)) = destination {
- self.mutate_place(location, *dest, Deep, JustWrite);
+ self.mutate_place(location, *dest, Deep);
}
}
TerminatorKind::Assert { ref cond, expected: _, ref msg, target: _, cleanup: _ } => {
}
}
- self.mutate_place(location, *resume_arg, Deep, JustWrite);
+ self.mutate_place(location, *resume_arg, Deep);
}
TerminatorKind::Resume | TerminatorKind::Return | TerminatorKind::GeneratorDrop => {
// Invalidate all borrows of local places
}
InlineAsmOperand::Out { reg: _, late: _, place, .. } => {
if let Some(place) = place {
- self.mutate_place(location, place, Shallow(None), JustWrite);
+ self.mutate_place(location, place, Shallow(None));
}
}
InlineAsmOperand::InOut { reg: _, late: _, ref in_value, out_place } => {
self.consume_operand(location, in_value);
if let Some(out_place) = out_place {
- self.mutate_place(location, out_place, Shallow(None), JustWrite);
+ self.mutate_place(location, out_place, Shallow(None));
}
}
InlineAsmOperand::Const { value: _ }
impl<'cx, 'tcx> InvalidationGenerator<'cx, 'tcx> {
/// Simulates mutation of a place.
- fn mutate_place(
- &mut self,
- location: Location,
- place: Place<'tcx>,
- kind: AccessDepth,
- _mode: MutateMode,
- ) {
+ fn mutate_place(&mut self, location: Location, place: Place<'tcx>, kind: AccessDepth) {
self.access_place(
location,
place,