-use crate::borrow_check::borrow_set::{BorrowSet, BorrowData};
-use crate::borrow_check::place_ext::PlaceExt;
-
use rustc::mir::{self, Location, Place, PlaceBase, Body};
use rustc::ty::{self, TyCtxt};
use rustc::ty::RegionVid;
use rustc_data_structures::fx::FxHashMap;
use rustc_index::vec::{Idx, IndexVec};
+use crate::borrow_check::{
+ ToRegionVid, BorrowSet, BorrowData, RegionInferenceContext, PlaceExt, PlaceConflictBias,
+ places_conflict,
+};
use crate::dataflow::{BitDenotation, BottomValue, GenKillSet};
-use crate::borrow_check::nll::region_infer::RegionInferenceContext;
-use crate::borrow_check::nll::ToRegionVid;
-use crate::borrow_check::places_conflict;
use std::rc::Rc;
// Add successor BBs to the work list, if necessary.
let bb_data = &body[bb];
assert!(hi == bb_data.statements.len());
- for &succ_bb in bb_data.terminator.as_ref().unwrap().successors() {
+ for &succ_bb in bb_data.terminator().successors() {
visited.entry(succ_bb)
.and_modify(|lo| {
// `succ_bb` has been seen before. If it wasn't
}
Borrows {
- tcx: tcx,
- body: body,
+ tcx,
+ body,
param_env,
borrow_set: borrow_set.clone(),
borrows_out_of_scope_at_location,
// local must conflict. This is purely an optimization so we don't have to call
// `places_conflict` for every borrow.
if place.projection.is_empty() {
- trans.kill_all(other_borrows_of_local);
+ if !self.body.local_decls[local].is_ref_to_static() {
+ trans.kill_all(other_borrows_of_local);
+ }
return;
}
// locations.
let definitely_conflicting_borrows = other_borrows_of_local
.filter(|&&i| {
- places_conflict::places_conflict(
+ places_conflict(
self.tcx,
self.param_env,
self.body,
&self.borrow_set.borrows[i].borrowed_place,
place,
- places_conflict::PlaceConflictBias::NoOverlap)
+ PlaceConflictBias::NoOverlap)
});
trans.kill_all(definitely_conflicting_borrows);