diff --git a/src/ena/unify/backing_vec.rs b/src/ena/unify/backing_vec.rs index 2a07444ae3..0430336c4a 100644 --- a/src/ena/unify/backing_vec.rs +++ b/src/ena/unify/backing_vec.rs @@ -29,7 +29,7 @@ pub trait UnificationStore: fn values_since_snapshot(&self, snapshot: &Self::Snapshot) -> Range; - fn reset_unifications(&mut self, value: impl FnMut(u32) -> VarValue); + fn reset_unifications(&mut self, value: impl FnMut(usize) -> VarValue); fn len(&self) -> usize; @@ -90,8 +90,8 @@ impl UnificationStore for InPlace { } #[inline] - fn reset_unifications(&mut self, mut value: impl FnMut(u32) -> VarValue) { - self.values.set_all(|i| value(i as u32)); + fn reset_unifications(&mut self, mut value: impl FnMut(usize) -> VarValue) { + self.values.set_all(|i| value(i)); } fn len(&self) -> usize { @@ -182,12 +182,12 @@ impl UnificationStore for Persistent { } #[inline] - fn reset_unifications(&mut self, mut value: impl FnMut(u32) -> VarValue) { + fn reset_unifications(&mut self, mut value: impl FnMut(usize) -> VarValue) { // Without extending dogged, there isn't obviously a more // efficient way to do this. But it's pretty dumb. Maybe // dogged needs a `map`. [NOTE: revisit in light of replacing dogged with im_rc!] for i in 0..self.values.len() { - self.values[i] = value(i as u32); + self.values[i] = value(i); } } diff --git a/src/ena/unify/mod.rs b/src/ena/unify/mod.rs index 4455e4f794..f87d56e04b 100644 --- a/src/ena/unify/mod.rs +++ b/src/ena/unify/mod.rs @@ -55,9 +55,9 @@ pub use self::backing_vec::Persistent; pub trait UnifyKey: Copy + Clone + Debug + PartialEq { type Value: Clone + Debug; - fn index(&self) -> u32; + fn index(&self) -> usize; - fn from_index(u: u32) -> Self; + fn from_index(u: usize) -> Self; fn tag() -> &'static str; @@ -215,7 +215,7 @@ impl UnificationTable { /// Creates a fresh key with the given value. pub fn new_key(&mut self, value: S::Value) -> S::Key { let len = self.values.len(); - let key: S::Key = UnifyKey::from_index(len as u32); + let key: S::Key = UnifyKey::from_index(len); self.values.push(VarValue::new_var(key, value)); debug!("{}: created new key: {:?}", S::tag(), key); key @@ -232,7 +232,7 @@ impl UnificationTable { /// the closure. pub fn reset_unifications(&mut self, mut value: impl FnMut(S::Key) -> S::Value) { self.values.reset_unifications(|i| { - let key = UnifyKey::from_index(i as u32); + let key = UnifyKey::from_index(i); let value = value(key); VarValue::new_var(key, value) }); @@ -251,7 +251,7 @@ impl UnificationTable { /// Returns the keys of all variables created since the `snapshot`. pub fn vars_since_snapshot(&self, snapshot: &Snapshot) -> Range { let range = self.values.values_since_snapshot(&snapshot.snapshot); - S::Key::from_index(range.start as u32)..S::Key::from_index(range.end as u32) + S::Key::from_index(range.start)..S::Key::from_index(range.end) } /// Obtains the current value for a particular key. diff --git a/src/subs.rs b/src/subs.rs index 9838395df2..88b4ca537c 100644 --- a/src/subs.rs +++ b/src/subs.rs @@ -9,10 +9,10 @@ pub struct Subs { } #[derive(Copy, PartialEq, Eq, Clone, Hash)] -pub struct Variable(u32); +pub struct Variable(usize); impl Variable { - pub fn new_for_testing_only(num: u32) -> Self { + pub fn new_for_testing_only(num: usize) -> Self { // This is a hack that should only ever be used for testing! Variable(num) } @@ -27,11 +27,11 @@ impl fmt::Debug for Variable { impl UnifyKey for Variable { type Value = Descriptor; - fn index(&self) -> u32 { + fn index(&self) -> usize { self.0 } - fn from_index(index: u32) -> Self { + fn from_index(index: usize) -> Self { Variable(index) }