Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
std::ptr::read_ptr now takes *T instead of *mut T
Closes #10579
  • Loading branch information
hatahet committed Nov 21, 2013
1 parent 760942d commit 248cb90
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/libstd/ptr.rs
Expand Up @@ -155,7 +155,7 @@ pub unsafe fn replace_ptr<T>(dest: *mut T, mut src: T) -> T {
* Reads the value from `*src` and returns it. Does not copy `*src`.
*/
#[inline(always)]
pub unsafe fn read_ptr<T>(src: *mut T) -> T {
pub unsafe fn read_ptr<T>(src: *T) -> T {
let mut tmp: T = intrinsics::uninit();
copy_nonoverlapping_memory(&mut tmp, src, 1);
tmp
Expand All @@ -168,7 +168,7 @@ pub unsafe fn read_ptr<T>(src: *mut T) -> T {
#[inline(always)]
pub unsafe fn read_and_zero_ptr<T>(dest: *mut T) -> T {
// Copy the data out from `dest`:
let tmp = read_ptr(dest);
let tmp = read_ptr(&*dest);

// Now zero out `dest`:
zero_memory(dest, 1);
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/vec.rs
Expand Up @@ -1527,7 +1527,7 @@ impl<T> OwnedVector<T> for ~[T] {
let valptr = ptr::to_mut_unsafe_ptr(&mut self[ln - 1u]);
unsafe {
raw::set_len(self, ln - 1u);
Some(ptr::read_ptr(valptr))
Some(ptr::read_ptr(&*valptr))
}
}
}
Expand Down

5 comments on commit 248cb90

@bors
Copy link
Contributor

@bors bors commented on 248cb90 Nov 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from thestinger
at hatahet@248cb90

@bors
Copy link
Contributor

@bors bors commented on 248cb90 Nov 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging hatahet/rust/master = 248cb90 into auto

@bors
Copy link
Contributor

@bors bors commented on 248cb90 Nov 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hatahet/rust/master = 248cb90 merged ok, testing candidate = 61e07d6

@bors
Copy link
Contributor

@bors bors commented on 248cb90 Nov 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 248cb90 Nov 21, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 61e07d6

Please sign in to comment.