Snap for 7256292 from cc273d5ebac12c998b7f1f2b297b34a8b2ef409a to tm-release

Change-Id: I5123bcb7271d3945768c417b70e5a164ef88d07f
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index e260c24..cd7856e 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
 {
   "git": {
-    "sha1": "ca8c10a3f85e2c66781f7d12e90196e6923592d7"
+    "sha1": "abffade8232229db557e0a30c395963071624b2b"
   }
 }
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 082c5cc..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-language: rust
-matrix:
-  include:
-    - rust: 1.12.0
-    - rust: stable
-    - rust: beta
-    - rust: nightly
-    - env: CROSS_TARGET=mips64-unknown-linux-gnuabi64
-      rust: stable
-      services: docker
-      sudo: required
-script: ci/script.sh
-branches:
-  only:
-    - master
diff --git a/Android.bp b/Android.bp
index 899071d..3efba93 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,4 +1,5 @@
 // This file is generated by cargo2android.py --run --device --dependencies.
+// Do not modify this file as changes will be overridden on upgrade.
 
 package {
     default_applicable_licenses: ["external_rust_crates_byteorder_license"],
diff --git a/Cargo.toml b/Cargo.toml
index ff60b60..c71f90b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
 [package]
 edition = "2018"
 name = "byteorder"
-version = "1.4.2"
+version = "1.4.3"
 authors = ["Andrew Gallant <jamslam@gmail.com>"]
 exclude = ["/ci/*"]
 description = "Library for reading/writing numbers in big-endian and little-endian."
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index efeafb2..728f668 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
 [package]
 name = "byteorder"
-version = "1.4.2"  #:version
+version = "1.4.3"  #:version
 authors = ["Andrew Gallant <jamslam@gmail.com>"]
 description = "Library for reading/writing numbers in big-endian and little-endian."
 documentation = "https://docs.rs/byteorder"
diff --git a/METADATA b/METADATA
index 95a62dd..c5a4b7d 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@
   }
   url {
     type: ARCHIVE
-    value: "https://static.crates.io/crates/byteorder/byteorder-1.4.2.crate"
+    value: "https://static.crates.io/crates/byteorder/byteorder-1.4.3.crate"
   }
-  version: "1.4.2"
+  version: "1.4.3"
   license_type: NOTICE
   last_upgrade_date {
     year: 2021
-    month: 2
-    day: 7
+    month: 4
+    day: 1
   }
 }
