diff options
| author | Marvin Löbel <loebel.marvin@gmail.com> | 2013-04-20 10:58:54 +0200 |
|---|---|---|
| committer | Marvin Löbel <loebel.marvin@gmail.com> | 2013-04-20 22:51:55 +0200 |
| commit | 4357cbf2fac1e5a0d9723c1f0f9e94c831dc397c (patch) | |
| tree | 9e3694e865467ce48d3ca65bdc1ab453f0e19a64 | |
| parent | 276293af7c0fb901c8344e88562ce635f26f47a9 (diff) | |
| download | rust-4357cbf2fac1e5a0d9723c1f0f9e94c831dc397c.tar.gz rust-4357cbf2fac1e5a0d9723c1f0f9e94c831dc397c.zip | |
Made unsafely safe functions unsafe again, for safety
| -rw-r--r-- | src/libcore/str.rs | 8 |
1 files 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; } |
