From fe3ad0a204656b43ecec7605161603d2943b0582 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sat, 8 Jun 2013 15:02:32 -0400 Subject: [PATCH] rm some uses of to_mut_unsafe_ptr --- src/libextra/arc.rs | 2 +- src/librustc/lib/llvm.rs | 3 +-- src/librustc/middle/trans/cabi_mips.rs | 3 +-- src/librustc/middle/trans/common.rs | 4 +--- src/libstd/os.rs | 2 +- src/libstd/vec.rs | 4 ++-- src/test/run-pass/swap-overlapping.rs | 3 +-- 7 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/libextra/arc.rs b/src/libextra/arc.rs index 0618e7aaf65c9..a59f59deee3c6 100644 --- a/src/libextra/arc.rs +++ b/src/libextra/arc.rs @@ -263,7 +263,7 @@ impl Drop for PoisonOnFail { fn PoisonOnFail<'r>(failed: &'r mut bool) -> PoisonOnFail { PoisonOnFail { - failed: ptr::to_mut_unsafe_ptr(failed) + failed: failed } } diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs index b664abef34353..f6beb078e46f5 100644 --- a/src/librustc/lib/llvm.rs +++ b/src/librustc/lib/llvm.rs @@ -2117,8 +2117,7 @@ pub fn struct_tys(struct_ty: TypeRef) -> ~[TypeRef] { return ~[]; } let mut elts = vec::from_elem(n_elts, ptr::null()); - llvm::LLVMGetStructElementTypes( - struct_ty, ptr::to_mut_unsafe_ptr(&mut elts[0])); + llvm::LLVMGetStructElementTypes(struct_ty, &mut elts[0]); return elts; } } diff --git a/src/librustc/middle/trans/cabi_mips.rs b/src/librustc/middle/trans/cabi_mips.rs index 5ef5c4c35b103..6be398c0bb2b1 100644 --- a/src/librustc/middle/trans/cabi_mips.rs +++ b/src/librustc/middle/trans/cabi_mips.rs @@ -38,8 +38,7 @@ fn struct_tys(ty: TypeRef) -> ~[TypeRef] { return ~[]; } let mut elts = vec::from_elem(n as uint, ptr::null()); - llvm::LLVMGetStructElementTypes(ty, - ptr::to_mut_unsafe_ptr(&mut elts[0])); + llvm::LLVMGetStructElementTypes(ty, &mut elts[0]); return elts; } } diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index df5000a543cb8..78aca4c831f7c 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -964,9 +964,7 @@ pub fn T_tydesc_field(cx: @CrateContext, field: uint) -> TypeRef { let mut tydesc_elts: ~[TypeRef] = vec::from_elem::(abi::n_tydesc_fields, T_nil()); - llvm::LLVMGetStructElementTypes( - cx.tydesc_type, - ptr::to_mut_unsafe_ptr(&mut tydesc_elts[0])); + llvm::LLVMGetStructElementTypes(cx.tydesc_type, &mut tydesc_elts[0]); let t = llvm::LLVMGetElementType(tydesc_elts[field]); return t; } diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 446804f7b304d..6ce6d81bf2439 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -1179,7 +1179,7 @@ pub fn real_args() -> ~[~str] { #[cfg(windows)] pub fn real_args() -> ~[~str] { 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 szArgList = unsafe { CommandLineToArgvW(lpCmdLine, lpArgCount) }; diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 6137b589bdbae..7c52ccc967ebb 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -1315,8 +1315,8 @@ pub fn swap(v: &mut [T], a: uint, b: uint) { unsafe { // Can't take two mutable loans from one vector, so instead just cast // them to their raw pointers to do the swap - let pa: *mut T = ptr::to_mut_unsafe_ptr(&mut v[a]); - let pb: *mut T = ptr::to_mut_unsafe_ptr(&mut v[b]); + let pa: *mut T = &mut v[a]; + let pb: *mut T = &mut v[b]; ptr::swap_ptr(pa, pb); } } diff --git a/src/test/run-pass/swap-overlapping.rs b/src/test/run-pass/swap-overlapping.rs index 07d1226d38297..927ec69972738 100644 --- a/src/test/run-pass/swap-overlapping.rs +++ b/src/test/run-pass/swap-overlapping.rs @@ -26,8 +26,7 @@ pub fn main() { fn do_swap(test: &mut TestDescAndFn) { unsafe { - ptr::swap_ptr(ptr::to_mut_unsafe_ptr(test), - ptr::to_mut_unsafe_ptr(test)); + ptr::swap_ptr(test, test); } }