about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libstd/str.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstd/str.rs b/src/libstd/str.rs
index 8944d0b291e..df24d8b20e2 100644
--- a/src/libstd/str.rs
+++ b/src/libstd/str.rs
@@ -1427,7 +1427,8 @@ impl<'self> StrSlice<'self> for &'self str {
     /// out of bounds.
     #[inline]
     fn slice_to(&self, end: uint) -> &'self str {
-        self.slice(0, end)
+        assert!(self.is_char_boundary(end));
+        unsafe { raw::slice_bytes(*self, 0, end) }
     }
 
     /// Returns a slice of the string from the char range