rm some uses of to_mut_unsafe_ptr

This commit is contained in:
Daniel Micay
2013-06-08 15:02:32 -04:00
parent b8fa9d3be1
commit fe3ad0a204
7 changed files with 8 additions and 13 deletions

View File

@@ -263,7 +263,7 @@ impl Drop for PoisonOnFail {
fn PoisonOnFail<'r>(failed: &'r mut bool) -> PoisonOnFail { fn PoisonOnFail<'r>(failed: &'r mut bool) -> PoisonOnFail {
PoisonOnFail { PoisonOnFail {
failed: ptr::to_mut_unsafe_ptr(failed) failed: failed
} }
} }

View File

@@ -2117,8 +2117,7 @@ pub fn struct_tys(struct_ty: TypeRef) -> ~[TypeRef] {
return ~[]; return ~[];
} }
let mut elts = vec::from_elem(n_elts, ptr::null()); let mut elts = vec::from_elem(n_elts, ptr::null());
llvm::LLVMGetStructElementTypes( llvm::LLVMGetStructElementTypes(struct_ty, &mut elts[0]);
struct_ty, ptr::to_mut_unsafe_ptr(&mut elts[0]));
return elts; return elts;
} }
} }

View File

@@ -38,8 +38,7 @@ fn struct_tys(ty: TypeRef) -> ~[TypeRef] {
return ~[]; return ~[];
} }
let mut elts = vec::from_elem(n as uint, ptr::null()); let mut elts = vec::from_elem(n as uint, ptr::null());
llvm::LLVMGetStructElementTypes(ty, llvm::LLVMGetStructElementTypes(ty, &mut elts[0]);
ptr::to_mut_unsafe_ptr(&mut elts[0]));
return elts; return elts;
} }
} }

View File

@@ -964,9 +964,7 @@ pub fn T_tydesc_field(cx: @CrateContext, field: uint) -> TypeRef {
let mut tydesc_elts: ~[TypeRef] = let mut tydesc_elts: ~[TypeRef] =
vec::from_elem::<TypeRef>(abi::n_tydesc_fields, vec::from_elem::<TypeRef>(abi::n_tydesc_fields,
T_nil()); T_nil());
llvm::LLVMGetStructElementTypes( llvm::LLVMGetStructElementTypes(cx.tydesc_type, &mut tydesc_elts[0]);
cx.tydesc_type,
ptr::to_mut_unsafe_ptr(&mut tydesc_elts[0]));
let t = llvm::LLVMGetElementType(tydesc_elts[field]); let t = llvm::LLVMGetElementType(tydesc_elts[field]);
return t; return t;
} }

View File

@@ -1179,7 +1179,7 @@ pub fn real_args() -> ~[~str] {
#[cfg(windows)] #[cfg(windows)]
pub fn real_args() -> ~[~str] { pub fn real_args() -> ~[~str] {
let mut nArgs: c_int = 0; let mut nArgs: c_int = 0;
let lpArgCount = ptr::to_mut_unsafe_ptr(&mut nArgs); let lpArgCount: *mut c_int = &mut nArgs;
let lpCmdLine = unsafe { GetCommandLineW() }; let lpCmdLine = unsafe { GetCommandLineW() };
let szArgList = unsafe { CommandLineToArgvW(lpCmdLine, lpArgCount) }; let szArgList = unsafe { CommandLineToArgvW(lpCmdLine, lpArgCount) };

View File

@@ -1315,8 +1315,8 @@ pub fn swap<T>(v: &mut [T], a: uint, b: uint) {
unsafe { unsafe {
// Can't take two mutable loans from one vector, so instead just cast // Can't take two mutable loans from one vector, so instead just cast
// them to their raw pointers to do the swap // them to their raw pointers to do the swap
let pa: *mut T = ptr::to_mut_unsafe_ptr(&mut v[a]); let pa: *mut T = &mut v[a];
let pb: *mut T = ptr::to_mut_unsafe_ptr(&mut v[b]); let pb: *mut T = &mut v[b];
ptr::swap_ptr(pa, pb); ptr::swap_ptr(pa, pb);
} }
} }

View File

@@ -26,8 +26,7 @@ pub fn main() {
fn do_swap(test: &mut TestDescAndFn) { fn do_swap(test: &mut TestDescAndFn) {
unsafe { unsafe {
ptr::swap_ptr(ptr::to_mut_unsafe_ptr(test), ptr::swap_ptr(test, test);
ptr::to_mut_unsafe_ptr(test));
} }
} }