Use 'mir
lifetime name more.
Some types have a `body: &'mir Body<'tcx>` and some have `body: &'a Body<'tcx>`. The former is more readable, so this commit converts some fo the latter to the former.
This commit is contained in:
parent
a65e68a43b
commit
f450bf49c0
3 changed files with 31 additions and 31 deletions
|
@ -120,24 +120,24 @@ rustc_index::newtype_index! {
|
||||||
/// `BorrowIndex`, and maps each such index to a `BorrowData`
|
/// `BorrowIndex`, and maps each such index to a `BorrowData`
|
||||||
/// describing the borrow. These indexes are used for representing the
|
/// describing the borrow. These indexes are used for representing the
|
||||||
/// borrows in compact bitvectors.
|
/// borrows in compact bitvectors.
|
||||||
pub struct Borrows<'a, 'tcx> {
|
pub struct Borrows<'mir, 'tcx> {
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
body: &'a Body<'tcx>,
|
body: &'mir Body<'tcx>,
|
||||||
|
|
||||||
borrow_set: &'a BorrowSet<'tcx>,
|
borrow_set: &'mir BorrowSet<'tcx>,
|
||||||
borrows_out_of_scope_at_location: FxIndexMap<Location, Vec<BorrowIndex>>,
|
borrows_out_of_scope_at_location: FxIndexMap<Location, Vec<BorrowIndex>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OutOfScopePrecomputer<'a, 'tcx> {
|
struct OutOfScopePrecomputer<'mir, 'tcx> {
|
||||||
visited: BitSet<mir::BasicBlock>,
|
visited: BitSet<mir::BasicBlock>,
|
||||||
visit_stack: Vec<mir::BasicBlock>,
|
visit_stack: Vec<mir::BasicBlock>,
|
||||||
body: &'a Body<'tcx>,
|
body: &'mir Body<'tcx>,
|
||||||
regioncx: &'a RegionInferenceContext<'tcx>,
|
regioncx: &'mir RegionInferenceContext<'tcx>,
|
||||||
borrows_out_of_scope_at_location: FxIndexMap<Location, Vec<BorrowIndex>>,
|
borrows_out_of_scope_at_location: FxIndexMap<Location, Vec<BorrowIndex>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> OutOfScopePrecomputer<'a, 'tcx> {
|
impl<'mir, 'tcx> OutOfScopePrecomputer<'mir, 'tcx> {
|
||||||
fn new(body: &'a Body<'tcx>, regioncx: &'a RegionInferenceContext<'tcx>) -> Self {
|
fn new(body: &'mir Body<'tcx>, regioncx: &'mir RegionInferenceContext<'tcx>) -> Self {
|
||||||
OutOfScopePrecomputer {
|
OutOfScopePrecomputer {
|
||||||
visited: BitSet::new_empty(body.basic_blocks.len()),
|
visited: BitSet::new_empty(body.basic_blocks.len()),
|
||||||
visit_stack: vec![],
|
visit_stack: vec![],
|
||||||
|
@ -240,17 +240,17 @@ pub fn calculate_borrows_out_of_scope_at_location<'tcx>(
|
||||||
prec.borrows_out_of_scope_at_location
|
prec.borrows_out_of_scope_at_location
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PoloniusOutOfScopePrecomputer<'a, 'tcx> {
|
struct PoloniusOutOfScopePrecomputer<'mir, 'tcx> {
|
||||||
visited: BitSet<mir::BasicBlock>,
|
visited: BitSet<mir::BasicBlock>,
|
||||||
visit_stack: Vec<mir::BasicBlock>,
|
visit_stack: Vec<mir::BasicBlock>,
|
||||||
body: &'a Body<'tcx>,
|
body: &'mir Body<'tcx>,
|
||||||
regioncx: &'a RegionInferenceContext<'tcx>,
|
regioncx: &'mir RegionInferenceContext<'tcx>,
|
||||||
|
|
||||||
loans_out_of_scope_at_location: FxIndexMap<Location, Vec<BorrowIndex>>,
|
loans_out_of_scope_at_location: FxIndexMap<Location, Vec<BorrowIndex>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> PoloniusOutOfScopePrecomputer<'a, 'tcx> {
|
impl<'mir, 'tcx> PoloniusOutOfScopePrecomputer<'mir, 'tcx> {
|
||||||
fn new(body: &'a Body<'tcx>, regioncx: &'a RegionInferenceContext<'tcx>) -> Self {
|
fn new(body: &'mir Body<'tcx>, regioncx: &'mir RegionInferenceContext<'tcx>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
visited: BitSet::new_empty(body.basic_blocks.len()),
|
visited: BitSet::new_empty(body.basic_blocks.len()),
|
||||||
visit_stack: vec![],
|
visit_stack: vec![],
|
||||||
|
@ -403,12 +403,12 @@ impl<'tcx> PoloniusOutOfScopePrecomputer<'_, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> Borrows<'a, 'tcx> {
|
impl<'mir, 'tcx> Borrows<'mir, 'tcx> {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
body: &'a Body<'tcx>,
|
body: &'mir Body<'tcx>,
|
||||||
regioncx: &'a RegionInferenceContext<'tcx>,
|
regioncx: &'mir RegionInferenceContext<'tcx>,
|
||||||
borrow_set: &'a BorrowSet<'tcx>,
|
borrow_set: &'mir BorrowSet<'tcx>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let mut borrows_out_of_scope_at_location =
|
let mut borrows_out_of_scope_at_location =
|
||||||
calculate_borrows_out_of_scope_at_location(body, regioncx, borrow_set);
|
calculate_borrows_out_of_scope_at_location(body, regioncx, borrow_set);
|
||||||
|
|
|
@ -287,12 +287,12 @@ impl Direction for Backward {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct BackwardSwitchIntEdgeEffectsApplier<'a, 'tcx, D, F> {
|
struct BackwardSwitchIntEdgeEffectsApplier<'mir, 'tcx, D, F> {
|
||||||
body: &'a mir::Body<'tcx>,
|
body: &'mir mir::Body<'tcx>,
|
||||||
pred: BasicBlock,
|
pred: BasicBlock,
|
||||||
exit_state: &'a mut D,
|
exit_state: &'mir mut D,
|
||||||
bb: BasicBlock,
|
bb: BasicBlock,
|
||||||
propagate: &'a mut F,
|
propagate: &'mir mut F,
|
||||||
effects_applied: bool,
|
effects_applied: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,9 +523,9 @@ impl Direction for Forward {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ForwardSwitchIntEdgeEffectsApplier<'a, D, F> {
|
struct ForwardSwitchIntEdgeEffectsApplier<'mir, D, F> {
|
||||||
exit_state: &'a mut D,
|
exit_state: &'mir mut D,
|
||||||
targets: &'a SwitchTargets,
|
targets: &'mir SwitchTargets,
|
||||||
propagate: F,
|
propagate: F,
|
||||||
|
|
||||||
effects_applied: bool,
|
effects_applied: bool,
|
||||||
|
|
|
@ -128,12 +128,12 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A solver for dataflow problems.
|
/// A solver for dataflow problems.
|
||||||
pub struct Engine<'a, 'tcx, A>
|
pub struct Engine<'mir, 'tcx, A>
|
||||||
where
|
where
|
||||||
A: Analysis<'tcx>,
|
A: Analysis<'tcx>,
|
||||||
{
|
{
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
body: &'a mir::Body<'tcx>,
|
body: &'mir mir::Body<'tcx>,
|
||||||
entry_sets: IndexVec<BasicBlock, A::Domain>,
|
entry_sets: IndexVec<BasicBlock, A::Domain>,
|
||||||
pass_name: Option<&'static str>,
|
pass_name: Option<&'static str>,
|
||||||
analysis: A,
|
analysis: A,
|
||||||
|
@ -147,14 +147,14 @@ where
|
||||||
apply_statement_trans_for_block: Option<Box<dyn Fn(BasicBlock, &mut A::Domain)>>,
|
apply_statement_trans_for_block: Option<Box<dyn Fn(BasicBlock, &mut A::Domain)>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx, A, D, T> Engine<'a, 'tcx, A>
|
impl<'mir, 'tcx, A, D, T> Engine<'mir, 'tcx, A>
|
||||||
where
|
where
|
||||||
A: GenKillAnalysis<'tcx, Idx = T, Domain = D>,
|
A: GenKillAnalysis<'tcx, Idx = T, Domain = D>,
|
||||||
D: Clone + JoinSemiLattice + GenKill<T> + BitSetExt<T>,
|
D: Clone + JoinSemiLattice + GenKill<T> + BitSetExt<T>,
|
||||||
T: Idx,
|
T: Idx,
|
||||||
{
|
{
|
||||||
/// Creates a new `Engine` to solve a gen-kill dataflow problem.
|
/// Creates a new `Engine` to solve a gen-kill dataflow problem.
|
||||||
pub fn new_gen_kill(tcx: TyCtxt<'tcx>, body: &'a mir::Body<'tcx>, mut analysis: A) -> Self {
|
pub fn new_gen_kill(tcx: TyCtxt<'tcx>, body: &'mir mir::Body<'tcx>, mut analysis: A) -> Self {
|
||||||
// If there are no back-edges in the control-flow graph, we only ever need to apply the
|
// If there are no back-edges in the control-flow graph, we only ever need to apply the
|
||||||
// transfer function for each block exactly once (assuming that we process blocks in RPO).
|
// transfer function for each block exactly once (assuming that we process blocks in RPO).
|
||||||
//
|
//
|
||||||
|
@ -186,7 +186,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx, A, D> Engine<'a, 'tcx, A>
|
impl<'mir, 'tcx, A, D> Engine<'mir, 'tcx, A>
|
||||||
where
|
where
|
||||||
A: Analysis<'tcx, Domain = D>,
|
A: Analysis<'tcx, Domain = D>,
|
||||||
D: Clone + JoinSemiLattice,
|
D: Clone + JoinSemiLattice,
|
||||||
|
@ -196,13 +196,13 @@ where
|
||||||
///
|
///
|
||||||
/// Gen-kill problems should use `new_gen_kill`, which will coalesce transfer functions for
|
/// Gen-kill problems should use `new_gen_kill`, which will coalesce transfer functions for
|
||||||
/// better performance.
|
/// better performance.
|
||||||
pub fn new_generic(tcx: TyCtxt<'tcx>, body: &'a mir::Body<'tcx>, analysis: A) -> Self {
|
pub fn new_generic(tcx: TyCtxt<'tcx>, body: &'mir mir::Body<'tcx>, analysis: A) -> Self {
|
||||||
Self::new(tcx, body, analysis, None)
|
Self::new(tcx, body, analysis, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new(
|
fn new(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
body: &'a mir::Body<'tcx>,
|
body: &'mir mir::Body<'tcx>,
|
||||||
analysis: A,
|
analysis: A,
|
||||||
apply_statement_trans_for_block: Option<Box<dyn Fn(BasicBlock, &mut A::Domain)>>,
|
apply_statement_trans_for_block: Option<Box<dyn Fn(BasicBlock, &mut A::Domain)>>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue