mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
Remove CloneAnalysis
.
It's only implemented for analyses that implement `Copy`, which means it's basically a complicated synonym for `Copy`. So this commit removes it and uses `Copy` directly. (That direct use will be removed in a later commit.)
This commit is contained in:
parent
389e2cc69a
commit
d957c47183
@ -24,9 +24,8 @@ use rustc_span::symbol::{sym, Symbol};
|
||||
use super::fmt::DebugWithContext;
|
||||
use super::graphviz;
|
||||
use super::{
|
||||
visit_results, Analysis, AnalysisDomain, CloneAnalysis, Direction, GenKill, GenKillAnalysis,
|
||||
GenKillSet, JoinSemiLattice, ResultsClonedCursor, ResultsCursor, ResultsRefCursor,
|
||||
ResultsVisitor,
|
||||
visit_results, Analysis, AnalysisDomain, Direction, GenKill, GenKillAnalysis, GenKillSet,
|
||||
JoinSemiLattice, ResultsClonedCursor, ResultsCursor, ResultsRefCursor, ResultsVisitor,
|
||||
};
|
||||
|
||||
pub type EntrySets<'tcx, A> = IndexVec<BasicBlock, <A as AnalysisDomain<'tcx>>::Domain>;
|
||||
@ -96,23 +95,15 @@ where
|
||||
|
||||
impl<'tcx, A> Results<'tcx, A>
|
||||
where
|
||||
A: Analysis<'tcx> + CloneAnalysis,
|
||||
A: Analysis<'tcx> + Copy,
|
||||
{
|
||||
/// Creates a new `Results` type with a cloned `Analysis` and borrowed entry sets.
|
||||
pub fn clone_analysis(&self) -> ResultsCloned<'_, 'tcx, A> {
|
||||
Results {
|
||||
analysis: self.analysis.clone_analysis(),
|
||||
entry_sets: &self.entry_sets,
|
||||
_marker: PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a `ResultsCursor` that can inspect these `Results`.
|
||||
pub fn cloned_results_cursor<'mir>(
|
||||
&self,
|
||||
body: &'mir mir::Body<'tcx>,
|
||||
) -> ResultsClonedCursor<'_, 'mir, 'tcx, A> {
|
||||
self.clone_analysis().into_results_cursor(body)
|
||||
Results { analysis: self.analysis, entry_sets: &self.entry_sets, _marker: PhantomData }
|
||||
.into_results_cursor(body)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -246,21 +246,6 @@ pub trait Analysis<'tcx>: AnalysisDomain<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Defines an `Analysis` which can be cloned for use in multiple `ResultsCursor`s or
|
||||
/// `ResultsVisitor`s. Note this need not be a full clone, only enough of one to be used with a new
|
||||
/// `ResultsCursor` or `ResultsVisitor`
|
||||
pub trait CloneAnalysis {
|
||||
fn clone_analysis(&self) -> Self;
|
||||
}
|
||||
impl<'tcx, A> CloneAnalysis for A
|
||||
where
|
||||
A: Analysis<'tcx> + Copy,
|
||||
{
|
||||
fn clone_analysis(&self) -> Self {
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
||||
/// A gen/kill dataflow problem.
|
||||
///
|
||||
/// Each method in this trait has a corresponding one in `Analysis`. However, these methods only
|
||||
|
Loading…
Reference in New Issue
Block a user