diff --git a/README.md b/README.md
index 8b2ecc4..d8461c5 100644
--- a/README.md
+++ b/README.md
@@ -4,9 +4,9 @@
 numbers in either big-endian or little-endian order.
 
 [![Build status](https://github.com/BurntSushi/byteorder/workflows/ci/badge.svg)](https://github.com/BurntSushi/byteorder/actions)
-[![](http://meritbadge.herokuapp.com/byteorder)](https://crates.io/crates/byteorder)
+[![](https://meritbadge.herokuapp.com/byteorder)](https://crates.io/crates/byteorder)
 
-Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org).
+Dual-licensed under MIT or the [UNLICENSE](https://unlicense.org/).
 
 
 ### Documentation
diff --git a/src/io.rs b/src/io.rs
index ac41ff7..dfad2ca 100644
--- a/src/io.rs
+++ b/src/io.rs
@@ -1582,7 +1582,8 @@
 /// representation.
 ///
 /// This function is wildly unsafe because it permits arbitrary modification of
-/// the binary representation of any `Copy` type. Use with care.
+/// the binary representation of any `Copy` type. Use with care. It's intended
+/// to be called only where `T` is a numeric type.
 unsafe fn slice_to_u8_mut<T: Copy>(slice: &mut [T]) -> &mut [u8] {
     use std::mem::size_of;
 
diff --git a/src/lib.rs b/src/lib.rs
index d56574d..cc37cca 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1557,9 +1557,7 @@
     /// LittleEndian::write_f32_into(&numbers_given, &mut bytes);
     ///
     /// let mut numbers_got = [0.0; 4];
-    /// unsafe {
-    ///     LittleEndian::read_f32_into(&bytes, &mut numbers_got);
-    /// }
+    /// LittleEndian::read_f32_into(&bytes, &mut numbers_got);
     /// assert_eq!(numbers_given, numbers_got);
     /// ```
     fn write_f32_into(src: &[f32], dst: &mut [u8]) {
@@ -1588,9 +1586,7 @@
     /// LittleEndian::write_f64_into(&numbers_given, &mut bytes);
     ///
     /// let mut numbers_got = [0.0; 4];
-    /// unsafe {
-    ///     LittleEndian::read_f64_into(&bytes, &mut numbers_got);
-    /// }
+    /// LittleEndian::read_f64_into(&bytes, &mut numbers_got);
     /// assert_eq!(numbers_given, numbers_got);
     /// ```
     fn write_f64_into(src: &[f64], dst: &mut [u8]) {
@@ -1696,7 +1692,7 @@
     #[inline]
     fn from_slice_i16(src: &mut [i16]) {
         let src = unsafe {
-            slice::from_raw_parts_mut(src.as_ptr() as *mut u16, src.len())
+            slice::from_raw_parts_mut(src.as_mut_ptr() as *mut u16, src.len())
         };
         Self::from_slice_u16(src);
     }
@@ -1721,7 +1717,7 @@
     #[inline]
     fn from_slice_i32(src: &mut [i32]) {
         let src = unsafe {
-            slice::from_raw_parts_mut(src.as_ptr() as *mut u32, src.len())
+            slice::from_raw_parts_mut(src.as_mut_ptr() as *mut u32, src.len())
         };
         Self::from_slice_u32(src);
     }
@@ -1746,7 +1742,7 @@
     #[inline]
     fn from_slice_i64(src: &mut [i64]) {
         let src = unsafe {
-            slice::from_raw_parts_mut(src.as_ptr() as *mut u64, src.len())
+            slice::from_raw_parts_mut(src.as_mut_ptr() as *mut u64, src.len())
         };
         Self::from_slice_u64(src);
     }
@@ -1771,7 +1767,7 @@
     #[inline]
     fn from_slice_i128(src: &mut [i128]) {
         let src = unsafe {
-            slice::from_raw_parts_mut(src.as_ptr() as *mut u128, src.len())
+            slice::from_raw_parts_mut(src.as_mut_ptr() as *mut u128, src.len())
         };
         Self::from_slice_u128(src);
     }
@@ -1899,7 +1895,13 @@
 #[cfg(target_endian = "big")]
 pub type NativeEndian = BigEndian;
 
-macro_rules! write_num_bytes {
+/// Copies $size bytes from a number $n to a &mut [u8] $dst. $ty represents the
+/// numeric type of $n and $which must be either to_be or to_le, depending on
+/// which endianness one wants to use when writing to $dst.
+///
+/// This macro is only safe to call when $ty is a numeric type and $size ==
+/// size_of::<$ty>() and where $dst is a &mut [u8].
+macro_rules! unsafe_write_num_bytes {
     ($ty:ty, $size:expr, $n:expr, $dst:expr, $which:ident) => {{
         assert!($size <= $dst.len());
         unsafe {
@@ -1910,7 +1912,13 @@
     }};
 }
 
-macro_rules! read_slice {
+/// Copies a &[u8] $src into a &mut [<numeric>] $dst for the endianness given
+/// by $which (must be either to_be or to_le).
+///
+/// This macro is only safe to call when $src and $dst are &[u8] and &mut [u8],
+/// respectively. The macro will panic if $src.len() != $size * $dst.len(),
+/// where $size represents the size of the integers encoded in $src.
+macro_rules! unsafe_read_slice {
     ($src:expr, $dst:expr, $size:expr, $which:ident) => {{
         assert_eq!($src.len(), $size * $dst.len());
 
@@ -1927,10 +1935,16 @@
     }};
 }
 
-macro_rules! write_slice_native {
-    ($src:expr, $dst:expr, $ty:ty, $size:expr) => {{
-        assert!($size == ::core::mem::size_of::<$ty>());
-        assert_eq!($size * $src.len(), $dst.len());
+/// Copies a &[$ty] $src into a &mut [u8] $dst, where $ty must be a numeric
+/// type. This panics if size_of::<$ty>() * $src.len() != $dst.len().
+///
+/// This macro is only safe to call when $src is a slice of numeric types and
+/// $dst is a &mut [u8] and where $ty represents the type of the integers in
+/// $src.
+macro_rules! unsafe_write_slice_native {
+    ($src:expr, $dst:expr, $ty:ty) => {{
+        let size = core::mem::size_of::<$ty>();
+        assert_eq!(size * $src.len(), $dst.len());
 
         unsafe {
             copy_nonoverlapping(
@@ -2006,22 +2020,22 @@
 
     #[inline]
     fn write_u16(buf: &mut [u8], n: u16) {
-        write_num_bytes!(u16, 2, n, buf, to_be);
+        unsafe_write_num_bytes!(u16, 2, n, buf, to_be);
     }
 
     #[inline]
     fn write_u32(buf: &mut [u8], n: u32) {
-        write_num_bytes!(u32, 4, n, buf, to_be);
+        unsafe_write_num_bytes!(u32, 4, n, buf, to_be);
     }
 
     #[inline]
     fn write_u64(buf: &mut [u8], n: u64) {
-        write_num_bytes!(u64, 8, n, buf, to_be);
+        unsafe_write_num_bytes!(u64, 8, n, buf, to_be);
     }
 
     #[inline]
     fn write_u128(buf: &mut [u8], n: u128) {
-        write_num_bytes!(u128, 16, n, buf, to_be);
+        unsafe_write_num_bytes!(u128, 16, n, buf, to_be);
     }
 
     #[inline]
@@ -2054,28 +2068,28 @@
 
     #[inline]
     fn read_u16_into(src: &[u8], dst: &mut [u16]) {
-        read_slice!(src, dst, 2, to_be);
+        unsafe_read_slice!(src, dst, 2, to_be);
     }
 
     #[inline]
     fn read_u32_into(src: &[u8], dst: &mut [u32]) {
-        read_slice!(src, dst, 4, to_be);
+        unsafe_read_slice!(src, dst, 4, to_be);
     }
 
     #[inline]
     fn read_u64_into(src: &[u8], dst: &mut [u64]) {
-        read_slice!(src, dst, 8, to_be);
+        unsafe_read_slice!(src, dst, 8, to_be);
     }
 
     #[inline]
     fn read_u128_into(src: &[u8], dst: &mut [u128]) {
-        read_slice!(src, dst, 16, to_be);
+        unsafe_read_slice!(src, dst, 16, to_be);
     }
 
     #[inline]
     fn write_u16_into(src: &[u16], dst: &mut [u8]) {
         if cfg!(target_endian = "big") {
-            write_slice_native!(src, dst, u16, 2);
+            unsafe_write_slice_native!(src, dst, u16);
         } else {
             write_slice!(src, dst, u16, 2, Self::write_u16);
         }
@@ -2084,7 +2098,7 @@
     #[inline]
     fn write_u32_into(src: &[u32], dst: &mut [u8]) {
         if cfg!(target_endian = "big") {
-            write_slice_native!(src, dst, u32, 4);
+            unsafe_write_slice_native!(src, dst, u32);
         } else {
             write_slice!(src, dst, u32, 4, Self::write_u32);
         }
@@ -2093,7 +2107,7 @@
     #[inline]
     fn write_u64_into(src: &[u64], dst: &mut [u8]) {
         if cfg!(target_endian = "big") {
-            write_slice_native!(src, dst, u64, 8);
+            unsafe_write_slice_native!(src, dst, u64);
         } else {
             write_slice!(src, dst, u64, 8, Self::write_u64);
         }
@@ -2102,7 +2116,7 @@
     #[inline]
     fn write_u128_into(src: &[u128], dst: &mut [u8]) {
         if cfg!(target_endian = "big") {
-            write_slice_native!(src, dst, u128, 16);
+            unsafe_write_slice_native!(src, dst, u128);
         } else {
             write_slice!(src, dst, u128, 16, Self::write_u128);
         }
@@ -2214,22 +2228,22 @@
 
     #[inline]
     fn write_u16(buf: &mut [u8], n: u16) {
-        write_num_bytes!(u16, 2, n, buf, to_le);
+        unsafe_write_num_bytes!(u16, 2, n, buf, to_le);
     }
 
     #[inline]
     fn write_u32(buf: &mut [u8], n: u32) {
-        write_num_bytes!(u32, 4, n, buf, to_le);
+        unsafe_write_num_bytes!(u32, 4, n, buf, to_le);
     }
 
     #[inline]
     fn write_u64(buf: &mut [u8], n: u64) {
-        write_num_bytes!(u64, 8, n, buf, to_le);
+        unsafe_write_num_bytes!(u64, 8, n, buf, to_le);
     }
 
     #[inline]
     fn write_u128(buf: &mut [u8], n: u128) {
-        write_num_bytes!(u128, 16, n, buf, to_le);
+        unsafe_write_num_bytes!(u128, 16, n, buf, to_le);
     }
 
     #[inline]
@@ -2254,28 +2268,28 @@
 
     #[inline]
     fn read_u16_into(src: &[u8], dst: &mut [u16]) {
-        read_slice!(src, dst, 2, to_le);
+        unsafe_read_slice!(src, dst, 2, to_le);
     }
 
     #[inline]
     fn read_u32_into(src: &[u8], dst: &mut [u32]) {
-        read_slice!(src, dst, 4, to_le);
+        unsafe_read_slice!(src, dst, 4, to_le);
     }
 
     #[inline]
     fn read_u64_into(src: &[u8], dst: &mut [u64]) {
-        read_slice!(src, dst, 8, to_le);
+        unsafe_read_slice!(src, dst, 8, to_le);
     }
 
     #[inline]
     fn read_u128_into(src: &[u8], dst: &mut [u128]) {
-        read_slice!(src, dst, 16, to_le);
+        unsafe_read_slice!(src, dst, 16, to_le);
     }
 
     #[inline]
     fn write_u16_into(src: &[u16], dst: &mut [u8]) {
         if cfg!(target_endian = "little") {
-            write_slice_native!(src, dst, u16, 2);
+            unsafe_write_slice_native!(src, dst, u16);
         } else {
             write_slice!(src, dst, u16, 2, Self::write_u16);
         }
@@ -2284,7 +2298,7 @@
     #[inline]
     fn write_u32_into(src: &[u32], dst: &mut [u8]) {
         if cfg!(target_endian = "little") {
-            write_slice_native!(src, dst, u32, 4);
+            unsafe_write_slice_native!(src, dst, u32);
         } else {
             write_slice!(src, dst, u32, 4, Self::write_u32);
         }
@@ -2293,7 +2307,7 @@
     #[inline]
     fn write_u64_into(src: &[u64], dst: &mut [u8]) {
         if cfg!(target_endian = "little") {
-            write_slice_native!(src, dst, u64, 8);
+            unsafe_write_slice_native!(src, dst, u64);
         } else {
             write_slice!(src, dst, u64, 8, Self::write_u64);
         }
@@ -2302,7 +2316,7 @@
     #[inline]
     fn write_u128_into(src: &[u128], dst: &mut [u8]) {
         if cfg!(target_endian = "little") {
-            write_slice_native!(src, dst, u128, 16);
+            unsafe_write_slice_native!(src, dst, u128);
         } else {
             write_slice!(src, dst, u128, 16, Self::write_u128);
         }