about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-06-12 23:10:15 -0700
committerbors <bors@rust-lang.org>2013-06-12 23:10:15 -0700
commite6503995abafd30175fdf490a4c38f5187d64931 (patch)
tree040dda7a184cf48b8a42b8a381f3b86d96103bf9 /src/libstd
parent9355330c1e8fa376ffb5ebee4aebed2c318d37d6 (diff)
parentabadece3ba2dba032fa7752e88fcf58289c240ac (diff)
downloadrust-e6503995abafd30175fdf490a4c38f5187d64931.tar.gz
rust-e6503995abafd30175fdf490a4c38f5187d64931.zip
auto merge of #7096 : huonw/rust/invalid-null-str, r=thestinger
A slice of a 'static str is still 'static, but doesn't necessarily
have the null terminator.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/str.rs16
1 files changed, 0 insertions, 16 deletions
diff --git a/src/libstd/str.rs b/src/libstd/str.rs
index c928933f4a7..164c57d9645 100644
--- a/src/libstd/str.rs
+++ b/src/libstd/str.rs
@@ -1953,18 +1953,6 @@ impl NullTerminatedStr for @str {
         slice
     }
 }
-// static strings are the only slices guaranteed to a nul-terminator
-impl NullTerminatedStr for &'static str {
-    /**
-     * Work with the byte buffer of a string as a byte slice.
-     *
-     * The byte slice does include the null terminator.
-     */
-    #[inline]
-    fn as_bytes_with_null(&self) -> &'static [u8] {
-        unsafe { ::cast::transmute(*self) }
-    }
-}
 
 #[allow(missing_doc)]
 pub trait OwnedStr {
@@ -2925,10 +2913,6 @@ mod tests {
             109, 0
         ];
 
-        assert_eq!("".as_bytes_with_null(), &[0]);
-        assert_eq!("abc".as_bytes_with_null(), &['a' as u8, 'b' as u8, 'c' as u8, 0]);
-        assert_eq!("ศไทย中华Việt Nam".as_bytes_with_null(), v);
-
         let s1 = @"";
         let s2 = @"abc";
         let s3 = @"ศไทย中华Việt Nam";