summary refs log tree commit diff
path: root/src/libcore/str.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcore/str.rs')
-rw-r--r--src/libcore/str.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index f1605309fb4..8d15d6afbda 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -301,7 +301,11 @@ pub fn slice_shift_char<'a>(s: &'a str) -> (char, &'a str) {
 
 /// Prepend a char to a string
 pub fn unshift_char(s: &mut ~str, ch: char) {
-    *s = from_char(ch) + *s;
+    // This could be more efficient.
+    let mut new_str = ~"";
+    new_str.push_char(ch);
+    new_str.push_str(*s);
+    *s = new_str;
 }
 
 /**