diff --git a/src/libcollections/borrow.rs b/src/libcollections/borrow.rs index 3bc2a3f8f68b7..37618b7600a04 100644 --- a/src/libcollections/borrow.rs +++ b/src/libcollections/borrow.rs @@ -160,7 +160,10 @@ impl<'a, B: ?Sized> Cow<'a, B> where B: ToOwned { match *self { Borrowed(borrowed) => { *self = Owned(borrowed.to_owned()); - self.to_mut() + match *self { + Borrowed(..) => unreachable!(), + Owned(ref mut owned) => owned, + } } Owned(ref mut owned) => owned, }