Skip to content

Commit

Permalink
analyze: remove unused PointerRange type
Browse files Browse the repository at this point in the history
  • Loading branch information
spernsteiner committed Dec 2, 2024
1 parent 555f7d4 commit 1d9e45a
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions c2rust-analyze/src/pointer_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,6 @@ impl<T> LocalPointerTable<T> {
ptr.index().wrapping_sub(self.base) < self.len() as u32
}

/// Helper for performing `contains` checks while `self` is mutably borrowed.
pub fn range(&self) -> PointerRange {
PointerRange {
base: self.base,
len: self.len() as u32,
}
}

pub fn iter(&self) -> impl Iterator<Item = (PointerId, &T)> {
let base = self.base;
self.table
Expand Down Expand Up @@ -411,22 +403,6 @@ impl<T> IndexMut<PointerId> for GlobalPointerTable<T> {
}
}

pub struct PointerRange {
base: u32,
len: u32,
}

impl PointerRange {
pub fn contains(&self, ptr: PointerId) -> bool {
// If `ptr.index() < self.base`, the subtraction will wrap to a large number in excess of
// `self.len()`.
//
// Note that `base + len` can't overflow `u32::MAX` due to checks in `LocalPointerTable`
// above.
ptr.index().wrapping_sub(self.base) < self.len
}
}

#[allow(dead_code)]
impl<'a, T> PointerTable<'a, T> {
pub fn new(
Expand Down

0 comments on commit 1d9e45a

Please sign in to comment.