diff --git a/src/librustc_data_structures/indexed_set.rs b/src/librustc_data_structures/indexed_set.rs index 5d7139507b33..223e08de826c 100644 --- a/src/librustc_data_structures/indexed_set.rs +++ b/src/librustc_data_structures/indexed_set.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::borrow::{Borrow, BorrowMut, ToOwned}; use std::fmt; use std::iter; use std::marker::PhantomData; @@ -73,6 +74,25 @@ pub struct IdxSet { bits: [Word], } +impl Borrow> for IdxSetBuf { + fn borrow(&self) -> &IdxSet { + &*self + } +} + +impl BorrowMut> for IdxSetBuf { + fn borrow_mut(&mut self) -> &mut IdxSet { + &mut *self + } +} + +impl ToOwned for IdxSet { + type Owned = IdxSetBuf; + fn to_owned(&self) -> Self::Owned { + IdxSet::to_owned(self) + } +} + impl fmt::Debug for IdxSetBuf { fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result { w.debug_list()