From 4357cbf2fac1e5a0d9723c1f0f9e94c831dc397c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20L=C3=B6bel?= Date: Sat, 20 Apr 2013 10:58:54 +0200 Subject: [PATCH] Made unsafely safe functions unsafe again, for safety --- src/libcore/str.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcore/str.rs b/src/libcore/str.rs index cbdd1451953..2296fea0454 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -2319,20 +2319,20 @@ pub mod raw { } /// Removes the last byte from a string and returns it. (Not UTF-8 safe). - pub fn pop_byte(s: &mut ~str) -> u8 { + pub unsafe fn pop_byte(s: &mut ~str) -> u8 { let len = len(*s); assert!((len > 0u)); let b = s[len - 1u]; - unsafe { set_len(s, len - 1u) }; + set_len(s, len - 1u); return b; } /// Removes the first byte from a string and returns it. (Not UTF-8 safe). - pub fn shift_byte(s: &mut ~str) -> u8 { + pub unsafe fn shift_byte(s: &mut ~str) -> u8 { let len = len(*s); assert!((len > 0u)); let b = s[0]; - *s = unsafe { raw::slice_bytes_owned(*s, 1u, len) }; + *s = raw::slice_bytes_owned(*s, 1u, len); return b; }