Skip to content

Commit

Permalink
Stabilize ptr_unaligned feature, closes rust-lang#37955
Browse files Browse the repository at this point in the history
  • Loading branch information
aturon committed Mar 15, 2017
1 parent 5b4a1b6 commit f789955
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/libcore/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ pub unsafe fn read<T>(src: *const T) -> T {
/// Basic usage:
///
/// ```
/// #![feature(ptr_unaligned)]
///
/// let x = 12;
/// let y = &x as *const i32;
///
Expand All @@ -171,7 +169,7 @@ pub unsafe fn read<T>(src: *const T) -> T {
/// }
/// ```
#[inline(always)]
#[unstable(feature = "ptr_unaligned", issue = "37955")]
#[stable(feature = "ptr_unaligned", since = "1.17.0")]
pub unsafe fn read_unaligned<T>(src: *const T) -> T {
let mut tmp: T = mem::uninitialized();
copy_nonoverlapping(src as *const u8,
Expand Down Expand Up @@ -241,8 +239,6 @@ pub unsafe fn write<T>(dst: *mut T, src: T) {
/// Basic usage:
///
/// ```
/// #![feature(ptr_unaligned)]
///
/// let mut x = 0;
/// let y = &mut x as *mut i32;
/// let z = 12;
Expand All @@ -253,7 +249,7 @@ pub unsafe fn write<T>(dst: *mut T, src: T) {
/// }
/// ```
#[inline]
#[unstable(feature = "ptr_unaligned", issue = "37955")]
#[stable(feature = "ptr_unaligned", since = "1.17.0")]
pub unsafe fn write_unaligned<T>(dst: *mut T, src: T) {
copy_nonoverlapping(&src as *const T as *const u8,
dst as *mut u8,
Expand Down

0 comments on commit f789955

Please sign in to comment.