Skip to content

Commit

Permalink
auto merge of rust-lang#6488 : sammykim/rust/issue-6430, r=sanxiyn
Browse files Browse the repository at this point in the history
Fix issue rust-lang#6430.
  • Loading branch information
bors committed May 16, 2013
2 parents 62caa1e + f097f43 commit 92b7a45
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/libcore/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2546,23 +2546,29 @@ pub mod raw {
* would also make any pointers to it invalid.
*/
#[inline(always)]
pub unsafe fn to_ptr<T>(v: &[T]) -> *T {
let repr: **SliceRepr = transmute(&v);
transmute(&((**repr).data))
pub fn to_ptr<T>(v: &[T]) -> *T {
unsafe {
let repr: **SliceRepr = transmute(&v);
transmute(&((**repr).data))
}
}

/** see `to_ptr()` */
#[inline(always)]
pub unsafe fn to_const_ptr<T>(v: &const [T]) -> *const T {
let repr: **SliceRepr = transmute(&v);
transmute(&((**repr).data))
pub fn to_const_ptr<T>(v: &const [T]) -> *const T {
unsafe {
let repr: **SliceRepr = transmute(&v);
transmute(&((**repr).data))
}
}

/** see `to_ptr()` */
#[inline(always)]
pub unsafe fn to_mut_ptr<T>(v: &mut [T]) -> *mut T {
let repr: **SliceRepr = transmute(&v);
transmute(&((**repr).data))
pub fn to_mut_ptr<T>(v: &mut [T]) -> *mut T {
unsafe {
let repr: **SliceRepr = transmute(&v);
transmute(&((**repr).data))
}
}

/**
Expand Down

0 comments on commit 92b7a45

Please sign in to comment.