Use unified dataflow framework in check_consts
This commit is contained in:
parent
7d5885727d
commit
355cfcdf43
2 changed files with 12 additions and 10 deletions
|
@ -158,7 +158,7 @@ impl<Q> old_dataflow::BottomValue for FlowSensitiveAnalysis<'_, '_, '_, Q> {
|
||||||
const BOTTOM_VALUE: bool = false;
|
const BOTTOM_VALUE: bool = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Q> dataflow::Analysis<'tcx> for FlowSensitiveAnalysis<'_, '_, 'tcx, Q>
|
impl<Q> dataflow::AnalysisDomain<'tcx> for FlowSensitiveAnalysis<'_, '_, 'tcx, Q>
|
||||||
where
|
where
|
||||||
Q: Qualif,
|
Q: Qualif,
|
||||||
{
|
{
|
||||||
|
@ -173,7 +173,12 @@ where
|
||||||
fn initialize_start_block(&self, _body: &mir::Body<'tcx>, state: &mut BitSet<Self::Idx>) {
|
fn initialize_start_block(&self, _body: &mir::Body<'tcx>, state: &mut BitSet<Self::Idx>) {
|
||||||
self.transfer_function(state).initialize_state();
|
self.transfer_function(state).initialize_state();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<Q> dataflow::Analysis<'tcx> for FlowSensitiveAnalysis<'_, '_, 'tcx, Q>
|
||||||
|
where
|
||||||
|
Q: Qualif,
|
||||||
|
{
|
||||||
fn apply_statement_effect(
|
fn apply_statement_effect(
|
||||||
&self,
|
&self,
|
||||||
state: &mut BitSet<Self::Idx>,
|
state: &mut BitSet<Self::Idx>,
|
||||||
|
|
|
@ -33,11 +33,10 @@ struct QualifCursor<'a, 'mir, 'tcx, Q: Qualif> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Q: Qualif> QualifCursor<'a, 'mir, 'tcx, Q> {
|
impl<Q: Qualif> QualifCursor<'a, 'mir, 'tcx, Q> {
|
||||||
pub fn new(q: Q, item: &'a Item<'mir, 'tcx>, dead_unwinds: &BitSet<BasicBlock>) -> Self {
|
pub fn new(q: Q, item: &'a Item<'mir, 'tcx>) -> Self {
|
||||||
let analysis = FlowSensitiveAnalysis::new(q, item);
|
let analysis = FlowSensitiveAnalysis::new(q, item);
|
||||||
let results =
|
let results = dataflow::Engine::new_generic(item.tcx, &item.body, item.def_id, analysis)
|
||||||
dataflow::Engine::new(item.tcx, &item.body, item.def_id, dead_unwinds, analysis)
|
.iterate_to_fixpoint();
|
||||||
.iterate_to_fixpoint();
|
|
||||||
let cursor = dataflow::ResultsCursor::new(*item.body, results);
|
let cursor = dataflow::ResultsCursor::new(*item.body, results);
|
||||||
|
|
||||||
let mut in_any_value_of_ty = BitSet::new_empty(item.body.local_decls.len());
|
let mut in_any_value_of_ty = BitSet::new_empty(item.body.local_decls.len());
|
||||||
|
@ -146,12 +145,10 @@ impl Deref for Validator<'_, 'mir, 'tcx> {
|
||||||
|
|
||||||
impl Validator<'a, 'mir, 'tcx> {
|
impl Validator<'a, 'mir, 'tcx> {
|
||||||
pub fn new(item: &'a Item<'mir, 'tcx>) -> Self {
|
pub fn new(item: &'a Item<'mir, 'tcx>) -> Self {
|
||||||
|
let needs_drop = QualifCursor::new(NeedsDrop, item);
|
||||||
|
let has_mut_interior = QualifCursor::new(HasMutInterior, item);
|
||||||
|
|
||||||
let dead_unwinds = BitSet::new_empty(item.body.basic_blocks().len());
|
let dead_unwinds = BitSet::new_empty(item.body.basic_blocks().len());
|
||||||
|
|
||||||
let needs_drop = QualifCursor::new(NeedsDrop, item, &dead_unwinds);
|
|
||||||
|
|
||||||
let has_mut_interior = QualifCursor::new(HasMutInterior, item, &dead_unwinds);
|
|
||||||
|
|
||||||
let indirectly_mutable = old_dataflow::do_dataflow(
|
let indirectly_mutable = old_dataflow::do_dataflow(
|
||||||
item.tcx,
|
item.tcx,
|
||||||
&*item.body,
|
&*item.body,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue