diff --git a/compiler/rustc_mir_dataflow/src/framework/direction.rs b/compiler/rustc_mir_dataflow/src/framework/direction.rs
index 6131ee7981829..102e74397724a 100644
--- a/compiler/rustc_mir_dataflow/src/framework/direction.rs
+++ b/compiler/rustc_mir_dataflow/src/framework/direction.rs
@@ -18,7 +18,7 @@ pub trait Direction {
/// Applies all effects between the given `EffectIndex`s.
///
/// `effects.start()` must precede or equal `effects.end()` in this direction.
- fn apply_effects_in_range(
+ fn apply_effects_in_range<'tcx, A>(
analysis: &A,
state: &mut A::Domain,
block: BasicBlock,
@@ -27,7 +27,7 @@ pub trait Direction {
) where
A: Analysis<'tcx>;
- fn apply_effects_in_block(
+ fn apply_effects_in_block<'tcx, A>(
analysis: &A,
state: &mut A::Domain,
block: BasicBlock,
@@ -35,7 +35,7 @@ pub trait Direction {
) where
A: Analysis<'tcx>;
- fn gen_kill_effects_in_block(
+ fn gen_kill_effects_in_block<'tcx, A>(
analysis: &A,
trans: &mut GenKillSet,
block: BasicBlock,
@@ -43,7 +43,7 @@ pub trait Direction {
) where
A: GenKillAnalysis<'tcx>;
- fn visit_results_in_block(
+ fn visit_results_in_block<'mir, 'tcx, F, R>(
state: &mut F,
block: BasicBlock,
block_data: &'mir mir::BasicBlockData<'tcx>,
@@ -52,7 +52,7 @@ pub trait Direction {
) where
R: ResultsVisitable<'tcx, FlowState = F>;
- fn join_state_into_successors_of(
+ fn join_state_into_successors_of<'tcx, A>(
analysis: &A,
tcx: TyCtxt<'tcx>,
body: &mir::Body<'tcx>,
@@ -72,7 +72,7 @@ impl Direction for Backward {
false
}
- fn apply_effects_in_block(
+ fn apply_effects_in_block<'tcx, A>(
analysis: &A,
state: &mut A::Domain,
block: BasicBlock,
@@ -92,7 +92,7 @@ impl Direction for Backward {
}
}
- fn gen_kill_effects_in_block(
+ fn gen_kill_effects_in_block<'tcx, A>(
analysis: &A,
trans: &mut GenKillSet,
block: BasicBlock,
@@ -112,7 +112,7 @@ impl Direction for Backward {
}
}
- fn apply_effects_in_range(
+ fn apply_effects_in_range<'tcx, A>(
analysis: &A,
state: &mut A::Domain,
block: BasicBlock,
@@ -189,7 +189,7 @@ impl Direction for Backward {
analysis.apply_statement_effect(state, statement, location);
}
- fn visit_results_in_block(
+ fn visit_results_in_block<'mir, 'tcx, F, R>(
state: &mut F,
block: BasicBlock,
block_data: &'mir mir::BasicBlockData<'tcx>,
@@ -221,7 +221,7 @@ impl Direction for Backward {
vis.visit_block_start(state, block_data, block);
}
- fn join_state_into_successors_of(
+ fn join_state_into_successors_of<'tcx, A>(
analysis: &A,
_tcx: TyCtxt<'tcx>,
body: &mir::Body<'tcx>,
@@ -294,7 +294,7 @@ impl Direction for Forward {
true
}
- fn apply_effects_in_block(
+ fn apply_effects_in_block<'tcx, A>(
analysis: &A,
state: &mut A::Domain,
block: BasicBlock,
@@ -314,7 +314,7 @@ impl Direction for Forward {
analysis.apply_terminator_effect(state, terminator, location);
}
- fn gen_kill_effects_in_block(
+ fn gen_kill_effects_in_block<'tcx, A>(
analysis: &A,
trans: &mut GenKillSet,
block: BasicBlock,
@@ -334,7 +334,7 @@ impl Direction for Forward {
analysis.terminator_effect(trans, terminator, location);
}
- fn apply_effects_in_range(
+ fn apply_effects_in_range<'tcx, A>(
analysis: &A,
state: &mut A::Domain,
block: BasicBlock,
@@ -407,7 +407,7 @@ impl Direction for Forward {
}
}
- fn visit_results_in_block(
+ fn visit_results_in_block<'mir, 'tcx, F, R>(
state: &mut F,
block: BasicBlock,
block_data: &'mir mir::BasicBlockData<'tcx>,
@@ -438,7 +438,7 @@ impl Direction for Forward {
vis.visit_block_end(state, block_data, block);
}
- fn join_state_into_successors_of(
+ fn join_state_into_successors_of<'tcx, A>(
analysis: &A,
_tcx: TyCtxt<'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
// standard library?
-fn opt_clone_from_or_clone(opt: &'a mut Option, val: &T) -> &'a mut T {
+fn opt_clone_from_or_clone<'a, T: Clone>(opt: &'a mut Option, val: &T) -> &'a mut T {
if opt.is_some() {
let ret = opt.as_mut().unwrap();
ret.clone_from(val);
diff --git a/compiler/rustc_mir_dataflow/src/framework/engine.rs b/compiler/rustc_mir_dataflow/src/framework/engine.rs
index 804abc3b42b53..e8a6d8dad439e 100644
--- a/compiler/rustc_mir_dataflow/src/framework/engine.rs
+++ b/compiler/rustc_mir_dataflow/src/framework/engine.rs
@@ -31,12 +31,15 @@ where
pub(super) entry_sets: IndexVec,
}
-impl Results<'tcx, A>
+impl<'tcx, A> Results<'tcx, A>
where
A: Analysis<'tcx>,
{
/// 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)
}
@@ -45,7 +48,7 @@ where
&self.entry_sets[block]
}
- pub fn visit_with(
+ pub fn visit_with<'mir>(
&self,
body: &'mir mir::Body<'tcx>,
blocks: impl IntoIterator- ,
@@ -54,7 +57,7 @@ where
visit_results(body, blocks, self, vis)
}
- pub fn visit_reachable_with(
+ pub fn visit_reachable_with<'mir>(
&self,
body: &'mir mir::Body<'tcx>,
vis: &mut impl ResultsVisitor<'mir, 'tcx, FlowState = A::Domain>,
@@ -85,7 +88,7 @@ where
apply_trans_for_block: Option>,
}
-impl Engine<'a, 'tcx, A>
+impl<'a, 'tcx, A, D, T> Engine<'a, 'tcx, A>
where
A: GenKillAnalysis<'tcx, Idx = T, Domain = D>,
D: Clone + JoinSemiLattice + GenKill + BorrowMut>,
@@ -119,7 +122,7 @@ where
}
}
-impl Engine<'a, 'tcx, A>
+impl<'a, 'tcx, A, D> Engine<'a, 'tcx, A>
where
A: Analysis<'tcx, Domain = D>,
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
/// `rustc_mir` attributes.
-fn write_graphviz_results(
+fn write_graphviz_results<'tcx, A>(
tcx: TyCtxt<'tcx>,
body: &mir::Body<'tcx>,
results: &Results<'tcx, A>,
@@ -330,7 +333,7 @@ struct RustcMirAttrs {
}
impl RustcMirAttrs {
- fn parse(tcx: TyCtxt<'tcx>, def_id: DefId) -> Result {
+ fn parse(tcx: TyCtxt<'_>, def_id: DefId) -> Result {
let attrs = tcx.get_attrs(def_id);
let mut result = Ok(());
@@ -373,7 +376,7 @@ impl RustcMirAttrs {
fn set_field(
field: &mut Option,
- tcx: TyCtxt<'tcx>,
+ tcx: TyCtxt<'_>,
attr: &ast::NestedMetaItem,
mapper: impl FnOnce(Symbol) -> Result,
) -> Result<(), ()> {
diff --git a/compiler/rustc_mir_dataflow/src/framework/graphviz.rs b/compiler/rustc_mir_dataflow/src/framework/graphviz.rs
index 517bc086ef683..34bc157a744a7 100644
--- a/compiler/rustc_mir_dataflow/src/framework/graphviz.rs
+++ b/compiler/rustc_mir_dataflow/src/framework/graphviz.rs
@@ -36,7 +36,7 @@ where
style: OutputStyle,
}
-impl Formatter<'a, 'tcx, A>
+impl<'a, 'tcx, A> Formatter<'a, 'tcx, A>
where
A: Analysis<'tcx>,
{
@@ -52,7 +52,7 @@ pub struct CfgEdge {
index: usize,
}
-fn dataflow_successors(body: &Body<'tcx>, bb: BasicBlock) -> Vec {
+fn dataflow_successors(body: &Body<'_>, bb: BasicBlock) -> Vec {
body[bb]
.terminator()
.successors()
@@ -61,7 +61,7 @@ fn dataflow_successors(body: &Body<'tcx>, bb: BasicBlock) -> Vec {
.collect()
}
-impl dot::Labeller<'_> for Formatter<'a, 'tcx, A>
+impl<'tcx, A> dot::Labeller<'_> for Formatter<'_, 'tcx, A>
where
A: Analysis<'tcx>,
A::Domain: DebugWithContext,
@@ -100,7 +100,7 @@ where
}
}
-impl dot::GraphWalk<'a> for Formatter<'a, 'tcx, A>
+impl<'a, 'tcx, A> dot::GraphWalk<'a> for Formatter<'a, 'tcx, A>
where
A: Analysis<'tcx>,
{
@@ -138,7 +138,7 @@ where
style: OutputStyle,
}
-impl BlockFormatter<'a, 'tcx, A>
+impl<'a, 'tcx, A> BlockFormatter<'a, 'tcx, A>
where
A: Analysis<'tcx>,
A::Domain: DebugWithContext,
@@ -491,7 +491,7 @@ where
after: Vec,
}
-impl StateDiffCollector<'a, 'tcx, A>
+impl<'a, 'tcx, A> StateDiffCollector<'a, 'tcx, A>
where
A: Analysis<'tcx>,
A::Domain: DebugWithContext,
@@ -514,7 +514,7 @@ where
}
}
-impl ResultsVisitor<'a, 'tcx> for StateDiffCollector<'a, 'tcx, A>
+impl<'a, 'tcx, A> ResultsVisitor<'a, 'tcx> for StateDiffCollector<'a, 'tcx, A>
where
A: Analysis<'tcx>,
A::Domain: DebugWithContext,
@@ -524,7 +524,7 @@ where
fn visit_block_start(
&mut self,
state: &Self::FlowState,
- _block_data: &'mir mir::BasicBlockData<'tcx>,
+ _block_data: &mir::BasicBlockData<'tcx>,
_block: BasicBlock,
) {
if A::Direction::is_forward() {
@@ -535,7 +535,7 @@ where
fn visit_block_end(
&mut self,
state: &Self::FlowState,
- _block_data: &'mir mir::BasicBlockData<'tcx>,
+ _block_data: &mir::BasicBlockData<'tcx>,
_block: BasicBlock,
) {
if A::Direction::is_backward() {
@@ -546,7 +546,7 @@ where
fn visit_statement_before_primary_effect(
&mut self,
state: &Self::FlowState,
- _statement: &'mir mir::Statement<'tcx>,
+ _statement: &mir::Statement<'tcx>,
_location: Location,
) {
if let Some(before) = self.before.as_mut() {
@@ -558,7 +558,7 @@ where
fn visit_statement_after_primary_effect(
&mut self,
state: &Self::FlowState,
- _statement: &'mir mir::Statement<'tcx>,
+ _statement: &mir::Statement<'tcx>,
_location: Location,
) {
self.after.push(diff_pretty(state, &self.prev_state, self.analysis));
@@ -568,7 +568,7 @@ where
fn visit_terminator_before_primary_effect(
&mut self,
state: &Self::FlowState,
- _terminator: &'mir mir::Terminator<'tcx>,
+ _terminator: &mir::Terminator<'tcx>,
_location: Location,
) {
if let Some(before) = self.before.as_mut() {
@@ -580,7 +580,7 @@ where
fn visit_terminator_after_primary_effect(
&mut self,
state: &Self::FlowState,
- _terminator: &'mir mir::Terminator<'tcx>,
+ _terminator: &mir::Terminator<'tcx>,
_location: Location,
) {
self.after.push(diff_pretty(state, &self.prev_state, self.analysis));
diff --git a/compiler/rustc_mir_dataflow/src/framework/mod.rs b/compiler/rustc_mir_dataflow/src/framework/mod.rs
index 500fba8b1142c..dac6720a6e543 100644
--- a/compiler/rustc_mir_dataflow/src/framework/mod.rs
+++ b/compiler/rustc_mir_dataflow/src/framework/mod.rs
@@ -214,7 +214,11 @@ pub trait Analysis<'tcx>: AnalysisDomain<'tcx> {
/// .iterate_to_fixpoint()
/// .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
Self: Sized,
{
@@ -296,7 +300,7 @@ pub trait GenKillAnalysis<'tcx>: Analysis<'tcx> {
}
}
-impl Analysis<'tcx> for A
+impl<'tcx, A> Analysis<'tcx> for A
where
A: GenKillAnalysis<'tcx>,
A::Domain: GenKill + BorrowMut>,
@@ -368,7 +372,11 @@ where
/* 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
Self: Sized,
{
diff --git a/compiler/rustc_mir_dataflow/src/framework/tests.rs b/compiler/rustc_mir_dataflow/src/framework/tests.rs
index 01ca8ca9258fb..3cc8d30259c0e 100644
--- a/compiler/rustc_mir_dataflow/src/framework/tests.rs
+++ b/compiler/rustc_mir_dataflow/src/framework/tests.rs
@@ -85,7 +85,7 @@ struct MockAnalysis<'tcx, D> {
dir: PhantomData,
}
-impl MockAnalysis<'tcx, D> {
+impl MockAnalysis<'_, D> {
const BASIC_BLOCK_OFFSET: usize = 100;
/// The entry set for each `BasicBlock` is the ID of that block offset by a fixed amount to
@@ -160,7 +160,7 @@ impl MockAnalysis<'tcx, D> {
}
}
-impl AnalysisDomain<'tcx> for MockAnalysis<'tcx, D> {
+impl<'tcx, D: Direction> AnalysisDomain<'tcx> for MockAnalysis<'tcx, D> {
type Domain = BitSet;
type Direction = D;
@@ -175,7 +175,7 @@ impl AnalysisDomain<'tcx> for MockAnalysis<'tcx, D> {
}
}
-impl Analysis<'tcx> for MockAnalysis<'tcx, D> {
+impl<'tcx, D: Direction> Analysis<'tcx> for MockAnalysis<'tcx, D> {
fn apply_statement_effect(
&self,
state: &mut Self::Domain,
@@ -260,7 +260,7 @@ impl SeekTarget {
}
}
-fn test_cursor(analysis: MockAnalysis<'tcx, D>) {
+fn test_cursor(analysis: MockAnalysis<'_, D>) {
let body = analysis.body;
let mut cursor =
diff --git a/compiler/rustc_mir_dataflow/src/framework/visitor.rs b/compiler/rustc_mir_dataflow/src/framework/visitor.rs
index 84136c4d78cf1..75b4e150a8a33 100644
--- a/compiler/rustc_mir_dataflow/src/framework/visitor.rs
+++ b/compiler/rustc_mir_dataflow/src/framework/visitor.rs
@@ -4,7 +4,7 @@ use super::{Analysis, Direction, Results};
/// Calls the corresponding method in `ResultsVisitor` for every location in a `mir::Body` with the
/// dataflow state at that location.
-pub fn visit_results(
+pub fn visit_results<'mir, 'tcx, F, V>(
body: &'mir mir::Body<'tcx>,
blocks: impl IntoIterator
- ,
results: &V,
diff --git a/compiler/rustc_mir_dataflow/src/impls/borrowed_locals.rs b/compiler/rustc_mir_dataflow/src/impls/borrowed_locals.rs
index 6df2c8df3cea0..bb9755e4f48dd 100644
--- a/compiler/rustc_mir_dataflow/src/impls/borrowed_locals.rs
+++ b/compiler/rustc_mir_dataflow/src/impls/borrowed_locals.rs
@@ -45,7 +45,7 @@ impl MaybeBorrowedLocals {
}
}
-impl AnalysisDomain<'tcx> for MaybeBorrowedLocals {
+impl<'tcx> AnalysisDomain<'tcx> for MaybeBorrowedLocals {
type Domain = BitSet;
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;
fn statement_effect(
@@ -95,7 +95,7 @@ struct TransferFunction<'a, T> {
ignore_borrow_on_drop: bool,
}
-impl Visitor<'tcx> for TransferFunction<'a, T>
+impl<'tcx, T> Visitor<'tcx> for TransferFunction<'_, T>
where
T: GenKill,
{
diff --git a/compiler/rustc_mir_dataflow/src/impls/init_locals.rs b/compiler/rustc_mir_dataflow/src/impls/init_locals.rs
index df13b5c33940a..b355871d64f6f 100644
--- a/compiler/rustc_mir_dataflow/src/impls/init_locals.rs
+++ b/compiler/rustc_mir_dataflow/src/impls/init_locals.rs
@@ -10,7 +10,7 @@ use rustc_middle::mir::{self, BasicBlock, Local, Location};
pub struct MaybeInitializedLocals;
-impl crate::AnalysisDomain<'tcx> for MaybeInitializedLocals {
+impl<'tcx> crate::AnalysisDomain<'tcx> for MaybeInitializedLocals {
type Domain = BitSet;
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;
fn statement_effect(
@@ -73,7 +73,7 @@ struct TransferFunction<'a, T> {
trans: &'a mut T,
}
-impl Visitor<'tcx> for TransferFunction<'a, T>
+impl Visitor<'_> for TransferFunction<'_, T>
where
T: GenKill,
{
diff --git a/compiler/rustc_mir_dataflow/src/impls/liveness.rs b/compiler/rustc_mir_dataflow/src/impls/liveness.rs
index 5be9df6c452a2..65c388f8124a3 100644
--- a/compiler/rustc_mir_dataflow/src/impls/liveness.rs
+++ b/compiler/rustc_mir_dataflow/src/impls/liveness.rs
@@ -48,12 +48,12 @@ use crate::{AnalysisDomain, Backward, CallReturnPlaces, GenKill, GenKillAnalysis
pub struct MaybeLiveLocals;
impl MaybeLiveLocals {
- fn transfer_function(&self, trans: &'a mut T) -> TransferFunction<'a, T> {
+ fn transfer_function<'a, T>(&self, trans: &'a mut T) -> TransferFunction<'a, T> {
TransferFunction(trans)
}
}
-impl AnalysisDomain<'tcx> for MaybeLiveLocals {
+impl<'tcx> AnalysisDomain<'tcx> for MaybeLiveLocals {
type Domain = BitSet;
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;
fn statement_effect(
diff --git a/compiler/rustc_mir_dataflow/src/impls/mod.rs b/compiler/rustc_mir_dataflow/src/impls/mod.rs
index 5659fd2dc7075..5dc8a003b4778 100644
--- a/compiler/rustc_mir_dataflow/src/impls/mod.rs
+++ b/compiler/rustc_mir_dataflow/src/impls/mod.rs
@@ -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
/// 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>,
body: &'mir mir::Body<'tcx>,
block: &'mir mir::BasicBlockData<'tcx>,
diff --git a/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs b/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs
index 108357abc0de0..896377f2bc307 100644
--- a/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs
+++ b/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs
@@ -17,7 +17,7 @@ impl MaybeStorageLive {
}
}
-impl crate::AnalysisDomain<'tcx> for MaybeStorageLive {
+impl<'tcx> crate::AnalysisDomain<'tcx> for MaybeStorageLive {
type Domain = BitSet;
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;
fn statement_effect(
diff --git a/compiler/rustc_mir_dataflow/src/lib.rs b/compiler/rustc_mir_dataflow/src/lib.rs
index 8fdd0a39f250a..6c2d1b85646b1 100644
--- a/compiler/rustc_mir_dataflow/src/lib.rs
+++ b/compiler/rustc_mir_dataflow/src/lib.rs
@@ -3,7 +3,6 @@
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(exact_size_is_empty)]
-#![feature(in_band_lifetimes)]
#![feature(let_else)]
#![feature(min_specialization)]
#![feature(once_cell)]
diff --git a/compiler/rustc_mir_dataflow/src/storage.rs b/compiler/rustc_mir_dataflow/src/storage.rs
index 18b8ef557d671..218d4557215fb 100644
--- a/compiler/rustc_mir_dataflow/src/storage.rs
+++ b/compiler/rustc_mir_dataflow/src/storage.rs
@@ -11,7 +11,7 @@ use rustc_middle::mir::{self, Local};
pub struct AlwaysLiveLocals(BitSet);
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()));
for block in body.basic_blocks() {