Skip to content

Commit

Permalink
auto merge of #7016 : thestinger/rust/ptr, r=luqmana
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Jun 8, 2013
2 parents 878a9b9 + fe3ad0a commit 470bf0d
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/libextra/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/librustc/lib/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/middle/trans/cabi_mips.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/librustc/middle/trans/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -964,9 +964,7 @@ pub fn T_tydesc_field(cx: @CrateContext, field: uint) -> TypeRef {
let mut tydesc_elts: ~[TypeRef] =
vec::from_elem::<TypeRef>(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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) };

Expand Down
4 changes: 2 additions & 2 deletions src/libstd/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1315,8 +1315,8 @@ pub fn swap<T>(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);
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/test/run-pass/swap-overlapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 470bf0d

Please sign in to comment.