diff options
| author | Luqman Aden <laden@csclub.uwaterloo.ca> | 2013-02-14 19:00:04 -0500 |
|---|---|---|
| committer | Luqman Aden <laden@mozilla.com> | 2013-02-14 18:36:10 -0800 |
| commit | cc8902994248930ef0902ff68483ce1991fa4e24 (patch) | |
| tree | fe17e307be4296daae5f2afe8e1df0f2ee19b7de /src/libcore/ptr.rs | |
| parent | af2f0ef0888d05209bddd16ab210ae0e8400b7de (diff) | |
| download | rust-cc8902994248930ef0902ff68483ce1991fa4e24.tar.gz rust-cc8902994248930ef0902ff68483ce1991fa4e24.zip | |
libcore: Remove ptr::mut_addr_of since &mut is coerced to *mut
Diffstat (limited to 'src/libcore/ptr.rs')
| -rw-r--r-- | src/libcore/ptr.rs | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index acadf079b3b..c6617bdd516 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -44,14 +44,6 @@ extern mod rusti { #[inline(always)] pub pure fn addr_of<T>(val: &T) -> *T { unsafe { rusti::addr_of(*val) } } -/// Get an unsafe mut pointer to a value -#[inline(always)] -pub pure fn mut_addr_of<T>(val: &T) -> *mut T { - unsafe { - cast::reinterpret_cast(&rusti::addr_of(*val)) - } -} - /// Calculate the offset from a pointer #[inline(always)] pub pure fn offset<T>(ptr: *T, count: uint) -> *T { @@ -313,8 +305,8 @@ impl<T:Ord> Ord for &const T { pub fn test() { unsafe { struct Pair {mut fst: int, mut snd: int}; - let p = Pair {mut fst: 10, mut snd: 20}; - let pptr: *mut Pair = mut_addr_of(&p); + let mut p = Pair {mut fst: 10, mut snd: 20}; + let pptr: *mut Pair = &mut p; let iptr: *mut int = cast::reinterpret_cast(&pptr); assert (*iptr == 10);; *iptr = 30; |
