From: Santiago Pastorino Date: Wed, 11 Dec 2019 05:07:04 +0000 (-0300) Subject: Remove unused param_env parameter X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=9e70c4778371130ecc9ac5f1aff24000411eabd8;p=rust.git Remove unused param_env parameter --- diff --git a/src/librustc_mir/borrow_check/constraint_generation.rs b/src/librustc_mir/borrow_check/constraint_generation.rs index 97de201faba..67cd9c40db6 100644 --- a/src/librustc_mir/borrow_check/constraint_generation.rs +++ b/src/librustc_mir/borrow_check/constraint_generation.rs @@ -16,7 +16,6 @@ pub(super) fn generate_constraints<'cx, 'tcx>( infcx: &InferCtxt<'cx, 'tcx>, - param_env: ty::ParamEnv<'tcx>, liveness_constraints: &mut LivenessValues, all_facts: &mut Option, location_table: &LocationTable, @@ -30,7 +29,6 @@ pub(super) fn generate_constraints<'cx, 'tcx>( location_table, all_facts, body, - param_env, }; for (bb, data) in body.basic_blocks().iter_enumerated() { @@ -41,7 +39,6 @@ pub(super) fn generate_constraints<'cx, 'tcx>( /// '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, location_table: &'cg LocationTable, liveness_constraints: &'cg mut LivenessValues, @@ -226,7 +223,6 @@ fn record_killed_borrows_for_place(&mut self, place: &Place<'tcx>, location: Loc 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, diff --git a/src/librustc_mir/borrow_check/invalidation.rs b/src/librustc_mir/borrow_check/invalidation.rs index f9ffa2138ba..bb56c11872a 100644 --- a/src/librustc_mir/borrow_check/invalidation.rs +++ b/src/librustc_mir/borrow_check/invalidation.rs @@ -3,7 +3,7 @@ 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; @@ -16,7 +16,6 @@ pub(super) fn generate_invalidates<'tcx>( tcx: TyCtxt<'tcx>, - param_env: ty::ParamEnv<'tcx>, all_facts: &mut Option, location_table: &LocationTable, body: ReadOnlyBodyAndCache<'_, 'tcx>, @@ -33,7 +32,6 @@ pub(super) fn generate_invalidates<'tcx>( let mut ig = InvalidationGenerator { all_facts, borrow_set, - param_env, tcx, location_table, body: &body, @@ -45,7 +43,6 @@ pub(super) fn generate_invalidates<'tcx>( 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>, @@ -337,13 +334,11 @@ fn check_access_for_conflict( ); 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), diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 6c9b811ebd0..5174f17ab88 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -239,7 +239,7 @@ fn do_mir_borrowck<'a, 'tcx>( 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( @@ -275,7 +275,6 @@ fn do_mir_borrowck<'a, 'tcx>( infcx, body, mir_def_id: def_id, - param_env, move_data: &mdpe.move_data, location_table, movable_generator, @@ -418,7 +417,6 @@ fn do_mir_borrowck<'a, 'tcx>( 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 @@ -926,13 +924,11 @@ fn check_access_for_conflict( 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), @@ -1412,7 +1408,6 @@ fn check_for_invalidation_at_exit( if places_conflict::borrow_conflicts_with_place( self.infcx.tcx, - self.param_env, &self.body, place, borrow.kind, diff --git a/src/librustc_mir/borrow_check/nll.rs b/src/librustc_mir/borrow_check/nll.rs index a4c2299b3ea..151a2c4c19a 100644 --- a/src/librustc_mir/borrow_check/nll.rs +++ b/src/librustc_mir/borrow_check/nll.rs @@ -231,7 +231,6 @@ pub(in crate::borrow_check) fn compute_regions<'cx, 'tcx>( constraint_generation::generate_constraints( infcx, - param_env, &mut liveness_constraints, &mut all_facts, location_table, @@ -253,14 +252,7 @@ pub(in crate::borrow_check) fn compute_regions<'cx, 'tcx>( ); // 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| { diff --git a/src/librustc_mir/borrow_check/path_utils.rs b/src/librustc_mir/borrow_check/path_utils.rs index 23b4799643a..6fb0bbceb1b 100644 --- a/src/librustc_mir/borrow_check/path_utils.rs +++ b/src/librustc_mir/borrow_check/path_utils.rs @@ -4,7 +4,7 @@ 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 @@ -25,7 +25,6 @@ pub(super) enum Control { 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>), @@ -48,7 +47,6 @@ pub(super) fn each_borrow_involving_path<'tcx, F, I, S>( if places_conflict::borrow_conflicts_with_place( tcx, - param_env, body, &borrowed.borrowed_place, borrowed.kind, diff --git a/src/librustc_mir/borrow_check/places_conflict.rs b/src/librustc_mir/borrow_check/places_conflict.rs index 815ace55a37..3988221e063 100644 --- a/src/librustc_mir/borrow_check/places_conflict.rs +++ b/src/librustc_mir/borrow_check/places_conflict.rs @@ -23,7 +23,6 @@ /// 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>, @@ -31,7 +30,6 @@ ) -> bool { borrow_conflicts_with_place( tcx, - param_env, body, borrow_place, BorrowKind::Mut { allow_two_phase_borrow: true }, @@ -47,7 +45,6 @@ /// 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, @@ -68,21 +65,11 @@ pub(super) fn borrow_conflicts_with_place<'tcx>( } } - 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, @@ -135,7 +122,7 @@ fn place_components_conflict<'tcx>( 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"); } @@ -308,7 +295,6 @@ fn place_components_conflict<'tcx>( // between `elem1` and `elem2`. fn place_base_conflict<'tcx>( tcx: TyCtxt<'tcx>, - _param_env: ty::ParamEnv<'tcx>, elem1: &PlaceBase<'tcx>, elem2: &PlaceBase<'tcx>, ) -> Overlap { diff --git a/src/librustc_mir/dataflow/impls/borrows.rs b/src/librustc_mir/dataflow/impls/borrows.rs index 8d51cb23912..583075980ec 100644 --- a/src/librustc_mir/dataflow/impls/borrows.rs +++ b/src/librustc_mir/dataflow/impls/borrows.rs @@ -1,6 +1,6 @@ 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; @@ -30,7 +30,6 @@ pub struct BorrowIndex { pub struct Borrows<'a, 'tcx> { tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, - param_env: ty::ParamEnv<'tcx>, borrow_set: Rc>, borrows_out_of_scope_at_location: FxHashMap>, @@ -134,7 +133,6 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> { crate fn new( tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, - param_env: ty::ParamEnv<'tcx>, nonlexical_regioncx: Rc>, borrow_set: &Rc>, ) -> Self { @@ -156,7 +154,6 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> { Borrows { tcx, body, - param_env, borrow_set: borrow_set.clone(), borrows_out_of_scope_at_location, _nonlexical_regioncx: nonlexical_regioncx, @@ -219,7 +216,6 @@ fn kill_borrows_on_place(&self, trans: &mut GenKillSet, place: &Pla 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,