Skip to content

Commit 387be5f

Browse files
committed
---
yaml --- r: 11899 b: refs/heads/master c: 041c9a0 h: refs/heads/master i: 11897: d87f23a 11895: a054e68 v: v3
1 parent f423010 commit 387be5f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 771177a8142d3cb1d431c71b80f4b9b20ac35339
2+
refs/heads/master: 041c9a0863e01f2cfa92816eaaf8ea295f851157
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/libcore/str.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,11 @@ Converts a string to a vector of bytes
311311
The result vector is not null-terminated.
312312
"]
313313
fn bytes(s: str) -> [u8] unsafe {
314-
as_bytes(s) { |v| vec::slice(v, 0u, vec::len(v) - 1u) }
314+
let mut s_copy = s;
315+
let mut v: [u8] = ::unsafe::reinterpret_cast(s_copy);
316+
::unsafe::leak(s_copy);
317+
vec::unsafe::set_len(v, len(s));
318+
ret v;
315319
}
316320

317321
#[doc = "Convert a string to a vector of characters"]

0 commit comments

Comments
 (0)