From e9946f99b97fa1efda39b657448aae0238b66220 Mon Sep 17 00:00:00 2001 From: Andrew Paseltiner Date: Wed, 23 Sep 2015 08:49:50 -0400 Subject: Override `clone_from` for `{BinaryHeap, String}` CC #28481 --- src/libcollections/string.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/libcollections/string.rs') diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index bb65d7469ab..ba921fed68b 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -30,7 +30,7 @@ use vec::Vec; use boxed::Box; /// A growable string stored as a UTF-8 encoded buffer. -#[derive(Clone, PartialOrd, Eq, Ord)] +#[derive(PartialOrd, Eq, Ord)] #[stable(feature = "rust1", since = "1.0.0")] pub struct String { vec: Vec, @@ -765,6 +765,17 @@ impl fmt::Display for FromUtf16Error { } } +#[stable(feature = "rust1", since = "1.0.0")] +impl Clone for String { + fn clone(&self) -> Self { + String { vec: self.vec.clone() } + } + + fn clone_from(&mut self, source: &Self) { + self.vec.clone_from(&source.vec); + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl FromIterator for String { fn from_iter>(iterable: I) -> String { -- cgit 1.4.1-3-g733a5