Skip to content

Commit 9e70c47

Browse files
spastorinooli-obk
authored andcommitted
Remove unused param_env parameter
1 parent fb2f0ec commit 9e70c47

File tree

7 files changed

+7
-49
lines changed

7 files changed

+7
-49
lines changed

src/librustc_mir/borrow_check/constraint_generation.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use crate::borrow_check::{
1616

1717
pub(super) fn generate_constraints<'cx, 'tcx>(
1818
infcx: &InferCtxt<'cx, 'tcx>,
19-
param_env: ty::ParamEnv<'tcx>,
2019
liveness_constraints: &mut LivenessValues<RegionVid>,
2120
all_facts: &mut Option<AllFacts>,
2221
location_table: &LocationTable,
@@ -30,7 +29,6 @@ pub(super) fn generate_constraints<'cx, 'tcx>(
3029
location_table,
3130
all_facts,
3231
body,
33-
param_env,
3432
};
3533

3634
for (bb, data) in body.basic_blocks().iter_enumerated() {
@@ -41,7 +39,6 @@ pub(super) fn generate_constraints<'cx, 'tcx>(
4139
/// 'cg = the duration of the constraint generation process itself.
4240
struct ConstraintGeneration<'cg, 'cx, 'tcx> {
4341
infcx: &'cg InferCtxt<'cx, 'tcx>,
44-
param_env: ty::ParamEnv<'tcx>,
4542
all_facts: &'cg mut Option<AllFacts>,
4643
location_table: &'cg LocationTable,
4744
liveness_constraints: &'cg mut LivenessValues<RegionVid>,
@@ -226,7 +223,6 @@ impl<'cx, 'cg, 'tcx> ConstraintGeneration<'cx, 'cg, 'tcx> {
226223
for &borrow_index in borrow_indices {
227224
let places_conflict = places_conflict::places_conflict(
228225
self.infcx.tcx,
229-
self.param_env,
230226
self.body,
231227
&self.borrow_set.borrows[borrow_index].borrowed_place,
232228
place,

src/librustc_mir/borrow_check/invalidation.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rustc::mir::TerminatorKind;
33
use rustc::mir::{BasicBlock, Body, Location, Place, ReadOnlyBodyAndCache, Rvalue};
44
use rustc::mir::{BorrowKind, Mutability, Operand};
55
use rustc::mir::{Statement, StatementKind};
6-
use rustc::ty::{self, TyCtxt};
6+
use rustc::ty::TyCtxt;
77
use rustc_data_structures::graph::dominators::Dominators;
88

99
use crate::dataflow::indexes::BorrowIndex;
@@ -16,7 +16,6 @@ use crate::borrow_check::{
1616

1717
pub(super) fn generate_invalidates<'tcx>(
1818
tcx: TyCtxt<'tcx>,
19-
param_env: ty::ParamEnv<'tcx>,
2019
all_facts: &mut Option<AllFacts>,
2120
location_table: &LocationTable,
2221
body: ReadOnlyBodyAndCache<'_, 'tcx>,
@@ -33,7 +32,6 @@ pub(super) fn generate_invalidates<'tcx>(
3332
let mut ig = InvalidationGenerator {
3433
all_facts,
3534
borrow_set,
36-
param_env,
3735
tcx,
3836
location_table,
3937
body: &body,
@@ -45,7 +43,6 @@ pub(super) fn generate_invalidates<'tcx>(
4543

4644
struct InvalidationGenerator<'cx, 'tcx> {
4745
tcx: TyCtxt<'tcx>,
48-
param_env: ty::ParamEnv<'tcx>,
4946
all_facts: &'cx mut AllFacts,
5047
location_table: &'cx LocationTable,
5148
body: &'cx Body<'tcx>,
@@ -337,13 +334,11 @@ impl<'cx, 'tcx> InvalidationGenerator<'cx, 'tcx> {
337334
);
338335
let tcx = self.tcx;
339336
let body = self.body;
340-
let param_env = self.param_env;
341337
let borrow_set = self.borrow_set.clone();
342338
let indices = self.borrow_set.borrows.indices();
343339
each_borrow_involving_path(
344340
self,
345341
tcx,
346-
param_env,
347342
body,
348343
location,
349344
(sd, place),

src/librustc_mir/borrow_check/mod.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ fn do_mir_borrowck<'a, 'tcx>(
239239
def_id,
240240
&attributes,
241241
&dead_unwinds,
242-
Borrows::new(tcx, &body, param_env, regioncx.clone(), &borrow_set),
242+
Borrows::new(tcx, &body, regioncx.clone(), &borrow_set),
243243
|rs, i| DebugFormatted::new(&rs.location(i)),
244244
));
245245
let flow_uninits = FlowAtLocation::new(do_dataflow(
@@ -275,7 +275,6 @@ fn do_mir_borrowck<'a, 'tcx>(
275275
infcx,
276276
body,
277277
mir_def_id: def_id,
278-
param_env,
279278
move_data: &mdpe.move_data,
280279
location_table,
281280
movable_generator,
@@ -418,7 +417,6 @@ crate struct MirBorrowckCtxt<'cx, 'tcx> {
418417
crate infcx: &'cx InferCtxt<'cx, 'tcx>,
419418
body: ReadOnlyBodyAndCache<'cx, 'tcx>,
420419
mir_def_id: DefId,
421-
param_env: ty::ParamEnv<'tcx>,
422420
move_data: &'cx MoveData<'tcx>,
423421

424422
/// Map from MIR `Location` to `LocationIndex`; created
@@ -926,13 +924,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
926924
let tcx = self.infcx.tcx;
927925
let body = self.body;
928926
let body: &Body<'_> = &body;
929-
let param_env = self.param_env;
930927
let location_table = self.location_table.start_index(location);
931928
let borrow_set = self.borrow_set.clone();
932929
each_borrow_involving_path(
933930
self,
934931
tcx,
935-
param_env,
936932
body,
937933
location,
938934
(sd, place_span.0),
@@ -1412,7 +1408,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
14121408

14131409
if places_conflict::borrow_conflicts_with_place(
14141410
self.infcx.tcx,
1415-
self.param_env,
14161411
&self.body,
14171412
place,
14181413
borrow.kind,

src/librustc_mir/borrow_check/nll.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ pub(in crate::borrow_check) fn compute_regions<'cx, 'tcx>(
231231

232232
constraint_generation::generate_constraints(
233233
infcx,
234-
param_env,
235234
&mut liveness_constraints,
236235
&mut all_facts,
237236
location_table,
@@ -253,14 +252,7 @@ pub(in crate::borrow_check) fn compute_regions<'cx, 'tcx>(
253252
);
254253

255254
// Generate various additional constraints.
256-
invalidation::generate_invalidates(
257-
infcx.tcx,
258-
param_env,
259-
&mut all_facts,
260-
location_table,
261-
body,
262-
borrow_set,
263-
);
255+
invalidation::generate_invalidates(infcx.tcx, &mut all_facts, location_table, body, borrow_set);
264256

265257
// Dump facts if requested.
266258
let polonius_output = all_facts.and_then(|all_facts| {

src/librustc_mir/borrow_check/path_utils.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::borrow_check::AccessDepth;
44
use crate::dataflow::indexes::BorrowIndex;
55
use rustc::mir::BorrowKind;
66
use rustc::mir::{BasicBlock, Body, Location, Place, PlaceBase};
7-
use rustc::ty::{self, TyCtxt};
7+
use rustc::ty::TyCtxt;
88
use rustc_data_structures::graph::dominators::Dominators;
99

1010
/// Returns `true` if the borrow represented by `kind` is
@@ -25,7 +25,6 @@ pub(super) enum Control {
2525
pub(super) fn each_borrow_involving_path<'tcx, F, I, S>(
2626
s: &mut S,
2727
tcx: TyCtxt<'tcx>,
28-
param_env: ty::ParamEnv<'tcx>,
2928
body: &Body<'tcx>,
3029
_location: Location,
3130
access_place: (AccessDepth, &Place<'tcx>),
@@ -48,7 +47,6 @@ pub(super) fn each_borrow_involving_path<'tcx, F, I, S>(
4847

4948
if places_conflict::borrow_conflicts_with_place(
5049
tcx,
51-
param_env,
5250
body,
5351
&borrowed.borrowed_place,
5452
borrowed.kind,

src/librustc_mir/borrow_check/places_conflict.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ crate enum PlaceConflictBias {
2323
/// dataflow).
2424
crate fn places_conflict<'tcx>(
2525
tcx: TyCtxt<'tcx>,
26-
param_env: ty::ParamEnv<'tcx>,
2726
body: &Body<'tcx>,
2827
borrow_place: &Place<'tcx>,
2928
access_place: &Place<'tcx>,
3029
bias: PlaceConflictBias,
3130
) -> bool {
3231
borrow_conflicts_with_place(
3332
tcx,
34-
param_env,
3533
body,
3634
borrow_place,
3735
BorrowKind::Mut { allow_two_phase_borrow: true },
@@ -47,7 +45,6 @@ crate fn places_conflict<'tcx>(
4745
/// order to make the conservative choice and preserve soundness.
4846
pub(super) fn borrow_conflicts_with_place<'tcx>(
4947
tcx: TyCtxt<'tcx>,
50-
param_env: ty::ParamEnv<'tcx>,
5148
body: &Body<'tcx>,
5249
borrow_place: &Place<'tcx>,
5350
borrow_kind: BorrowKind,
@@ -68,21 +65,11 @@ pub(super) fn borrow_conflicts_with_place<'tcx>(
6865
}
6966
}
7067

71-
place_components_conflict(
72-
tcx,
73-
param_env,
74-
body,
75-
borrow_place,
76-
borrow_kind,
77-
access_place,
78-
access,
79-
bias,
80-
)
68+
place_components_conflict(tcx, body, borrow_place, borrow_kind, access_place, access, bias)
8169
}
8270

8371
fn place_components_conflict<'tcx>(
8472
tcx: TyCtxt<'tcx>,
85-
param_env: ty::ParamEnv<'tcx>,
8673
body: &Body<'tcx>,
8774
borrow_place: &Place<'tcx>,
8875
borrow_kind: BorrowKind,
@@ -135,7 +122,7 @@ fn place_components_conflict<'tcx>(
135122
let borrow_base = &borrow_place.base;
136123
let access_base = access_place.base;
137124

138-
match place_base_conflict(tcx, param_env, borrow_base, access_base) {
125+
match place_base_conflict(tcx, borrow_base, access_base) {
139126
Overlap::Arbitrary => {
140127
bug!("Two base can't return Arbitrary");
141128
}
@@ -308,7 +295,6 @@ fn place_components_conflict<'tcx>(
308295
// between `elem1` and `elem2`.
309296
fn place_base_conflict<'tcx>(
310297
tcx: TyCtxt<'tcx>,
311-
_param_env: ty::ParamEnv<'tcx>,
312298
elem1: &PlaceBase<'tcx>,
313299
elem2: &PlaceBase<'tcx>,
314300
) -> Overlap {

src/librustc_mir/dataflow/impls/borrows.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc::mir::{self, Body, Location, Place, PlaceBase};
22
use rustc::ty::RegionVid;
3-
use rustc::ty::{self, TyCtxt};
3+
use rustc::ty::TyCtxt;
44

55
use rustc_data_structures::fx::FxHashMap;
66
use rustc_index::bit_set::BitSet;
@@ -30,7 +30,6 @@ rustc_index::newtype_index! {
3030
pub struct Borrows<'a, 'tcx> {
3131
tcx: TyCtxt<'tcx>,
3232
body: &'a Body<'tcx>,
33-
param_env: ty::ParamEnv<'tcx>,
3433

3534
borrow_set: Rc<BorrowSet<'tcx>>,
3635
borrows_out_of_scope_at_location: FxHashMap<Location, Vec<BorrowIndex>>,
@@ -134,7 +133,6 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> {
134133
crate fn new(
135134
tcx: TyCtxt<'tcx>,
136135
body: &'a Body<'tcx>,
137-
param_env: ty::ParamEnv<'tcx>,
138136
nonlexical_regioncx: Rc<RegionInferenceContext<'tcx>>,
139137
borrow_set: &Rc<BorrowSet<'tcx>>,
140138
) -> Self {
@@ -156,7 +154,6 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> {
156154
Borrows {
157155
tcx,
158156
body,
159-
param_env,
160157
borrow_set: borrow_set.clone(),
161158
borrows_out_of_scope_at_location,
162159
_nonlexical_regioncx: nonlexical_regioncx,
@@ -219,7 +216,6 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> {
219216
let definitely_conflicting_borrows = other_borrows_of_local.filter(|&&i| {
220217
places_conflict(
221218
self.tcx,
222-
self.param_env,
223219
self.body,
224220
&self.borrow_set.borrows[i].borrowed_place,
225221
place,

0 commit comments

Comments
 (0)