File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 771177a8142d3cb1d431c71b80f4b9b20ac35339
2
+ refs/heads/master: 041c9a0863e01f2cfa92816eaaf8ea295f851157
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5
5
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
Original file line number Diff line number Diff line change @@ -311,7 +311,11 @@ Converts a string to a vector of bytes
311
311
The result vector is not null-terminated.
312
312
" ]
313
313
fn bytes ( s : str ) -> [ u8 ] unsafe {
314
- as_bytes ( s) { |v| vec:: slice ( v, 0 u, vec:: len ( v) - 1 u) }
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;
315
319
}
316
320
317
321
#[ doc = "Convert a string to a vector of characters" ]
You can’t perform that action at this time.
0 commit comments