pub(super) fn generate_constraints<'cx, 'tcx>(
infcx: &InferCtxt<'cx, 'tcx>,
- param_env: ty::ParamEnv<'tcx>,
liveness_constraints: &mut LivenessValues<RegionVid>,
all_facts: &mut Option<AllFacts>,
location_table: &LocationTable,
location_table,
all_facts,
body,
- param_env,
};
for (bb, data) in body.basic_blocks().iter_enumerated() {
/// 'cg = the duration of the constraint generation process itself.
struct ConstraintGeneration<'cg, 'cx, 'tcx> {
infcx: &'cg InferCtxt<'cx, 'tcx>,
- param_env: ty::ParamEnv<'tcx>,
all_facts: &'cg mut Option<AllFacts>,
location_table: &'cg LocationTable,
liveness_constraints: &'cg mut LivenessValues<RegionVid>,
for &borrow_index in borrow_indices {
let places_conflict = places_conflict::places_conflict(
self.infcx.tcx,
- self.param_env,
self.body,
&self.borrow_set.borrows[borrow_index].borrowed_place,
place,
use rustc::mir::{BasicBlock, Body, Location, Place, ReadOnlyBodyAndCache, Rvalue};
use rustc::mir::{BorrowKind, Mutability, Operand};
use rustc::mir::{Statement, StatementKind};
-use rustc::ty::{self, TyCtxt};
+use rustc::ty::TyCtxt;
use rustc_data_structures::graph::dominators::Dominators;
use crate::dataflow::indexes::BorrowIndex;
pub(super) fn generate_invalidates<'tcx>(
tcx: TyCtxt<'tcx>,
- param_env: ty::ParamEnv<'tcx>,
all_facts: &mut Option<AllFacts>,
location_table: &LocationTable,
body: ReadOnlyBodyAndCache<'_, 'tcx>,
let mut ig = InvalidationGenerator {
all_facts,
borrow_set,
- param_env,
tcx,
location_table,
body: &body,
struct InvalidationGenerator<'cx, 'tcx> {
tcx: TyCtxt<'tcx>,
- param_env: ty::ParamEnv<'tcx>,
all_facts: &'cx mut AllFacts,
location_table: &'cx LocationTable,
body: &'cx Body<'tcx>,
);
let tcx = self.tcx;
let body = self.body;
- let param_env = self.param_env;
let borrow_set = self.borrow_set.clone();
let indices = self.borrow_set.borrows.indices();
each_borrow_involving_path(
self,
tcx,
- param_env,
body,
location,
(sd, place),
def_id,
&attributes,
&dead_unwinds,
- Borrows::new(tcx, &body, param_env, regioncx.clone(), &borrow_set),
+ Borrows::new(tcx, &body, regioncx.clone(), &borrow_set),
|rs, i| DebugFormatted::new(&rs.location(i)),
));
let flow_uninits = FlowAtLocation::new(do_dataflow(
infcx,
body,
mir_def_id: def_id,
- param_env,
move_data: &mdpe.move_data,
location_table,
movable_generator,
crate infcx: &'cx InferCtxt<'cx, 'tcx>,
body: ReadOnlyBodyAndCache<'cx, 'tcx>,
mir_def_id: DefId,
- param_env: ty::ParamEnv<'tcx>,
move_data: &'cx MoveData<'tcx>,
/// Map from MIR `Location` to `LocationIndex`; created
let tcx = self.infcx.tcx;
let body = self.body;
let body: &Body<'_> = &body;
- let param_env = self.param_env;
let location_table = self.location_table.start_index(location);
let borrow_set = self.borrow_set.clone();
each_borrow_involving_path(
self,
tcx,
- param_env,
body,
location,
(sd, place_span.0),
if places_conflict::borrow_conflicts_with_place(
self.infcx.tcx,
- self.param_env,
&self.body,
place,
borrow.kind,
constraint_generation::generate_constraints(
infcx,
- param_env,
&mut liveness_constraints,
&mut all_facts,
location_table,
);
// Generate various additional constraints.
- invalidation::generate_invalidates(
- infcx.tcx,
- param_env,
- &mut all_facts,
- location_table,
- body,
- borrow_set,
- );
+ invalidation::generate_invalidates(infcx.tcx, &mut all_facts, location_table, body, borrow_set);
// Dump facts if requested.
let polonius_output = all_facts.and_then(|all_facts| {
use crate::dataflow::indexes::BorrowIndex;
use rustc::mir::BorrowKind;
use rustc::mir::{BasicBlock, Body, Location, Place, PlaceBase};
-use rustc::ty::{self, TyCtxt};
+use rustc::ty::TyCtxt;
use rustc_data_structures::graph::dominators::Dominators;
/// Returns `true` if the borrow represented by `kind` is
pub(super) fn each_borrow_involving_path<'tcx, F, I, S>(
s: &mut S,
tcx: TyCtxt<'tcx>,
- param_env: ty::ParamEnv<'tcx>,
body: &Body<'tcx>,
_location: Location,
access_place: (AccessDepth, &Place<'tcx>),
if places_conflict::borrow_conflicts_with_place(
tcx,
- param_env,
body,
&borrowed.borrowed_place,
borrowed.kind,
/// dataflow).
crate fn places_conflict<'tcx>(
tcx: TyCtxt<'tcx>,
- param_env: ty::ParamEnv<'tcx>,
body: &Body<'tcx>,
borrow_place: &Place<'tcx>,
access_place: &Place<'tcx>,
) -> bool {
borrow_conflicts_with_place(
tcx,
- param_env,
body,
borrow_place,
BorrowKind::Mut { allow_two_phase_borrow: true },
/// order to make the conservative choice and preserve soundness.
pub(super) fn borrow_conflicts_with_place<'tcx>(
tcx: TyCtxt<'tcx>,
- param_env: ty::ParamEnv<'tcx>,
body: &Body<'tcx>,
borrow_place: &Place<'tcx>,
borrow_kind: BorrowKind,
}
}
- place_components_conflict(
- tcx,
- param_env,
- body,
- borrow_place,
- borrow_kind,
- access_place,
- access,
- bias,
- )
+ place_components_conflict(tcx, body, borrow_place, borrow_kind, access_place, access, bias)
}
fn place_components_conflict<'tcx>(
tcx: TyCtxt<'tcx>,
- param_env: ty::ParamEnv<'tcx>,
body: &Body<'tcx>,
borrow_place: &Place<'tcx>,
borrow_kind: BorrowKind,
let borrow_base = &borrow_place.base;
let access_base = access_place.base;
- match place_base_conflict(tcx, param_env, borrow_base, access_base) {
+ match place_base_conflict(tcx, borrow_base, access_base) {
Overlap::Arbitrary => {
bug!("Two base can't return Arbitrary");
}
// between `elem1` and `elem2`.
fn place_base_conflict<'tcx>(
tcx: TyCtxt<'tcx>,
- _param_env: ty::ParamEnv<'tcx>,
elem1: &PlaceBase<'tcx>,
elem2: &PlaceBase<'tcx>,
) -> Overlap {
use rustc::mir::{self, Body, Location, Place, PlaceBase};
use rustc::ty::RegionVid;
-use rustc::ty::{self, TyCtxt};
+use rustc::ty::TyCtxt;
use rustc_data_structures::fx::FxHashMap;
use rustc_index::bit_set::BitSet;
pub struct Borrows<'a, 'tcx> {
tcx: TyCtxt<'tcx>,
body: &'a Body<'tcx>,
- param_env: ty::ParamEnv<'tcx>,
borrow_set: Rc<BorrowSet<'tcx>>,
borrows_out_of_scope_at_location: FxHashMap<Location, Vec<BorrowIndex>>,
crate fn new(
tcx: TyCtxt<'tcx>,
body: &'a Body<'tcx>,
- param_env: ty::ParamEnv<'tcx>,
nonlexical_regioncx: Rc<RegionInferenceContext<'tcx>>,
borrow_set: &Rc<BorrowSet<'tcx>>,
) -> Self {
Borrows {
tcx,
body,
- param_env,
borrow_set: borrow_set.clone(),
borrows_out_of_scope_at_location,
_nonlexical_regioncx: nonlexical_regioncx,
let definitely_conflicting_borrows = other_borrows_of_local.filter(|&&i| {
places_conflict(
self.tcx,
- self.param_env,
self.body,
&self.borrow_set.borrows[i].borrowed_place,
place,