diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2012-03-26 18:35:18 -0700 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2012-03-26 18:35:18 -0700 |
| commit | 6e6798c4e17d9ffa33c0573f329c772e9d96739e (patch) | |
| tree | 64d4a01e7ed41092983f623b9b0fe0e5abc25200 /src/libcore/ptr.rs | |
| parent | 34283ce7e840cbec4ec5704616614dbccdc08e81 (diff) | |
Bulk-edit mutable -> mut.
Diffstat (limited to 'src/libcore/ptr.rs')
| -rw-r--r-- | src/libcore/ptr.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index cf8f21969f5..a7bcfe5c9a8 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -28,9 +28,9 @@ native mod rusti { #[inline(always)] fn addr_of<T>(val: T) -> *T { rusti::addr_of(val) } -#[doc = "Get an unsafe mutable pointer to a value"] +#[doc = "Get an unsafe mut pointer to a value"] #[inline(always)] -fn mut_addr_of<T>(val: T) -> *mutable T unsafe { +fn mut_addr_of<T>(val: T) -> *mut T unsafe { unsafe::reinterpret_cast(rusti::addr_of(val)) } @@ -40,10 +40,10 @@ fn offset<T>(ptr: *T, count: uint) -> *T unsafe { (ptr as uint + count * sys::size_of::<T>()) as *T } -#[doc = "Calculate the offset from a mutable pointer"] +#[doc = "Calculate the offset from a mut pointer"] #[inline(always)] -fn mut_offset<T>(ptr: *mutable T, count: uint) -> *mutable T { - (ptr as uint + count * sys::size_of::<T>()) as *mutable T +fn mut_offset<T>(ptr: *mut T, count: uint) -> *mut T { + (ptr as uint + count * sys::size_of::<T>()) as *mut T } @@ -77,16 +77,16 @@ unsafe fn memmove<T>(dst: *T, src: *T, count: uint) { #[test] fn test() unsafe { - type pair = {mutable fst: int, mutable snd: int}; - let p = {mutable fst: 10, mutable snd: 20}; - let pptr: *mutable pair = mut_addr_of(p); - let iptr: *mutable int = unsafe::reinterpret_cast(pptr); + type pair = {mut fst: int, mut snd: int}; + let p = {mut fst: 10, mut snd: 20}; + let pptr: *mut pair = mut_addr_of(p); + let iptr: *mut int = unsafe::reinterpret_cast(pptr); assert (*iptr == 10);; *iptr = 30; assert (*iptr == 30); assert (p.fst == 30);; - *pptr = {mutable fst: 50, mutable snd: 60}; + *pptr = {mut fst: 50, mut snd: 60}; assert (*iptr == 50); assert (p.fst == 50); assert (p.snd == 60); |
