Remove unused dataflow trait impls and bounds.
This commit is contained in:
parent
0dbb31f7e7
commit
83f67c5915
2 changed files with 3 additions and 64 deletions
|
@ -38,10 +38,8 @@
|
||||||
//! [Hasse diagram]: https://en.wikipedia.org/wiki/Hasse_diagram
|
//! [Hasse diagram]: https://en.wikipedia.org/wiki/Hasse_diagram
|
||||||
//! [poset]: https://en.wikipedia.org/wiki/Partially_ordered_set
|
//! [poset]: https://en.wikipedia.org/wiki/Partially_ordered_set
|
||||||
|
|
||||||
use std::iter;
|
use rustc_index::Idx;
|
||||||
|
|
||||||
use rustc_index::bit_set::{BitSet, MixedBitSet};
|
use rustc_index::bit_set::{BitSet, MixedBitSet};
|
||||||
use rustc_index::{Idx, IndexVec};
|
|
||||||
|
|
||||||
use crate::framework::BitSetExt;
|
use crate::framework::BitSetExt;
|
||||||
|
|
||||||
|
@ -70,53 +68,6 @@ pub trait HasTop {
|
||||||
const TOP: Self;
|
const TOP: Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A `bool` is a "two-point" lattice with `true` as the top element and `false` as the bottom:
|
|
||||||
///
|
|
||||||
/// ```text
|
|
||||||
/// true
|
|
||||||
/// |
|
|
||||||
/// false
|
|
||||||
/// ```
|
|
||||||
impl JoinSemiLattice for bool {
|
|
||||||
fn join(&mut self, other: &Self) -> bool {
|
|
||||||
if let (false, true) = (*self, *other) {
|
|
||||||
*self = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl HasBottom for bool {
|
|
||||||
const BOTTOM: Self = false;
|
|
||||||
|
|
||||||
fn is_bottom(&self) -> bool {
|
|
||||||
!self
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl HasTop for bool {
|
|
||||||
const TOP: Self = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A tuple (or list) of lattices is itself a lattice whose least upper bound is the concatenation
|
|
||||||
/// of the least upper bounds of each element of the tuple (or list).
|
|
||||||
///
|
|
||||||
/// In other words:
|
|
||||||
/// (A₀, A₁, ..., Aₙ) ∨ (B₀, B₁, ..., Bₙ) = (A₀∨B₀, A₁∨B₁, ..., Aₙ∨Bₙ)
|
|
||||||
impl<I: Idx, T: JoinSemiLattice> JoinSemiLattice for IndexVec<I, T> {
|
|
||||||
fn join(&mut self, other: &Self) -> bool {
|
|
||||||
assert_eq!(self.len(), other.len());
|
|
||||||
|
|
||||||
let mut changed = false;
|
|
||||||
for (a, b) in iter::zip(self, other) {
|
|
||||||
changed |= a.join(b);
|
|
||||||
}
|
|
||||||
changed
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A `BitSet` represents the lattice formed by the powerset of all possible values of
|
/// A `BitSet` represents the lattice formed by the powerset of all possible values of
|
||||||
/// the index type `T` ordered by inclusion. Equivalently, it is a tuple of "two-point" lattices,
|
/// the index type `T` ordered by inclusion. Equivalently, it is a tuple of "two-point" lattices,
|
||||||
/// one for each possible value of `T`.
|
/// one for each possible value of `T`.
|
||||||
|
@ -197,18 +148,6 @@ impl<T> MaybeReachable<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> HasBottom for MaybeReachable<T> {
|
|
||||||
const BOTTOM: Self = MaybeReachable::Unreachable;
|
|
||||||
|
|
||||||
fn is_bottom(&self) -> bool {
|
|
||||||
matches!(self, Self::Unreachable)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: HasTop> HasTop for MaybeReachable<T> {
|
|
||||||
const TOP: Self = MaybeReachable::Reachable(T::TOP);
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<S> MaybeReachable<S> {
|
impl<S> MaybeReachable<S> {
|
||||||
/// Return whether the current state contains the given element. If the state is unreachable,
|
/// Return whether the current state contains the given element. If the state is unreachable,
|
||||||
/// it does no contain anything.
|
/// it does no contain anything.
|
||||||
|
|
|
@ -67,7 +67,7 @@ impl<V: Clone> Clone for StateData<V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<V: JoinSemiLattice + Clone + HasBottom> JoinSemiLattice for StateData<V> {
|
impl<V: JoinSemiLattice + Clone> JoinSemiLattice for StateData<V> {
|
||||||
fn join(&mut self, other: &Self) -> bool {
|
fn join(&mut self, other: &Self) -> bool {
|
||||||
let mut changed = false;
|
let mut changed = false;
|
||||||
#[allow(rustc::potential_query_instability)]
|
#[allow(rustc::potential_query_instability)]
|
||||||
|
@ -342,7 +342,7 @@ impl<V: Clone + HasBottom> State<V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<V: JoinSemiLattice + Clone + HasBottom> JoinSemiLattice for State<V> {
|
impl<V: JoinSemiLattice + Clone> JoinSemiLattice for State<V> {
|
||||||
fn join(&mut self, other: &Self) -> bool {
|
fn join(&mut self, other: &Self) -> bool {
|
||||||
match (&mut *self, other) {
|
match (&mut *self, other) {
|
||||||
(_, State::Unreachable) => false,
|
(_, State::Unreachable) => false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue