diff --git a/src/libcollections/borrow.rs b/src/libcollections/borrow.rs index 8f9c35783379..30286fb243c1 100644 --- a/src/libcollections/borrow.rs +++ b/src/libcollections/borrow.rs @@ -159,7 +159,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, }