diff --git a/compiler/types/src/subs.rs b/compiler/types/src/subs.rs index 3339ecba10..caf94fdafe 100644 --- a/compiler/types/src/subs.rs +++ b/compiler/types/src/subs.rs @@ -134,6 +134,20 @@ impl std::ops::IndexMut>> for Subs { } } +impl std::ops::Index> for Subs { + type Output = VariableSubsSlice; + + fn index(&self, index: SubsIndex) -> &Self::Output { + &self.variable_slices[index.start as usize] + } +} + +impl std::ops::IndexMut> for Subs { + fn index_mut(&mut self, index: SubsIndex) -> &mut Self::Output { + &mut self.variable_slices[index.start as usize] + } +} + // custom debug impl std::fmt::Debug for SubsIndex {