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.
This commit is contained in:
Nicholas Nethercote 2025-10-27 15:11:10 +11:00
parent 3ebe058fad
commit 958a2e4a3d
5 changed files with 16 additions and 16 deletions

View file

@ -790,7 +790,7 @@ struct MirBorrowckCtxt<'a, 'infcx, 'tcx> {
impl<'a, 'tcx> ResultsVisitor<'tcx, Borrowck<'a, 'tcx>> for MirBorrowckCtxt<'a, '_, 'tcx> {
fn visit_after_early_statement_effect(
&mut self,
_analysis: &mut Borrowck<'a, 'tcx>,
_analysis: &Borrowck<'a, 'tcx>,
state: &BorrowckDomain,
stmt: &Statement<'tcx>,
location: Location,
@ -865,7 +865,7 @@ impl<'a, 'tcx> ResultsVisitor<'tcx, Borrowck<'a, 'tcx>> for MirBorrowckCtxt<'a,
fn visit_after_early_terminator_effect(
&mut self,
_analysis: &mut Borrowck<'a, 'tcx>,
_analysis: &Borrowck<'a, 'tcx>,
state: &BorrowckDomain,
term: &Terminator<'tcx>,
loc: Location,
@ -985,7 +985,7 @@ impl<'a, 'tcx> ResultsVisitor<'tcx, Borrowck<'a, 'tcx>> for MirBorrowckCtxt<'a,
fn visit_after_primary_terminator_effect(
&mut self,
_analysis: &mut Borrowck<'a, 'tcx>,
_analysis: &Borrowck<'a, 'tcx>,
state: &BorrowckDomain,
term: &Terminator<'tcx>,
loc: Location,

View file

@ -736,7 +736,7 @@ where
fn visit_after_early_statement_effect(
&mut self,
analysis: &mut A,
analysis: &A,
state: &A::Domain,
_statement: &mir::Statement<'tcx>,
_location: Location,
@ -749,7 +749,7 @@ where
fn visit_after_primary_statement_effect(
&mut self,
analysis: &mut A,
analysis: &A,
state: &A::Domain,
_statement: &mir::Statement<'tcx>,
_location: Location,
@ -760,7 +760,7 @@ where
fn visit_after_early_terminator_effect(
&mut self,
analysis: &mut A,
analysis: &A,
state: &A::Domain,
_terminator: &mir::Terminator<'tcx>,
_location: Location,
@ -773,7 +773,7 @@ where
fn visit_after_primary_terminator_effect(
&mut self,
analysis: &mut A,
analysis: &A,
state: &A::Domain,
_terminator: &mir::Terminator<'tcx>,
_location: Location,

View file

@ -53,7 +53,7 @@ where
/// Called after the "early" effect of the given statement is applied to `state`.
fn visit_after_early_statement_effect(
&mut self,
_analysis: &mut A,
_analysis: &A,
_state: &A::Domain,
_statement: &mir::Statement<'tcx>,
_location: Location,
@ -63,7 +63,7 @@ where
/// Called after the "primary" effect of the given statement is applied to `state`.
fn visit_after_primary_statement_effect(
&mut self,
_analysis: &mut A,
_analysis: &A,
_state: &A::Domain,
_statement: &mir::Statement<'tcx>,
_location: Location,
@ -73,7 +73,7 @@ where
/// Called after the "early" effect of the given terminator is applied to `state`.
fn visit_after_early_terminator_effect(
&mut self,
_analysis: &mut A,
_analysis: &A,
_state: &A::Domain,
_terminator: &mir::Terminator<'tcx>,
_location: Location,
@ -85,7 +85,7 @@ where
/// The `call_return_effect` (if one exists) will *not* be applied to `state`.
fn visit_after_primary_terminator_effect(
&mut self,
_analysis: &mut A,
_analysis: &A,
_state: &A::Domain,
_terminator: &mir::Terminator<'tcx>,
_location: Location,

View file

@ -942,7 +942,7 @@ impl<'a, 'tcx> ResultsVisitor<'tcx, MaybeRequiresStorage<'a, 'tcx>>
{
fn visit_after_early_statement_effect(
&mut self,
_analysis: &mut MaybeRequiresStorage<'a, 'tcx>,
_analysis: &MaybeRequiresStorage<'a, 'tcx>,
state: &DenseBitSet<Local>,
_statement: &Statement<'tcx>,
loc: Location,
@ -952,7 +952,7 @@ impl<'a, 'tcx> ResultsVisitor<'tcx, MaybeRequiresStorage<'a, 'tcx>>
fn visit_after_early_terminator_effect(
&mut self,
_analysis: &mut MaybeRequiresStorage<'a, 'tcx>,
_analysis: &MaybeRequiresStorage<'a, 'tcx>,
state: &DenseBitSet<Local>,
_terminator: &Terminator<'tcx>,
loc: Location,

View file

@ -964,7 +964,7 @@ impl<'tcx> ResultsVisitor<'tcx, ConstAnalysis<'_, 'tcx>> for Collector<'_, 'tcx>
#[instrument(level = "trace", skip(self, analysis, statement))]
fn visit_after_early_statement_effect(
&mut self,
analysis: &mut ConstAnalysis<'_, 'tcx>,
analysis: &ConstAnalysis<'_, 'tcx>,
state: &State<FlatSet<Scalar>>,
statement: &Statement<'tcx>,
location: Location,
@ -986,7 +986,7 @@ impl<'tcx> ResultsVisitor<'tcx, ConstAnalysis<'_, 'tcx>> for Collector<'_, 'tcx>
#[instrument(level = "trace", skip(self, analysis, statement))]
fn visit_after_primary_statement_effect(
&mut self,
analysis: &mut ConstAnalysis<'_, 'tcx>,
analysis: &ConstAnalysis<'_, 'tcx>,
state: &State<FlatSet<Scalar>>,
statement: &Statement<'tcx>,
location: Location,
@ -1011,7 +1011,7 @@ impl<'tcx> ResultsVisitor<'tcx, ConstAnalysis<'_, 'tcx>> for Collector<'_, 'tcx>
fn visit_after_early_terminator_effect(
&mut self,
analysis: &mut ConstAnalysis<'_, 'tcx>,
analysis: &ConstAnalysis<'_, 'tcx>,
state: &State<FlatSet<Scalar>>,
terminator: &Terminator<'tcx>,
location: Location,