Skip to content

Commit 958a2e4

Browse files
committed
Make Analysis immutable in ResultsVisitor::visit_* methods.
This makes sense -- you wouldn't expect that visiting the results of an analysis would change the analysis itself.
1 parent 3ebe058 commit 958a2e4

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

compiler/rustc_borrowck/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ struct MirBorrowckCtxt<'a, 'infcx, 'tcx> {
790790
impl<'a, 'tcx> ResultsVisitor<'tcx, Borrowck<'a, 'tcx>> for MirBorrowckCtxt<'a, '_, 'tcx> {
791791
fn visit_after_early_statement_effect(
792792
&mut self,
793-
_analysis: &mut Borrowck<'a, 'tcx>,
793+
_analysis: &Borrowck<'a, 'tcx>,
794794
state: &BorrowckDomain,
795795
stmt: &Statement<'tcx>,
796796
location: Location,
@@ -865,7 +865,7 @@ impl<'a, 'tcx> ResultsVisitor<'tcx, Borrowck<'a, 'tcx>> for MirBorrowckCtxt<'a,
865865

866866
fn visit_after_early_terminator_effect(
867867
&mut self,
868-
_analysis: &mut Borrowck<'a, 'tcx>,
868+
_analysis: &Borrowck<'a, 'tcx>,
869869
state: &BorrowckDomain,
870870
term: &Terminator<'tcx>,
871871
loc: Location,
@@ -985,7 +985,7 @@ impl<'a, 'tcx> ResultsVisitor<'tcx, Borrowck<'a, 'tcx>> for MirBorrowckCtxt<'a,
985985

986986
fn visit_after_primary_terminator_effect(
987987
&mut self,
988-
_analysis: &mut Borrowck<'a, 'tcx>,
988+
_analysis: &Borrowck<'a, 'tcx>,
989989
state: &BorrowckDomain,
990990
term: &Terminator<'tcx>,
991991
loc: Location,

compiler/rustc_mir_dataflow/src/framework/graphviz.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ where
736736

737737
fn visit_after_early_statement_effect(
738738
&mut self,
739-
analysis: &mut A,
739+
analysis: &A,
740740
state: &A::Domain,
741741
_statement: &mir::Statement<'tcx>,
742742
_location: Location,
@@ -749,7 +749,7 @@ where
749749

750750
fn visit_after_primary_statement_effect(
751751
&mut self,
752-
analysis: &mut A,
752+
analysis: &A,
753753
state: &A::Domain,
754754
_statement: &mir::Statement<'tcx>,
755755
_location: Location,
@@ -760,7 +760,7 @@ where
760760

761761
fn visit_after_early_terminator_effect(
762762
&mut self,
763-
analysis: &mut A,
763+
analysis: &A,
764764
state: &A::Domain,
765765
_terminator: &mir::Terminator<'tcx>,
766766
_location: Location,
@@ -773,7 +773,7 @@ where
773773

774774
fn visit_after_primary_terminator_effect(
775775
&mut self,
776-
analysis: &mut A,
776+
analysis: &A,
777777
state: &A::Domain,
778778
_terminator: &mir::Terminator<'tcx>,
779779
_location: Location,

compiler/rustc_mir_dataflow/src/framework/visitor.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ where
5353
/// Called after the "early" effect of the given statement is applied to `state`.
5454
fn visit_after_early_statement_effect(
5555
&mut self,
56-
_analysis: &mut A,
56+
_analysis: &A,
5757
_state: &A::Domain,
5858
_statement: &mir::Statement<'tcx>,
5959
_location: Location,
@@ -63,7 +63,7 @@ where
6363
/// Called after the "primary" effect of the given statement is applied to `state`.
6464
fn visit_after_primary_statement_effect(
6565
&mut self,
66-
_analysis: &mut A,
66+
_analysis: &A,
6767
_state: &A::Domain,
6868
_statement: &mir::Statement<'tcx>,
6969
_location: Location,
@@ -73,7 +73,7 @@ where
7373
/// Called after the "early" effect of the given terminator is applied to `state`.
7474
fn visit_after_early_terminator_effect(
7575
&mut self,
76-
_analysis: &mut A,
76+
_analysis: &A,
7777
_state: &A::Domain,
7878
_terminator: &mir::Terminator<'tcx>,
7979
_location: Location,
@@ -85,7 +85,7 @@ where
8585
/// The `call_return_effect` (if one exists) will *not* be applied to `state`.
8686
fn visit_after_primary_terminator_effect(
8787
&mut self,
88-
_analysis: &mut A,
88+
_analysis: &A,
8989
_state: &A::Domain,
9090
_terminator: &mir::Terminator<'tcx>,
9191
_location: Location,

compiler/rustc_mir_transform/src/coroutine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ impl<'a, 'tcx> ResultsVisitor<'tcx, MaybeRequiresStorage<'a, 'tcx>>
942942
{
943943
fn visit_after_early_statement_effect(
944944
&mut self,
945-
_analysis: &mut MaybeRequiresStorage<'a, 'tcx>,
945+
_analysis: &MaybeRequiresStorage<'a, 'tcx>,
946946
state: &DenseBitSet<Local>,
947947
_statement: &Statement<'tcx>,
948948
loc: Location,
@@ -952,7 +952,7 @@ impl<'a, 'tcx> ResultsVisitor<'tcx, MaybeRequiresStorage<'a, 'tcx>>
952952

953953
fn visit_after_early_terminator_effect(
954954
&mut self,
955-
_analysis: &mut MaybeRequiresStorage<'a, 'tcx>,
955+
_analysis: &MaybeRequiresStorage<'a, 'tcx>,
956956
state: &DenseBitSet<Local>,
957957
_terminator: &Terminator<'tcx>,
958958
loc: Location,

compiler/rustc_mir_transform/src/dataflow_const_prop.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ impl<'tcx> ResultsVisitor<'tcx, ConstAnalysis<'_, 'tcx>> for Collector<'_, 'tcx>
964964
#[instrument(level = "trace", skip(self, analysis, statement))]
965965
fn visit_after_early_statement_effect(
966966
&mut self,
967-
analysis: &mut ConstAnalysis<'_, 'tcx>,
967+
analysis: &ConstAnalysis<'_, 'tcx>,
968968
state: &State<FlatSet<Scalar>>,
969969
statement: &Statement<'tcx>,
970970
location: Location,
@@ -986,7 +986,7 @@ impl<'tcx> ResultsVisitor<'tcx, ConstAnalysis<'_, 'tcx>> for Collector<'_, 'tcx>
986986
#[instrument(level = "trace", skip(self, analysis, statement))]
987987
fn visit_after_primary_statement_effect(
988988
&mut self,
989-
analysis: &mut ConstAnalysis<'_, 'tcx>,
989+
analysis: &ConstAnalysis<'_, 'tcx>,
990990
state: &State<FlatSet<Scalar>>,
991991
statement: &Statement<'tcx>,
992992
location: Location,
@@ -1011,7 +1011,7 @@ impl<'tcx> ResultsVisitor<'tcx, ConstAnalysis<'_, 'tcx>> for Collector<'_, 'tcx>
10111011

10121012
fn visit_after_early_terminator_effect(
10131013
&mut self,
1014-
analysis: &mut ConstAnalysis<'_, 'tcx>,
1014+
analysis: &ConstAnalysis<'_, 'tcx>,
10151015
state: &State<FlatSet<Scalar>>,
10161016
terminator: &Terminator<'tcx>,
10171017
location: Location,

0 commit comments

Comments
 (0)