diff options
| author | James Miller <bladeon@gmail.com> | 2013-05-09 22:41:26 +1200 |
|---|---|---|
| committer | James Miller <bladeon@gmail.com> | 2013-05-09 22:41:54 +1200 |
| commit | f5ab112e6b083ab20fdcf9e2fff7dde4a85940b0 (patch) | |
| tree | f7877f80e6bc634d3914139a6a44be436c79149f /src/libcore | |
| parent | 050c744c23a8e01407452bc64ca63f92554afee2 (diff) | |
| download | rust-f5ab112e6b083ab20fdcf9e2fff7dde4a85940b0.tar.gz rust-f5ab112e6b083ab20fdcf9e2fff7dde4a85940b0.zip | |
Replace init() with uninit() where appropriate
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/cast.rs | 2 | ||||
| -rw-r--r-- | src/libcore/vec.rs | 13 |
2 files changed, 5 insertions, 10 deletions
diff --git a/src/libcore/cast.rs b/src/libcore/cast.rs index 5e6d2f8b910..fe5da8bae69 100644 --- a/src/libcore/cast.rs +++ b/src/libcore/cast.rs @@ -25,7 +25,7 @@ pub mod rusti { /// Casts the value at `src` to U. The two types must have the same length. pub unsafe fn transmute_copy<T, U>(src: &T) -> U { - let mut dest: U = unstable::intrinsics::init(); + let mut dest: U = unstable::intrinsics::uninit(); { let dest_ptr: *mut u8 = rusti::transmute(&mut dest); let src_ptr: *u8 = rusti::transmute(src); diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 404e32b2e2e..ea780ff9bdd 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -591,8 +591,7 @@ pub fn pop<T>(v: &mut ~[T]) -> T { } let valptr = ptr::to_mut_unsafe_ptr(&mut v[ln - 1u]); unsafe { - // FIXME #4204: Should be uninit() - we don't need this zeroed - let mut val = intrinsics::init(); + let mut val = intrinsics::uninit(); val <-> *valptr; raw::set_len(v, ln - 1u); val @@ -666,8 +665,7 @@ pub fn push_all_move<T>(v: &mut ~[T], mut rhs: ~[T]) { unsafe { do as_mut_buf(rhs) |p, len| { for uint::range(0, len) |i| { - // FIXME #4204 Should be uninit() - don't need to zero - let mut x = intrinsics::init(); + let mut x = intrinsics::uninit(); x <-> *ptr::mut_offset(p, i); push(&mut *v, x); } @@ -683,8 +681,7 @@ pub fn truncate<T>(v: &mut ~[T], newlen: uint) { unsafe { // This loop is optimized out for non-drop types. for uint::range(newlen, oldlen) |i| { - // FIXME #4204 Should be uninit() - don't need to zero - let mut dropped = intrinsics::init(); + let mut dropped = intrinsics::uninit(); dropped <-> *ptr::mut_offset(p, i); } } @@ -709,9 +706,7 @@ pub fn dedup<T:Eq>(v: &mut ~[T]) { // last_written < next_to_read < ln if *ptr::mut_offset(p, next_to_read) == *ptr::mut_offset(p, last_written) { - // FIXME #4204 Should be uninit() - don't need to - // zero - let mut dropped = intrinsics::init(); + let mut dropped = intrinsics::uninit(); dropped <-> *ptr::mut_offset(p, next_to_read); } else { last_written += 1; |
