Skip to content

Commit 13968b4

Browse files
committed
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.
1 parent e0b83c3 commit 13968b4

File tree

6 files changed

+16
-32
lines changed

6 files changed

+16
-32
lines changed

compiler/rustc_borrowck/src/dataflow.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ impl<'tcx> rustc_mir_dataflow::GenKillAnalysis<'tcx> for Borrows<'_, 'tcx> {
518518

519519
fn before_statement_effect(
520520
&mut self,
521-
trans: &mut impl GenKill<Self::Idx>,
521+
trans: &mut Self::Domain,
522522
_statement: &mir::Statement<'tcx>,
523523
location: Location,
524524
) {
@@ -527,7 +527,7 @@ impl<'tcx> rustc_mir_dataflow::GenKillAnalysis<'tcx> for Borrows<'_, 'tcx> {
527527

528528
fn statement_effect(
529529
&mut self,
530-
trans: &mut impl GenKill<Self::Idx>,
530+
trans: &mut Self::Domain,
531531
stmt: &mir::Statement<'tcx>,
532532
location: Location,
533533
) {

compiler/rustc_mir_dataflow/src/framework/mod.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -260,19 +260,18 @@ pub trait GenKillAnalysis<'tcx>: Analysis<'tcx> {
260260

261261
fn domain_size(&self, body: &mir::Body<'tcx>) -> usize;
262262

263-
/// See `Analysis::apply_statement_effect`. Note how the second arg differs.
263+
/// See `Analysis::apply_statement_effect`.
264264
fn statement_effect(
265265
&mut self,
266-
trans: &mut impl GenKill<Self::Idx>,
266+
trans: &mut Self::Domain,
267267
statement: &mir::Statement<'tcx>,
268268
location: Location,
269269
);
270270

271-
/// See `Analysis::apply_before_statement_effect`. Note how the second arg
272-
/// differs.
271+
/// See `Analysis::apply_before_statement_effect`.
273272
fn before_statement_effect(
274273
&mut self,
275-
_trans: &mut impl GenKill<Self::Idx>,
274+
_trans: &mut Self::Domain,
276275
_statement: &mir::Statement<'tcx>,
277276
_location: Location,
278277
) {

compiler/rustc_mir_dataflow/src/impls/borrowed_locals.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeBorrowedLocals {
4343

4444
fn statement_effect(
4545
&mut self,
46-
trans: &mut impl GenKill<Self::Idx>,
46+
trans: &mut Self::Domain,
4747
statement: &Statement<'tcx>,
4848
location: Location,
4949
) {

compiler/rustc_mir_dataflow/src/impls/initialized.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeInitializedPlaces<'_, 'tcx> {
338338

339339
fn statement_effect(
340340
&mut self,
341-
trans: &mut impl GenKill<Self::Idx>,
341+
trans: &mut Self::Domain,
342342
statement: &mir::Statement<'tcx>,
343343
location: Location,
344344
) {
@@ -475,7 +475,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeUninitializedPlaces<'_, 'tcx> {
475475

476476
fn statement_effect(
477477
&mut self,
478-
trans: &mut impl GenKill<Self::Idx>,
478+
trans: &mut Self::Domain,
479479
_statement: &mir::Statement<'tcx>,
480480
location: Location,
481481
) {
@@ -602,7 +602,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for DefinitelyInitializedPlaces<'_, 'tcx> {
602602

603603
fn statement_effect(
604604
&mut self,
605-
trans: &mut impl GenKill<Self::Idx>,
605+
trans: &mut Self::Domain,
606606
_statement: &mir::Statement<'tcx>,
607607
location: Location,
608608
) {
@@ -672,7 +672,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for EverInitializedPlaces<'_, 'tcx> {
672672
#[instrument(skip(self, trans), level = "debug")]
673673
fn statement_effect(
674674
&mut self,
675-
trans: &mut impl GenKill<Self::Idx>,
675+
trans: &mut Self::Domain,
676676
stmt: &mir::Statement<'tcx>,
677677
location: Location,
678678
) {

compiler/rustc_mir_dataflow/src/impls/liveness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeLiveLocals {
5050

5151
fn statement_effect(
5252
&mut self,
53-
trans: &mut impl GenKill<Self::Idx>,
53+
trans: &mut Self::Domain,
5454
statement: &mir::Statement<'tcx>,
5555
location: Location,
5656
) {

compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs

+4-19
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,7 @@ impl<'a, 'tcx> crate::GenKillAnalysis<'tcx> for MaybeStorageLive<'a> {
4646
body.local_decls.len()
4747
}
4848

49-
fn statement_effect(
50-
&mut self,
51-
trans: &mut impl GenKill<Self::Idx>,
52-
stmt: &Statement<'tcx>,
53-
_: Location,
54-
) {
49+
fn statement_effect(&mut self, trans: &mut Self::Domain, stmt: &Statement<'tcx>, _: Location) {
5550
match stmt.kind {
5651
StatementKind::StorageLive(l) => trans.gen_(l),
5752
StatementKind::StorageDead(l) => trans.kill(l),
@@ -117,12 +112,7 @@ impl<'a, 'tcx> crate::GenKillAnalysis<'tcx> for MaybeStorageDead<'a> {
117112
body.local_decls.len()
118113
}
119114

120-
fn statement_effect(
121-
&mut self,
122-
trans: &mut impl GenKill<Self::Idx>,
123-
stmt: &Statement<'tcx>,
124-
_: Location,
125-
) {
115+
fn statement_effect(&mut self, trans: &mut Self::Domain, stmt: &Statement<'tcx>, _: Location) {
126116
match stmt.kind {
127117
StatementKind::StorageLive(l) => trans.kill(l),
128118
StatementKind::StorageDead(l) => trans.gen_(l),
@@ -192,7 +182,7 @@ impl<'tcx> crate::GenKillAnalysis<'tcx> for MaybeRequiresStorage<'_, 'tcx> {
192182

193183
fn before_statement_effect(
194184
&mut self,
195-
trans: &mut impl GenKill<Self::Idx>,
185+
trans: &mut Self::Domain,
196186
stmt: &Statement<'tcx>,
197187
loc: Location,
198188
) {
@@ -223,12 +213,7 @@ impl<'tcx> crate::GenKillAnalysis<'tcx> for MaybeRequiresStorage<'_, 'tcx> {
223213
}
224214
}
225215

226-
fn statement_effect(
227-
&mut self,
228-
trans: &mut impl GenKill<Self::Idx>,
229-
_: &Statement<'tcx>,
230-
loc: Location,
231-
) {
216+
fn statement_effect(&mut self, trans: &mut Self::Domain, _: &Statement<'tcx>, loc: Location) {
232217
// If we move from a place then it only stops needing storage *after*
233218
// that statement.
234219
self.check_for_move(trans, loc);

0 commit comments

Comments
 (0)