Skip to content

Commit 83f67c5

Browse files
committed
Remove unused dataflow trait impls and bounds.
1 parent 0dbb31f commit 83f67c5

File tree

2 files changed

+3
-64
lines changed

2 files changed

+3
-64
lines changed

compiler/rustc_mir_dataflow/src/framework/lattice.rs

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@
3838
//! [Hasse diagram]: https://en.wikipedia.org/wiki/Hasse_diagram
3939
//! [poset]: https://en.wikipedia.org/wiki/Partially_ordered_set
4040
41-
use std::iter;
42-
41+
use rustc_index::Idx;
4342
use rustc_index::bit_set::{BitSet, MixedBitSet};
44-
use rustc_index::{Idx, IndexVec};
4543

4644
use crate::framework::BitSetExt;
4745

@@ -70,53 +68,6 @@ pub trait HasTop {
7068
const TOP: Self;
7169
}
7270

73-
/// A `bool` is a "two-point" lattice with `true` as the top element and `false` as the bottom:
74-
///
75-
/// ```text
76-
/// true
77-
/// |
78-
/// false
79-
/// ```
80-
impl JoinSemiLattice for bool {
81-
fn join(&mut self, other: &Self) -> bool {
82-
if let (false, true) = (*self, *other) {
83-
*self = true;
84-
return true;
85-
}
86-
87-
false
88-
}
89-
}
90-
91-
impl HasBottom for bool {
92-
const BOTTOM: Self = false;
93-
94-
fn is_bottom(&self) -> bool {
95-
!self
96-
}
97-
}
98-
99-
impl HasTop for bool {
100-
const TOP: Self = true;
101-
}
102-
103-
/// A tuple (or list) of lattices is itself a lattice whose least upper bound is the concatenation
104-
/// of the least upper bounds of each element of the tuple (or list).
105-
///
106-
/// In other words:
107-
/// (A₀, A₁, ..., Aₙ) ∨ (B₀, B₁, ..., Bₙ) = (A₀∨B₀, A₁∨B₁, ..., Aₙ∨Bₙ)
108-
impl<I: Idx, T: JoinSemiLattice> JoinSemiLattice for IndexVec<I, T> {
109-
fn join(&mut self, other: &Self) -> bool {
110-
assert_eq!(self.len(), other.len());
111-
112-
let mut changed = false;
113-
for (a, b) in iter::zip(self, other) {
114-
changed |= a.join(b);
115-
}
116-
changed
117-
}
118-
}
119-
12071
/// A `BitSet` represents the lattice formed by the powerset of all possible values of
12172
/// the index type `T` ordered by inclusion. Equivalently, it is a tuple of "two-point" lattices,
12273
/// one for each possible value of `T`.
@@ -197,18 +148,6 @@ impl<T> MaybeReachable<T> {
197148
}
198149
}
199150

200-
impl<T> HasBottom for MaybeReachable<T> {
201-
const BOTTOM: Self = MaybeReachable::Unreachable;
202-
203-
fn is_bottom(&self) -> bool {
204-
matches!(self, Self::Unreachable)
205-
}
206-
}
207-
208-
impl<T: HasTop> HasTop for MaybeReachable<T> {
209-
const TOP: Self = MaybeReachable::Reachable(T::TOP);
210-
}
211-
212151
impl<S> MaybeReachable<S> {
213152
/// Return whether the current state contains the given element. If the state is unreachable,
214153
/// it does no contain anything.

compiler/rustc_mir_dataflow/src/value_analysis.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<V: Clone> Clone for StateData<V> {
6767
}
6868
}
6969

70-
impl<V: JoinSemiLattice + Clone + HasBottom> JoinSemiLattice for StateData<V> {
70+
impl<V: JoinSemiLattice + Clone> JoinSemiLattice for StateData<V> {
7171
fn join(&mut self, other: &Self) -> bool {
7272
let mut changed = false;
7373
#[allow(rustc::potential_query_instability)]
@@ -342,7 +342,7 @@ impl<V: Clone + HasBottom> State<V> {
342342
}
343343
}
344344

345-
impl<V: JoinSemiLattice + Clone + HasBottom> JoinSemiLattice for State<V> {
345+
impl<V: JoinSemiLattice + Clone> JoinSemiLattice for State<V> {
346346
fn join(&mut self, other: &Self) -> bool {
347347
match (&mut *self, other) {
348348
(_, State::Unreachable) => false,

0 commit comments

Comments
 (0)