Use unified dataflow framework in check_consts
This commit is contained in:
parent
7d5885727d
commit
355cfcdf43
@ -158,7 +158,7 @@ impl<Q> old_dataflow::BottomValue for FlowSensitiveAnalysis<'_, '_, '_, Q> {
|
||||
const BOTTOM_VALUE: bool = false;
|
||||
}
|
||||
|
||||
impl<Q> dataflow::Analysis<'tcx> for FlowSensitiveAnalysis<'_, '_, 'tcx, Q>
|
||||
impl<Q> dataflow::AnalysisDomain<'tcx> for FlowSensitiveAnalysis<'_, '_, 'tcx, Q>
|
||||
where
|
||||
Q: Qualif,
|
||||
{
|
||||
@ -173,7 +173,12 @@ fn bits_per_block(&self, body: &mir::Body<'tcx>) -> usize {
|
||||
fn initialize_start_block(&self, _body: &mir::Body<'tcx>, state: &mut BitSet<Self::Idx>) {
|
||||
self.transfer_function(state).initialize_state();
|
||||
}
|
||||
}
|
||||
|
||||
impl<Q> dataflow::Analysis<'tcx> for FlowSensitiveAnalysis<'_, '_, 'tcx, Q>
|
||||
where
|
||||
Q: Qualif,
|
||||
{
|
||||
fn apply_statement_effect(
|
||||
&self,
|
||||
state: &mut BitSet<Self::Idx>,
|
||||
|
@ -33,11 +33,10 @@ struct QualifCursor<'a, 'mir, 'tcx, Q: Qualif> {
|
||||
}
|
||||
|
||||
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 results =
|
||||
dataflow::Engine::new(item.tcx, &item.body, item.def_id, dead_unwinds, analysis)
|
||||
.iterate_to_fixpoint();
|
||||
let results = dataflow::Engine::new_generic(item.tcx, &item.body, item.def_id, analysis)
|
||||
.iterate_to_fixpoint();
|
||||
let cursor = dataflow::ResultsCursor::new(*item.body, results);
|
||||
|
||||
let mut in_any_value_of_ty = BitSet::new_empty(item.body.local_decls.len());
|
||||
@ -146,12 +145,10 @@ fn deref(&self) -> &Self::Target {
|
||||
|
||||
impl Validator<'a, 'mir, 'tcx> {
|
||||
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 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(
|
||||
item.tcx,
|
||||
&*item.body,
|
||||
|
Loading…
Reference in New Issue
Block a user