mirror of https://github.com/rust-lang/rust.git
Remove `in_band_lifetimes` from `rustc_mir_dataflow`
See #91867 for more information.
This commit is contained in:
parent
1d01550f7e
commit
fed881aafc
|
@ -18,7 +18,7 @@ pub trait Direction {
|
||||||
/// Applies all effects between the given `EffectIndex`s.
|
/// Applies all effects between the given `EffectIndex`s.
|
||||||
///
|
///
|
||||||
/// `effects.start()` must precede or equal `effects.end()` in this direction.
|
/// `effects.start()` must precede or equal `effects.end()` in this direction.
|
||||||
fn apply_effects_in_range<A>(
|
fn apply_effects_in_range<'tcx, A>(
|
||||||
analysis: &A,
|
analysis: &A,
|
||||||
state: &mut A::Domain,
|
state: &mut A::Domain,
|
||||||
block: BasicBlock,
|
block: BasicBlock,
|
||||||
|
@ -27,7 +27,7 @@ pub trait Direction {
|
||||||
) where
|
) where
|
||||||
A: Analysis<'tcx>;
|
A: Analysis<'tcx>;
|
||||||
|
|
||||||
fn apply_effects_in_block<A>(
|
fn apply_effects_in_block<'tcx, A>(
|
||||||
analysis: &A,
|
analysis: &A,
|
||||||
state: &mut A::Domain,
|
state: &mut A::Domain,
|
||||||
block: BasicBlock,
|
block: BasicBlock,
|
||||||
|
@ -35,7 +35,7 @@ pub trait Direction {
|
||||||
) where
|
) where
|
||||||
A: Analysis<'tcx>;
|
A: Analysis<'tcx>;
|
||||||
|
|
||||||
fn gen_kill_effects_in_block<A>(
|
fn gen_kill_effects_in_block<'tcx, A>(
|
||||||
analysis: &A,
|
analysis: &A,
|
||||||
trans: &mut GenKillSet<A::Idx>,
|
trans: &mut GenKillSet<A::Idx>,
|
||||||
block: BasicBlock,
|
block: BasicBlock,
|
||||||
|
@ -43,7 +43,7 @@ pub trait Direction {
|
||||||
) where
|
) where
|
||||||
A: GenKillAnalysis<'tcx>;
|
A: GenKillAnalysis<'tcx>;
|
||||||
|
|
||||||
fn visit_results_in_block<F, R>(
|
fn visit_results_in_block<'mir, 'tcx, F, R>(
|
||||||
state: &mut F,
|
state: &mut F,
|
||||||
block: BasicBlock,
|
block: BasicBlock,
|
||||||
block_data: &'mir mir::BasicBlockData<'tcx>,
|
block_data: &'mir mir::BasicBlockData<'tcx>,
|
||||||
|
@ -52,7 +52,7 @@ pub trait Direction {
|
||||||
) where
|
) where
|
||||||
R: ResultsVisitable<'tcx, FlowState = F>;
|
R: ResultsVisitable<'tcx, FlowState = F>;
|
||||||
|
|
||||||
fn join_state_into_successors_of<A>(
|
fn join_state_into_successors_of<'tcx, A>(
|
||||||
analysis: &A,
|
analysis: &A,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
body: &mir::Body<'tcx>,
|
body: &mir::Body<'tcx>,
|
||||||
|
@ -72,7 +72,7 @@ impl Direction for Backward {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn apply_effects_in_block<A>(
|
fn apply_effects_in_block<'tcx, A>(
|
||||||
analysis: &A,
|
analysis: &A,
|
||||||
state: &mut A::Domain,
|
state: &mut A::Domain,
|
||||||
block: BasicBlock,
|
block: BasicBlock,
|
||||||
|
@ -92,7 +92,7 @@ impl Direction for Backward {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gen_kill_effects_in_block<A>(
|
fn gen_kill_effects_in_block<'tcx, A>(
|
||||||
analysis: &A,
|
analysis: &A,
|
||||||
trans: &mut GenKillSet<A::Idx>,
|
trans: &mut GenKillSet<A::Idx>,
|
||||||
block: BasicBlock,
|
block: BasicBlock,
|
||||||
|
@ -112,7 +112,7 @@ impl Direction for Backward {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn apply_effects_in_range<A>(
|
fn apply_effects_in_range<'tcx, A>(
|
||||||
analysis: &A,
|
analysis: &A,
|
||||||
state: &mut A::Domain,
|
state: &mut A::Domain,
|
||||||
block: BasicBlock,
|
block: BasicBlock,
|
||||||
|
@ -189,7 +189,7 @@ impl Direction for Backward {
|
||||||
analysis.apply_statement_effect(state, statement, location);
|
analysis.apply_statement_effect(state, statement, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_results_in_block<F, R>(
|
fn visit_results_in_block<'mir, 'tcx, F, R>(
|
||||||
state: &mut F,
|
state: &mut F,
|
||||||
block: BasicBlock,
|
block: BasicBlock,
|
||||||
block_data: &'mir mir::BasicBlockData<'tcx>,
|
block_data: &'mir mir::BasicBlockData<'tcx>,
|
||||||
|
@ -221,7 +221,7 @@ impl Direction for Backward {
|
||||||
vis.visit_block_start(state, block_data, block);
|
vis.visit_block_start(state, block_data, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn join_state_into_successors_of<A>(
|
fn join_state_into_successors_of<'tcx, A>(
|
||||||
analysis: &A,
|
analysis: &A,
|
||||||
_tcx: TyCtxt<'tcx>,
|
_tcx: TyCtxt<'tcx>,
|
||||||
body: &mir::Body<'tcx>,
|
body: &mir::Body<'tcx>,
|
||||||
|
@ -294,7 +294,7 @@ impl Direction for Forward {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn apply_effects_in_block<A>(
|
fn apply_effects_in_block<'tcx, A>(
|
||||||
analysis: &A,
|
analysis: &A,
|
||||||
state: &mut A::Domain,
|
state: &mut A::Domain,
|
||||||
block: BasicBlock,
|
block: BasicBlock,
|
||||||
|
@ -314,7 +314,7 @@ impl Direction for Forward {
|
||||||
analysis.apply_terminator_effect(state, terminator, location);
|
analysis.apply_terminator_effect(state, terminator, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gen_kill_effects_in_block<A>(
|
fn gen_kill_effects_in_block<'tcx, A>(
|
||||||
analysis: &A,
|
analysis: &A,
|
||||||
trans: &mut GenKillSet<A::Idx>,
|
trans: &mut GenKillSet<A::Idx>,
|
||||||
block: BasicBlock,
|
block: BasicBlock,
|
||||||
|
@ -334,7 +334,7 @@ impl Direction for Forward {
|
||||||
analysis.terminator_effect(trans, terminator, location);
|
analysis.terminator_effect(trans, terminator, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn apply_effects_in_range<A>(
|
fn apply_effects_in_range<'tcx, A>(
|
||||||
analysis: &A,
|
analysis: &A,
|
||||||
state: &mut A::Domain,
|
state: &mut A::Domain,
|
||||||
block: BasicBlock,
|
block: BasicBlock,
|
||||||
|
@ -407,7 +407,7 @@ impl Direction for Forward {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_results_in_block<F, R>(
|
fn visit_results_in_block<'mir, 'tcx, F, R>(
|
||||||
state: &mut F,
|
state: &mut F,
|
||||||
block: BasicBlock,
|
block: BasicBlock,
|
||||||
block_data: &'mir mir::BasicBlockData<'tcx>,
|
block_data: &'mir mir::BasicBlockData<'tcx>,
|
||||||
|
@ -438,7 +438,7 @@ impl Direction for Forward {
|
||||||
vis.visit_block_end(state, block_data, block);
|
vis.visit_block_end(state, block_data, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn join_state_into_successors_of<A>(
|
fn join_state_into_successors_of<'tcx, A>(
|
||||||
analysis: &A,
|
analysis: &A,
|
||||||
_tcx: TyCtxt<'tcx>,
|
_tcx: TyCtxt<'tcx>,
|
||||||
_body: &mir::Body<'tcx>,
|
_body: &mir::Body<'tcx>,
|
||||||
|
@ -591,7 +591,7 @@ where
|
||||||
//
|
//
|
||||||
// FIXME: Figure out how to express this using `Option::clone_from`, or maybe lift it into the
|
// FIXME: Figure out how to express this using `Option::clone_from`, or maybe lift it into the
|
||||||
// standard library?
|
// standard library?
|
||||||
fn opt_clone_from_or_clone<T: Clone>(opt: &'a mut Option<T>, val: &T) -> &'a mut T {
|
fn opt_clone_from_or_clone<'a, T: Clone>(opt: &'a mut Option<T>, val: &T) -> &'a mut T {
|
||||||
if opt.is_some() {
|
if opt.is_some() {
|
||||||
let ret = opt.as_mut().unwrap();
|
let ret = opt.as_mut().unwrap();
|
||||||
ret.clone_from(val);
|
ret.clone_from(val);
|
||||||
|
|
|
@ -31,12 +31,15 @@ where
|
||||||
pub(super) entry_sets: IndexVec<BasicBlock, A::Domain>,
|
pub(super) entry_sets: IndexVec<BasicBlock, A::Domain>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A> Results<'tcx, A>
|
impl<'tcx, A> Results<'tcx, A>
|
||||||
where
|
where
|
||||||
A: Analysis<'tcx>,
|
A: Analysis<'tcx>,
|
||||||
{
|
{
|
||||||
/// Creates a `ResultsCursor` that can inspect these `Results`.
|
/// Creates a `ResultsCursor` that can inspect these `Results`.
|
||||||
pub fn into_results_cursor(self, body: &'mir mir::Body<'tcx>) -> ResultsCursor<'mir, 'tcx, A> {
|
pub fn into_results_cursor<'mir>(
|
||||||
|
self,
|
||||||
|
body: &'mir mir::Body<'tcx>,
|
||||||
|
) -> ResultsCursor<'mir, 'tcx, A> {
|
||||||
ResultsCursor::new(body, self)
|
ResultsCursor::new(body, self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +48,7 @@ where
|
||||||
&self.entry_sets[block]
|
&self.entry_sets[block]
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn visit_with(
|
pub fn visit_with<'mir>(
|
||||||
&self,
|
&self,
|
||||||
body: &'mir mir::Body<'tcx>,
|
body: &'mir mir::Body<'tcx>,
|
||||||
blocks: impl IntoIterator<Item = BasicBlock>,
|
blocks: impl IntoIterator<Item = BasicBlock>,
|
||||||
|
@ -54,7 +57,7 @@ where
|
||||||
visit_results(body, blocks, self, vis)
|
visit_results(body, blocks, self, vis)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn visit_reachable_with(
|
pub fn visit_reachable_with<'mir>(
|
||||||
&self,
|
&self,
|
||||||
body: &'mir mir::Body<'tcx>,
|
body: &'mir mir::Body<'tcx>,
|
||||||
vis: &mut impl ResultsVisitor<'mir, 'tcx, FlowState = A::Domain>,
|
vis: &mut impl ResultsVisitor<'mir, 'tcx, FlowState = A::Domain>,
|
||||||
|
@ -85,7 +88,7 @@ where
|
||||||
apply_trans_for_block: Option<Box<dyn Fn(BasicBlock, &mut A::Domain)>>,
|
apply_trans_for_block: Option<Box<dyn Fn(BasicBlock, &mut A::Domain)>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A, D, T> Engine<'a, 'tcx, A>
|
impl<'a, 'tcx, A, D, T> Engine<'a, 'tcx, A>
|
||||||
where
|
where
|
||||||
A: GenKillAnalysis<'tcx, Idx = T, Domain = D>,
|
A: GenKillAnalysis<'tcx, Idx = T, Domain = D>,
|
||||||
D: Clone + JoinSemiLattice + GenKill<T> + BorrowMut<BitSet<T>>,
|
D: Clone + JoinSemiLattice + GenKill<T> + BorrowMut<BitSet<T>>,
|
||||||
|
@ -119,7 +122,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A, D> Engine<'a, 'tcx, A>
|
impl<'a, 'tcx, A, D> Engine<'a, 'tcx, A>
|
||||||
where
|
where
|
||||||
A: Analysis<'tcx, Domain = D>,
|
A: Analysis<'tcx, Domain = D>,
|
||||||
D: Clone + JoinSemiLattice,
|
D: Clone + JoinSemiLattice,
|
||||||
|
@ -257,7 +260,7 @@ where
|
||||||
|
|
||||||
/// Writes a DOT file containing the results of a dataflow analysis if the user requested it via
|
/// Writes a DOT file containing the results of a dataflow analysis if the user requested it via
|
||||||
/// `rustc_mir` attributes.
|
/// `rustc_mir` attributes.
|
||||||
fn write_graphviz_results<A>(
|
fn write_graphviz_results<'tcx, A>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
body: &mir::Body<'tcx>,
|
body: &mir::Body<'tcx>,
|
||||||
results: &Results<'tcx, A>,
|
results: &Results<'tcx, A>,
|
||||||
|
@ -330,7 +333,7 @@ struct RustcMirAttrs {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RustcMirAttrs {
|
impl RustcMirAttrs {
|
||||||
fn parse(tcx: TyCtxt<'tcx>, def_id: DefId) -> Result<Self, ()> {
|
fn parse(tcx: TyCtxt<'_>, def_id: DefId) -> Result<Self, ()> {
|
||||||
let attrs = tcx.get_attrs(def_id);
|
let attrs = tcx.get_attrs(def_id);
|
||||||
|
|
||||||
let mut result = Ok(());
|
let mut result = Ok(());
|
||||||
|
@ -373,7 +376,7 @@ impl RustcMirAttrs {
|
||||||
|
|
||||||
fn set_field<T>(
|
fn set_field<T>(
|
||||||
field: &mut Option<T>,
|
field: &mut Option<T>,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'_>,
|
||||||
attr: &ast::NestedMetaItem,
|
attr: &ast::NestedMetaItem,
|
||||||
mapper: impl FnOnce(Symbol) -> Result<T, ()>,
|
mapper: impl FnOnce(Symbol) -> Result<T, ()>,
|
||||||
) -> Result<(), ()> {
|
) -> Result<(), ()> {
|
||||||
|
|
|
@ -36,7 +36,7 @@ where
|
||||||
style: OutputStyle,
|
style: OutputStyle,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A> Formatter<'a, 'tcx, A>
|
impl<'a, 'tcx, A> Formatter<'a, 'tcx, A>
|
||||||
where
|
where
|
||||||
A: Analysis<'tcx>,
|
A: Analysis<'tcx>,
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,7 @@ pub struct CfgEdge {
|
||||||
index: usize,
|
index: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dataflow_successors(body: &Body<'tcx>, bb: BasicBlock) -> Vec<CfgEdge> {
|
fn dataflow_successors(body: &Body<'_>, bb: BasicBlock) -> Vec<CfgEdge> {
|
||||||
body[bb]
|
body[bb]
|
||||||
.terminator()
|
.terminator()
|
||||||
.successors()
|
.successors()
|
||||||
|
@ -61,7 +61,7 @@ fn dataflow_successors(body: &Body<'tcx>, bb: BasicBlock) -> Vec<CfgEdge> {
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A> dot::Labeller<'_> for Formatter<'a, 'tcx, A>
|
impl<'tcx, A> dot::Labeller<'_> for Formatter<'_, 'tcx, A>
|
||||||
where
|
where
|
||||||
A: Analysis<'tcx>,
|
A: Analysis<'tcx>,
|
||||||
A::Domain: DebugWithContext<A>,
|
A::Domain: DebugWithContext<A>,
|
||||||
|
@ -100,7 +100,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A> dot::GraphWalk<'a> for Formatter<'a, 'tcx, A>
|
impl<'a, 'tcx, A> dot::GraphWalk<'a> for Formatter<'a, 'tcx, A>
|
||||||
where
|
where
|
||||||
A: Analysis<'tcx>,
|
A: Analysis<'tcx>,
|
||||||
{
|
{
|
||||||
|
@ -138,7 +138,7 @@ where
|
||||||
style: OutputStyle,
|
style: OutputStyle,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A> BlockFormatter<'a, 'tcx, A>
|
impl<'a, 'tcx, A> BlockFormatter<'a, 'tcx, A>
|
||||||
where
|
where
|
||||||
A: Analysis<'tcx>,
|
A: Analysis<'tcx>,
|
||||||
A::Domain: DebugWithContext<A>,
|
A::Domain: DebugWithContext<A>,
|
||||||
|
@ -491,7 +491,7 @@ where
|
||||||
after: Vec<String>,
|
after: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A> StateDiffCollector<'a, 'tcx, A>
|
impl<'a, 'tcx, A> StateDiffCollector<'a, 'tcx, A>
|
||||||
where
|
where
|
||||||
A: Analysis<'tcx>,
|
A: Analysis<'tcx>,
|
||||||
A::Domain: DebugWithContext<A>,
|
A::Domain: DebugWithContext<A>,
|
||||||
|
@ -514,7 +514,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A> ResultsVisitor<'a, 'tcx> for StateDiffCollector<'a, 'tcx, A>
|
impl<'a, 'tcx, A> ResultsVisitor<'a, 'tcx> for StateDiffCollector<'a, 'tcx, A>
|
||||||
where
|
where
|
||||||
A: Analysis<'tcx>,
|
A: Analysis<'tcx>,
|
||||||
A::Domain: DebugWithContext<A>,
|
A::Domain: DebugWithContext<A>,
|
||||||
|
@ -524,7 +524,7 @@ where
|
||||||
fn visit_block_start(
|
fn visit_block_start(
|
||||||
&mut self,
|
&mut self,
|
||||||
state: &Self::FlowState,
|
state: &Self::FlowState,
|
||||||
_block_data: &'mir mir::BasicBlockData<'tcx>,
|
_block_data: &mir::BasicBlockData<'tcx>,
|
||||||
_block: BasicBlock,
|
_block: BasicBlock,
|
||||||
) {
|
) {
|
||||||
if A::Direction::is_forward() {
|
if A::Direction::is_forward() {
|
||||||
|
@ -535,7 +535,7 @@ where
|
||||||
fn visit_block_end(
|
fn visit_block_end(
|
||||||
&mut self,
|
&mut self,
|
||||||
state: &Self::FlowState,
|
state: &Self::FlowState,
|
||||||
_block_data: &'mir mir::BasicBlockData<'tcx>,
|
_block_data: &mir::BasicBlockData<'tcx>,
|
||||||
_block: BasicBlock,
|
_block: BasicBlock,
|
||||||
) {
|
) {
|
||||||
if A::Direction::is_backward() {
|
if A::Direction::is_backward() {
|
||||||
|
@ -546,7 +546,7 @@ where
|
||||||
fn visit_statement_before_primary_effect(
|
fn visit_statement_before_primary_effect(
|
||||||
&mut self,
|
&mut self,
|
||||||
state: &Self::FlowState,
|
state: &Self::FlowState,
|
||||||
_statement: &'mir mir::Statement<'tcx>,
|
_statement: &mir::Statement<'tcx>,
|
||||||
_location: Location,
|
_location: Location,
|
||||||
) {
|
) {
|
||||||
if let Some(before) = self.before.as_mut() {
|
if let Some(before) = self.before.as_mut() {
|
||||||
|
@ -558,7 +558,7 @@ where
|
||||||
fn visit_statement_after_primary_effect(
|
fn visit_statement_after_primary_effect(
|
||||||
&mut self,
|
&mut self,
|
||||||
state: &Self::FlowState,
|
state: &Self::FlowState,
|
||||||
_statement: &'mir mir::Statement<'tcx>,
|
_statement: &mir::Statement<'tcx>,
|
||||||
_location: Location,
|
_location: Location,
|
||||||
) {
|
) {
|
||||||
self.after.push(diff_pretty(state, &self.prev_state, self.analysis));
|
self.after.push(diff_pretty(state, &self.prev_state, self.analysis));
|
||||||
|
@ -568,7 +568,7 @@ where
|
||||||
fn visit_terminator_before_primary_effect(
|
fn visit_terminator_before_primary_effect(
|
||||||
&mut self,
|
&mut self,
|
||||||
state: &Self::FlowState,
|
state: &Self::FlowState,
|
||||||
_terminator: &'mir mir::Terminator<'tcx>,
|
_terminator: &mir::Terminator<'tcx>,
|
||||||
_location: Location,
|
_location: Location,
|
||||||
) {
|
) {
|
||||||
if let Some(before) = self.before.as_mut() {
|
if let Some(before) = self.before.as_mut() {
|
||||||
|
@ -580,7 +580,7 @@ where
|
||||||
fn visit_terminator_after_primary_effect(
|
fn visit_terminator_after_primary_effect(
|
||||||
&mut self,
|
&mut self,
|
||||||
state: &Self::FlowState,
|
state: &Self::FlowState,
|
||||||
_terminator: &'mir mir::Terminator<'tcx>,
|
_terminator: &mir::Terminator<'tcx>,
|
||||||
_location: Location,
|
_location: Location,
|
||||||
) {
|
) {
|
||||||
self.after.push(diff_pretty(state, &self.prev_state, self.analysis));
|
self.after.push(diff_pretty(state, &self.prev_state, self.analysis));
|
||||||
|
|
|
@ -214,7 +214,11 @@ pub trait Analysis<'tcx>: AnalysisDomain<'tcx> {
|
||||||
/// .iterate_to_fixpoint()
|
/// .iterate_to_fixpoint()
|
||||||
/// .into_results_cursor(body);
|
/// .into_results_cursor(body);
|
||||||
/// ```
|
/// ```
|
||||||
fn into_engine(self, tcx: TyCtxt<'tcx>, body: &'mir mir::Body<'tcx>) -> Engine<'mir, 'tcx, Self>
|
fn into_engine<'mir>(
|
||||||
|
self,
|
||||||
|
tcx: TyCtxt<'tcx>,
|
||||||
|
body: &'mir mir::Body<'tcx>,
|
||||||
|
) -> Engine<'mir, 'tcx, Self>
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
{
|
{
|
||||||
|
@ -296,7 +300,7 @@ pub trait GenKillAnalysis<'tcx>: Analysis<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A> Analysis<'tcx> for A
|
impl<'tcx, A> Analysis<'tcx> for A
|
||||||
where
|
where
|
||||||
A: GenKillAnalysis<'tcx>,
|
A: GenKillAnalysis<'tcx>,
|
||||||
A::Domain: GenKill<A::Idx> + BorrowMut<BitSet<A::Idx>>,
|
A::Domain: GenKill<A::Idx> + BorrowMut<BitSet<A::Idx>>,
|
||||||
|
@ -368,7 +372,11 @@ where
|
||||||
|
|
||||||
/* Extension methods */
|
/* Extension methods */
|
||||||
|
|
||||||
fn into_engine(self, tcx: TyCtxt<'tcx>, body: &'mir mir::Body<'tcx>) -> Engine<'mir, 'tcx, Self>
|
fn into_engine<'mir>(
|
||||||
|
self,
|
||||||
|
tcx: TyCtxt<'tcx>,
|
||||||
|
body: &'mir mir::Body<'tcx>,
|
||||||
|
) -> Engine<'mir, 'tcx, Self>
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
{
|
{
|
||||||
|
|
|
@ -85,7 +85,7 @@ struct MockAnalysis<'tcx, D> {
|
||||||
dir: PhantomData<D>,
|
dir: PhantomData<D>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<D: Direction> MockAnalysis<'tcx, D> {
|
impl<D: Direction> MockAnalysis<'_, D> {
|
||||||
const BASIC_BLOCK_OFFSET: usize = 100;
|
const BASIC_BLOCK_OFFSET: usize = 100;
|
||||||
|
|
||||||
/// The entry set for each `BasicBlock` is the ID of that block offset by a fixed amount to
|
/// The entry set for each `BasicBlock` is the ID of that block offset by a fixed amount to
|
||||||
|
@ -160,7 +160,7 @@ impl<D: Direction> MockAnalysis<'tcx, D> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<D: Direction> AnalysisDomain<'tcx> for MockAnalysis<'tcx, D> {
|
impl<'tcx, D: Direction> AnalysisDomain<'tcx> for MockAnalysis<'tcx, D> {
|
||||||
type Domain = BitSet<usize>;
|
type Domain = BitSet<usize>;
|
||||||
type Direction = D;
|
type Direction = D;
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ impl<D: Direction> AnalysisDomain<'tcx> for MockAnalysis<'tcx, D> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<D: Direction> Analysis<'tcx> for MockAnalysis<'tcx, D> {
|
impl<'tcx, D: Direction> Analysis<'tcx> for MockAnalysis<'tcx, D> {
|
||||||
fn apply_statement_effect(
|
fn apply_statement_effect(
|
||||||
&self,
|
&self,
|
||||||
state: &mut Self::Domain,
|
state: &mut Self::Domain,
|
||||||
|
@ -260,7 +260,7 @@ impl SeekTarget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_cursor<D: Direction>(analysis: MockAnalysis<'tcx, D>) {
|
fn test_cursor<D: Direction>(analysis: MockAnalysis<'_, D>) {
|
||||||
let body = analysis.body;
|
let body = analysis.body;
|
||||||
|
|
||||||
let mut cursor =
|
let mut cursor =
|
||||||
|
|
|
@ -4,7 +4,7 @@ use super::{Analysis, Direction, Results};
|
||||||
|
|
||||||
/// Calls the corresponding method in `ResultsVisitor` for every location in a `mir::Body` with the
|
/// Calls the corresponding method in `ResultsVisitor` for every location in a `mir::Body` with the
|
||||||
/// dataflow state at that location.
|
/// dataflow state at that location.
|
||||||
pub fn visit_results<F, V>(
|
pub fn visit_results<'mir, 'tcx, F, V>(
|
||||||
body: &'mir mir::Body<'tcx>,
|
body: &'mir mir::Body<'tcx>,
|
||||||
blocks: impl IntoIterator<Item = BasicBlock>,
|
blocks: impl IntoIterator<Item = BasicBlock>,
|
||||||
results: &V,
|
results: &V,
|
||||||
|
|
|
@ -45,7 +45,7 @@ impl MaybeBorrowedLocals {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AnalysisDomain<'tcx> for MaybeBorrowedLocals {
|
impl<'tcx> AnalysisDomain<'tcx> for MaybeBorrowedLocals {
|
||||||
type Domain = BitSet<Local>;
|
type Domain = BitSet<Local>;
|
||||||
const NAME: &'static str = "maybe_borrowed_locals";
|
const NAME: &'static str = "maybe_borrowed_locals";
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ impl AnalysisDomain<'tcx> for MaybeBorrowedLocals {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GenKillAnalysis<'tcx> for MaybeBorrowedLocals {
|
impl<'tcx> GenKillAnalysis<'tcx> for MaybeBorrowedLocals {
|
||||||
type Idx = Local;
|
type Idx = Local;
|
||||||
|
|
||||||
fn statement_effect(
|
fn statement_effect(
|
||||||
|
@ -95,7 +95,7 @@ struct TransferFunction<'a, T> {
|
||||||
ignore_borrow_on_drop: bool,
|
ignore_borrow_on_drop: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Visitor<'tcx> for TransferFunction<'a, T>
|
impl<'tcx, T> Visitor<'tcx> for TransferFunction<'_, T>
|
||||||
where
|
where
|
||||||
T: GenKill<Local>,
|
T: GenKill<Local>,
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,7 @@ use rustc_middle::mir::{self, BasicBlock, Local, Location};
|
||||||
|
|
||||||
pub struct MaybeInitializedLocals;
|
pub struct MaybeInitializedLocals;
|
||||||
|
|
||||||
impl crate::AnalysisDomain<'tcx> for MaybeInitializedLocals {
|
impl<'tcx> crate::AnalysisDomain<'tcx> for MaybeInitializedLocals {
|
||||||
type Domain = BitSet<Local>;
|
type Domain = BitSet<Local>;
|
||||||
|
|
||||||
const NAME: &'static str = "maybe_init_locals";
|
const NAME: &'static str = "maybe_init_locals";
|
||||||
|
@ -28,7 +28,7 @@ impl crate::AnalysisDomain<'tcx> for MaybeInitializedLocals {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl crate::GenKillAnalysis<'tcx> for MaybeInitializedLocals {
|
impl<'tcx> crate::GenKillAnalysis<'tcx> for MaybeInitializedLocals {
|
||||||
type Idx = Local;
|
type Idx = Local;
|
||||||
|
|
||||||
fn statement_effect(
|
fn statement_effect(
|
||||||
|
@ -73,7 +73,7 @@ struct TransferFunction<'a, T> {
|
||||||
trans: &'a mut T,
|
trans: &'a mut T,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Visitor<'tcx> for TransferFunction<'a, T>
|
impl<T> Visitor<'_> for TransferFunction<'_, T>
|
||||||
where
|
where
|
||||||
T: GenKill<Local>,
|
T: GenKill<Local>,
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,12 +48,12 @@ use crate::{AnalysisDomain, Backward, CallReturnPlaces, GenKill, GenKillAnalysis
|
||||||
pub struct MaybeLiveLocals;
|
pub struct MaybeLiveLocals;
|
||||||
|
|
||||||
impl MaybeLiveLocals {
|
impl MaybeLiveLocals {
|
||||||
fn transfer_function<T>(&self, trans: &'a mut T) -> TransferFunction<'a, T> {
|
fn transfer_function<'a, T>(&self, trans: &'a mut T) -> TransferFunction<'a, T> {
|
||||||
TransferFunction(trans)
|
TransferFunction(trans)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AnalysisDomain<'tcx> for MaybeLiveLocals {
|
impl<'tcx> AnalysisDomain<'tcx> for MaybeLiveLocals {
|
||||||
type Domain = BitSet<Local>;
|
type Domain = BitSet<Local>;
|
||||||
type Direction = Backward;
|
type Direction = Backward;
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ impl AnalysisDomain<'tcx> for MaybeLiveLocals {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GenKillAnalysis<'tcx> for MaybeLiveLocals {
|
impl<'tcx> GenKillAnalysis<'tcx> for MaybeLiveLocals {
|
||||||
type Idx = Local;
|
type Idx = Local;
|
||||||
|
|
||||||
fn statement_effect(
|
fn statement_effect(
|
||||||
|
|
|
@ -704,7 +704,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for EverInitializedPlaces<'_, 'tcx> {
|
||||||
///
|
///
|
||||||
/// If the basic block matches this pattern, this function returns the place corresponding to the
|
/// If the basic block matches this pattern, this function returns the place corresponding to the
|
||||||
/// enum (`_1` in the example above) as well as the `AdtDef` of that enum.
|
/// enum (`_1` in the example above) as well as the `AdtDef` of that enum.
|
||||||
fn switch_on_enum_discriminant(
|
fn switch_on_enum_discriminant<'mir, 'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
body: &'mir mir::Body<'tcx>,
|
body: &'mir mir::Body<'tcx>,
|
||||||
block: &'mir mir::BasicBlockData<'tcx>,
|
block: &'mir mir::BasicBlockData<'tcx>,
|
||||||
|
|
|
@ -17,7 +17,7 @@ impl MaybeStorageLive {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl crate::AnalysisDomain<'tcx> for MaybeStorageLive {
|
impl<'tcx> crate::AnalysisDomain<'tcx> for MaybeStorageLive {
|
||||||
type Domain = BitSet<Local>;
|
type Domain = BitSet<Local>;
|
||||||
|
|
||||||
const NAME: &'static str = "maybe_storage_live";
|
const NAME: &'static str = "maybe_storage_live";
|
||||||
|
@ -39,7 +39,7 @@ impl crate::AnalysisDomain<'tcx> for MaybeStorageLive {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl crate::GenKillAnalysis<'tcx> for MaybeStorageLive {
|
impl<'tcx> crate::GenKillAnalysis<'tcx> for MaybeStorageLive {
|
||||||
type Idx = Local;
|
type Idx = Local;
|
||||||
|
|
||||||
fn statement_effect(
|
fn statement_effect(
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(exact_size_is_empty)]
|
#![feature(exact_size_is_empty)]
|
||||||
#![feature(in_band_lifetimes)]
|
|
||||||
#![feature(let_else)]
|
#![feature(let_else)]
|
||||||
#![feature(min_specialization)]
|
#![feature(min_specialization)]
|
||||||
#![feature(once_cell)]
|
#![feature(once_cell)]
|
||||||
|
|
|
@ -11,7 +11,7 @@ use rustc_middle::mir::{self, Local};
|
||||||
pub struct AlwaysLiveLocals(BitSet<Local>);
|
pub struct AlwaysLiveLocals(BitSet<Local>);
|
||||||
|
|
||||||
impl AlwaysLiveLocals {
|
impl AlwaysLiveLocals {
|
||||||
pub fn new(body: &mir::Body<'tcx>) -> Self {
|
pub fn new(body: &mir::Body<'_>) -> Self {
|
||||||
let mut always_live_locals = AlwaysLiveLocals(BitSet::new_filled(body.local_decls.len()));
|
let mut always_live_locals = AlwaysLiveLocals(BitSet::new_filled(body.local_decls.len()));
|
||||||
|
|
||||||
for block in body.basic_blocks() {
|
for block in body.basic_blocks() {
|
||||||
|
|
Loading…
Reference in New Issue