Skip to content

Commit 5b3701e

Browse files
committed
---
yaml --- r: 63275 b: refs/heads/snap-stage3 c: e650399 h: refs/heads/master i: 63273: 2e75ae1 63271: d623075 v: v3
1 parent fb259d8 commit 5b3701e

File tree

4 files changed

+23
-18
lines changed

4 files changed

+23
-18
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 9355330c1e8fa376ffb5ebee4aebed2c318d37d6
4+
refs/heads/snap-stage3: e6503995abafd30175fdf490a4c38f5187d64931
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libstd/str.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,18 +1953,6 @@ impl NullTerminatedStr for @str {
19531953
slice
19541954
}
19551955
}
1956-
// static strings are the only slices guaranteed to a nul-terminator
1957-
impl NullTerminatedStr for &'static str {
1958-
/**
1959-
* Work with the byte buffer of a string as a byte slice.
1960-
*
1961-
* The byte slice does include the null terminator.
1962-
*/
1963-
#[inline]
1964-
fn as_bytes_with_null(&self) -> &'static [u8] {
1965-
unsafe { ::cast::transmute(*self) }
1966-
}
1967-
}
19681956
19691957
#[allow(missing_doc)]
19701958
pub trait OwnedStr {
@@ -2925,10 +2913,6 @@ mod tests {
29252913
109, 0
29262914
];
29272915
2928-
assert_eq!("".as_bytes_with_null(), &[0]);
2929-
assert_eq!("abc".as_bytes_with_null(), &['a' as u8, 'b' as u8, 'c' as u8, 0]);
2930-
assert_eq!("ศไทย中华Việt Nam".as_bytes_with_null(), v);
2931-
29322916
let s1 = @"";
29332917
let s2 = @"abc";
29342918
let s3 = @"ศไทย中华Việt Nam";

branches/snap-stage3/src/test/bench/shootout-fasta-redux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl RepeatFasta {
9393
let stdout = self.stdout;
9494
let alu_len = self.alu.len();
9595
let mut buf = vec::from_elem(alu_len + LINE_LEN, 0u8);
96-
let alu: &[u8] = self.alu.as_bytes_with_null();
96+
let alu: &[u8] = self.alu.as_bytes();
9797

9898
copy_memory(buf, alu, alu_len);
9999
copy_memory(vec::mut_slice(buf, alu_len, buf.len()),
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
let _ = (~"foo").as_bytes_with_null();
13+
let _ = (@"foo").as_bytes_with_null();
14+
15+
// a plain static slice is null terminated, but such a slice can
16+
// be sliced shorter (i.e. become non-null terminated) and still
17+
// have the static lifetime
18+
let foo: &'static str = "foo";
19+
let _ = foo.as_bytes_with_null();
20+
//~^ ERROR does not implement any method in scope named `as_bytes_with_null`
21+
}

0 commit comments

Comments
 (0)