use rustc::mir::visit::TyContext;
use rustc::mir::visit::Visitor;
use rustc::mir::{
- BasicBlock, BasicBlockData, Body, Local, Location, Place, PlaceBase, ProjectionElem, Rvalue,
- SourceInfo, Statement, StatementKind, Terminator, TerminatorKind, UserTypeProjection,
+ BasicBlock, BasicBlockData, Body, Local, Location, Place, PlaceBase, PlaceRef, ProjectionElem,
+ Rvalue, SourceInfo, Statement, StatementKind, Terminator, TerminatorKind, UserTypeProjection,
};
use rustc::ty::fold::TypeFoldable;
-use rustc::ty::{self, ClosureSubsts, GeneratorSubsts, RegionVid, Ty};
+use rustc::ty::{self, RegionVid, Ty};
use rustc::ty::subst::SubstsRef;
pub(super) fn generate_constraints<'cx, 'tcx>(
self.super_ty(ty);
}
- /// We sometimes have `generator_substs` within an rvalue, or within a
- /// call. Make them live at the location where they appear.
- fn visit_generator_substs(&mut self, substs: &GeneratorSubsts<'tcx>, location: Location) {
- self.add_regular_live_constraint(*substs, location);
- self.super_generator_substs(substs);
- }
-
- /// We sometimes have `closure_substs` within an rvalue, or within a
- /// call. Make them live at the location where they appear.
- fn visit_closure_substs(&mut self, substs: &ClosureSubsts<'tcx>, location: Location) {
- self.add_regular_live_constraint(*substs, location);
- self.super_closure_substs(substs);
- }
-
fn visit_statement(
&mut self,
statement: &Statement<'tcx>,
// - if it's a deeper projection, we have to filter which
// of the borrows are killed: the ones whose `borrowed_place`
// conflicts with the `place`.
- match place {
- Place {
- base: PlaceBase::Local(local),
- projection: box [],
+ match place.as_ref() {
+ PlaceRef {
+ base: &PlaceBase::Local(local),
+ projection: &[],
} |
- Place {
- base: PlaceBase::Local(local),
- projection: box [ProjectionElem::Deref],
+ PlaceRef {
+ base: &PlaceBase::Local(local),
+ projection: &[ProjectionElem::Deref],
} => {
debug!(
"Recording `killed` facts for borrows of local={:?} at location={:?}",
all_facts,
self.borrow_set,
self.location_table,
- local,
+ &local,
location,
);
}
- Place {
- base: PlaceBase::Static(_),
+ PlaceRef {
+ base: &PlaceBase::Static(_),
..
} => {
// Ignore kills of static or static mut variables.
}
- Place {
- base: PlaceBase::Local(local),
- projection: box [.., _],
+ PlaceRef {
+ base: &PlaceBase::Local(local),
+ projection: &[.., _],
} => {
// Kill conflicting borrows of the innermost local.
debug!(
local, location
);
- if let Some(borrow_indices) = self.borrow_set.local_map.get(local) {
+ if let Some(borrow_indices) = self.borrow_set.local_map.get(&local) {
for &borrow_index in borrow_indices {
let places_conflict = places_conflict::places_conflict(
self.infcx.tcx,