Repository: BurntSushi/byteorder (language: rust)

Issue:
mismatched types
I updated to recent nightly and I cannot build byteorder anymore because of mismatched types.

```
b.rs:278:52: 278:57 error: mismatched types:
 expected `*mut u8`,
    found `*const u8`
(values differ in mutability) [E0308]
/home/jp/.cargo/registry/src/github.com-1ecc6299db9ec823/byteorder-0.3.3/src/lib.rs:278                 copy_nonoverlapping($dst.as_mut_ptr(), bytes, $size);
```

Looks like it's just a one-liner



Discussion / hints:

Fix patch:
diff --git a/src/lib.rs b/src/lib.rs
index 5ec649b..eb2df76 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -229,39 +229,36 @@ pub type NativeEndian = BigEndian;
 
 macro_rules! read_num_bytes {
     ($ty:ty, $size:expr, $src:expr, $which:ident) => ({
-        use std::num::Int;
         use std::ptr::copy_nonoverlapping;
 
         assert!($src.len() >= $size); // critical for memory safety!
         let mut out = [0u8; $size];
         let ptr_out = out.as_mut_ptr();
         unsafe {
-            copy_nonoverlapping(ptr_out, $src.as_ptr(), $size);
+            copy_nonoverlapping($src.as_ptr(), ptr_out, $size);
             (*(ptr_out as *const $ty)).$which()
         }
     });
     ($ty:ty, $size:expr, le $bytes:expr, $src:expr, $which:ident) => ({
-        use std::num::Int;
         use std::ptr::copy_nonoverlapping;
 
         assert!($bytes > 0 && $bytes < 9 && $bytes <= $src.len());
         let mut out = [0u8; $size];
         let ptr_out = out.as_mut_ptr();
         unsafe {
-            copy_nonoverlapping(ptr_out, $src.as_ptr(), $bytes);
+            copy_nonoverlapping($src.as_ptr(), ptr_out, $bytes);
             (*(ptr_out as *const $ty)).$which()
         }
     });
     ($ty:ty, $size:expr, be $bytes:expr, $src:expr, $which:ident) => ({
-        use std::num::Int;
         use std::ptr::copy_nonoverlapping;
 
         assert!($bytes > 0 && $bytes < 9 && $bytes <= $src.len());
         let mut out = [0u8; $size];
         let ptr_out = out.as_mut_ptr();
         unsafe {
-            copy_nonoverlapping(ptr_out.offset((8 - $bytes) as isize),
-                                $src.as_ptr(), $bytes);
+            copy_nonoverlapping($src.as_ptr(),
+                                ptr_out.offset((8 - $bytes) as isize), $bytes);
             (*(ptr_out as *const $ty)).$which()
         }
     });
@@ -269,13 +266,12 @@ macro_rules! read_num_bytes {
 
 macro_rules! write_num_bytes {
     ($ty:ty, $size:expr, $n:expr, $dst:expr, $which:ident) => ({
-        use std::num::Int;
         use std::ptr::copy_nonoverlapping;
 
         assert!($dst.len() >= $size); // critical for memory safety!
         unsafe {
             let bytes = (&transmute::<_, [u8; $size]>($n.$which())).as_ptr();
-            copy_nonoverlapping($dst.as_mut_ptr(), bytes, $size);
+            copy_nonoverlapping(bytes, $dst.as_mut_ptr(), $size);
         }
     });
 }


Test patch: