Tweak GenKillAnalysis
method arguments.
`GenKillAnalysis` has very similar methods to `Analysis`, but the first two have a notable difference: the second argument is `&mut impl GenKill<Self::Idx>` instead of `&mut Self::Domain`. But thanks to the previous commit, this difference is no longer necessary.
This commit is contained in:
parent
e0b83c34c3
commit
13968b4a70
6 changed files with 16 additions and 32 deletions
|
@ -518,7 +518,7 @@ impl<'tcx> rustc_mir_dataflow::GenKillAnalysis<'tcx> for Borrows<'_, 'tcx> {
|
||||||
|
|
||||||
fn before_statement_effect(
|
fn before_statement_effect(
|
||||||
&mut self,
|
&mut self,
|
||||||
trans: &mut impl GenKill<Self::Idx>,
|
trans: &mut Self::Domain,
|
||||||
_statement: &mir::Statement<'tcx>,
|
_statement: &mir::Statement<'tcx>,
|
||||||
location: Location,
|
location: Location,
|
||||||
) {
|
) {
|
||||||
|
@ -527,7 +527,7 @@ impl<'tcx> rustc_mir_dataflow::GenKillAnalysis<'tcx> for Borrows<'_, 'tcx> {
|
||||||
|
|
||||||
fn statement_effect(
|
fn statement_effect(
|
||||||
&mut self,
|
&mut self,
|
||||||
trans: &mut impl GenKill<Self::Idx>,
|
trans: &mut Self::Domain,
|
||||||
stmt: &mir::Statement<'tcx>,
|
stmt: &mir::Statement<'tcx>,
|
||||||
location: Location,
|
location: Location,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -260,19 +260,18 @@ pub trait GenKillAnalysis<'tcx>: Analysis<'tcx> {
|
||||||
|
|
||||||
fn domain_size(&self, body: &mir::Body<'tcx>) -> usize;
|
fn domain_size(&self, body: &mir::Body<'tcx>) -> usize;
|
||||||
|
|
||||||
/// See `Analysis::apply_statement_effect`. Note how the second arg differs.
|
/// See `Analysis::apply_statement_effect`.
|
||||||
fn statement_effect(
|
fn statement_effect(
|
||||||
&mut self,
|
&mut self,
|
||||||
trans: &mut impl GenKill<Self::Idx>,
|
trans: &mut Self::Domain,
|
||||||
statement: &mir::Statement<'tcx>,
|
statement: &mir::Statement<'tcx>,
|
||||||
location: Location,
|
location: Location,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// See `Analysis::apply_before_statement_effect`. Note how the second arg
|
/// See `Analysis::apply_before_statement_effect`.
|
||||||
/// differs.
|
|
||||||
fn before_statement_effect(
|
fn before_statement_effect(
|
||||||
&mut self,
|
&mut self,
|
||||||
_trans: &mut impl GenKill<Self::Idx>,
|
_trans: &mut Self::Domain,
|
||||||
_statement: &mir::Statement<'tcx>,
|
_statement: &mir::Statement<'tcx>,
|
||||||
_location: Location,
|
_location: Location,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeBorrowedLocals {
|
||||||
|
|
||||||
fn statement_effect(
|
fn statement_effect(
|
||||||
&mut self,
|
&mut self,
|
||||||
trans: &mut impl GenKill<Self::Idx>,
|
trans: &mut Self::Domain,
|
||||||
statement: &Statement<'tcx>,
|
statement: &Statement<'tcx>,
|
||||||
location: Location,
|
location: Location,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -338,7 +338,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeInitializedPlaces<'_, 'tcx> {
|
||||||
|
|
||||||
fn statement_effect(
|
fn statement_effect(
|
||||||
&mut self,
|
&mut self,
|
||||||
trans: &mut impl GenKill<Self::Idx>,
|
trans: &mut Self::Domain,
|
||||||
statement: &mir::Statement<'tcx>,
|
statement: &mir::Statement<'tcx>,
|
||||||
location: Location,
|
location: Location,
|
||||||
) {
|
) {
|
||||||
|
@ -475,7 +475,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeUninitializedPlaces<'_, 'tcx> {
|
||||||
|
|
||||||
fn statement_effect(
|
fn statement_effect(
|
||||||
&mut self,
|
&mut self,
|
||||||
trans: &mut impl GenKill<Self::Idx>,
|
trans: &mut Self::Domain,
|
||||||
_statement: &mir::Statement<'tcx>,
|
_statement: &mir::Statement<'tcx>,
|
||||||
location: Location,
|
location: Location,
|
||||||
) {
|
) {
|
||||||
|
@ -602,7 +602,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for DefinitelyInitializedPlaces<'_, 'tcx> {
|
||||||
|
|
||||||
fn statement_effect(
|
fn statement_effect(
|
||||||
&mut self,
|
&mut self,
|
||||||
trans: &mut impl GenKill<Self::Idx>,
|
trans: &mut Self::Domain,
|
||||||
_statement: &mir::Statement<'tcx>,
|
_statement: &mir::Statement<'tcx>,
|
||||||
location: Location,
|
location: Location,
|
||||||
) {
|
) {
|
||||||
|
@ -672,7 +672,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for EverInitializedPlaces<'_, 'tcx> {
|
||||||
#[instrument(skip(self, trans), level = "debug")]
|
#[instrument(skip(self, trans), level = "debug")]
|
||||||
fn statement_effect(
|
fn statement_effect(
|
||||||
&mut self,
|
&mut self,
|
||||||
trans: &mut impl GenKill<Self::Idx>,
|
trans: &mut Self::Domain,
|
||||||
stmt: &mir::Statement<'tcx>,
|
stmt: &mir::Statement<'tcx>,
|
||||||
location: Location,
|
location: Location,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeLiveLocals {
|
||||||
|
|
||||||
fn statement_effect(
|
fn statement_effect(
|
||||||
&mut self,
|
&mut self,
|
||||||
trans: &mut impl GenKill<Self::Idx>,
|
trans: &mut Self::Domain,
|
||||||
statement: &mir::Statement<'tcx>,
|
statement: &mir::Statement<'tcx>,
|
||||||
location: Location,
|
location: Location,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -46,12 +46,7 @@ impl<'a, 'tcx> crate::GenKillAnalysis<'tcx> for MaybeStorageLive<'a> {
|
||||||
body.local_decls.len()
|
body.local_decls.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn statement_effect(
|
fn statement_effect(&mut self, trans: &mut Self::Domain, stmt: &Statement<'tcx>, _: Location) {
|
||||||
&mut self,
|
|
||||||
trans: &mut impl GenKill<Self::Idx>,
|
|
||||||
stmt: &Statement<'tcx>,
|
|
||||||
_: Location,
|
|
||||||
) {
|
|
||||||
match stmt.kind {
|
match stmt.kind {
|
||||||
StatementKind::StorageLive(l) => trans.gen_(l),
|
StatementKind::StorageLive(l) => trans.gen_(l),
|
||||||
StatementKind::StorageDead(l) => trans.kill(l),
|
StatementKind::StorageDead(l) => trans.kill(l),
|
||||||
|
@ -117,12 +112,7 @@ impl<'a, 'tcx> crate::GenKillAnalysis<'tcx> for MaybeStorageDead<'a> {
|
||||||
body.local_decls.len()
|
body.local_decls.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn statement_effect(
|
fn statement_effect(&mut self, trans: &mut Self::Domain, stmt: &Statement<'tcx>, _: Location) {
|
||||||
&mut self,
|
|
||||||
trans: &mut impl GenKill<Self::Idx>,
|
|
||||||
stmt: &Statement<'tcx>,
|
|
||||||
_: Location,
|
|
||||||
) {
|
|
||||||
match stmt.kind {
|
match stmt.kind {
|
||||||
StatementKind::StorageLive(l) => trans.kill(l),
|
StatementKind::StorageLive(l) => trans.kill(l),
|
||||||
StatementKind::StorageDead(l) => trans.gen_(l),
|
StatementKind::StorageDead(l) => trans.gen_(l),
|
||||||
|
@ -192,7 +182,7 @@ impl<'tcx> crate::GenKillAnalysis<'tcx> for MaybeRequiresStorage<'_, 'tcx> {
|
||||||
|
|
||||||
fn before_statement_effect(
|
fn before_statement_effect(
|
||||||
&mut self,
|
&mut self,
|
||||||
trans: &mut impl GenKill<Self::Idx>,
|
trans: &mut Self::Domain,
|
||||||
stmt: &Statement<'tcx>,
|
stmt: &Statement<'tcx>,
|
||||||
loc: Location,
|
loc: Location,
|
||||||
) {
|
) {
|
||||||
|
@ -223,12 +213,7 @@ impl<'tcx> crate::GenKillAnalysis<'tcx> for MaybeRequiresStorage<'_, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn statement_effect(
|
fn statement_effect(&mut self, trans: &mut Self::Domain, _: &Statement<'tcx>, loc: Location) {
|
||||||
&mut self,
|
|
||||||
trans: &mut impl GenKill<Self::Idx>,
|
|
||||||
_: &Statement<'tcx>,
|
|
||||||
loc: Location,
|
|
||||||
) {
|
|
||||||
// If we move from a place then it only stops needing storage *after*
|
// If we move from a place then it only stops needing storage *after*
|
||||||
// that statement.
|
// that statement.
|
||||||
self.check_for_move(trans, loc);
|
self.check_for_move(trans, loc);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue