Merge pull request #709 from erickt/fuchsia-0.5

Replace uses of fuchsia-zircon with fuchsia-cprng in rand-0.5
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 282f77f..4a09a5d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,11 @@
 You may also find the [Update Guide](UPDATING.md) useful.
 
 
+## [0.5.6] - 2019-01-25
+### Platforms
+- Fuchsia: Replaced fuchsia-zircon with fuchsia-cprng
+
+
 ## [0.5.5] - 2018-08-07
 ### Documentation
 - Fix links in documentation (#582)
diff --git a/Cargo.toml b/Cargo.toml
index de07f59..3301ffa 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "rand"
-version = "0.5.5" # NB: When modifying, also modify html_root_url in lib.rs
+version = "0.5.6" # NB: When modifying, also modify html_root_url in lib.rs
 authors = ["The Rust Project Developers"]
 license = "MIT/Apache-2.0"
 readme = "README.md"
@@ -20,7 +20,7 @@
 [features]
 default = ["std" ] # without "std" rand uses libcore
 nightly = ["i128_support"] # enables all features requiring nightly rust
-std = ["rand_core/std", "alloc", "libc", "winapi", "cloudabi", "fuchsia-zircon"]
+std = ["rand_core/std", "alloc", "libc", "winapi", "cloudabi", "fuchsia-cprng"]
 alloc = ["rand_core/alloc"]  # enables Vec and Box support (without std)
 i128_support = [] # enables i128 and u128 support
 serde1 = ["serde", "serde_derive", "rand_core/serde1"] # enables serialization for PRNGs
@@ -44,7 +44,7 @@
 cloudabi = { version = "0.0.3", optional = true }
 
 [target.'cfg(target_os = "fuchsia")'.dependencies]
-fuchsia-zircon = { version = "0.3.2", optional = true }
+fuchsia-cprng = { version = "0.1.0", optional = true }
 
 [target.wasm32-unknown-unknown.dependencies]
 # use with `--target wasm32-unknown-unknown --features=stdweb`
diff --git a/src/lib.rs b/src/lib.rs
index e1bd790..a1eb469 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -224,7 +224,7 @@
 
 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
        html_favicon_url = "https://www.rust-lang.org/favicon.ico",
-       html_root_url = "https://docs.rs/rand/0.5.5")]
+       html_root_url = "https://docs.rs/rand/0.5.6")]
 
 #![deny(missing_docs)]
 #![deny(missing_debug_implementations)]
diff --git a/src/rngs/os.rs b/src/rngs/os.rs
index 7e1945b..ecc5f32 100644
--- a/src/rngs/os.rs
+++ b/src/rngs/os.rs
@@ -924,9 +924,9 @@
 
 #[cfg(target_os = "fuchsia")]
 mod imp {
-    extern crate fuchsia_zircon;
+    extern crate fuchsia_cprng;
 
-    use {Error, ErrorKind};
+    use Error;
     use super::OsRngImpl;
 
     #[derive(Clone, Debug)]
@@ -936,25 +936,10 @@
         fn new() -> Result<OsRng, Error> { Ok(OsRng) }
 
         fn fill_chunk(&mut self, dest: &mut [u8]) -> Result<(), Error> {
-            let mut read = 0;
-            while read < dest.len() {
-                match fuchsia_zircon::cprng_draw(&mut dest[read..]) {
-                    Ok(actual) => read += actual,
-                    Err(e) => {
-                        return Err(Error::with_cause(
-                            ErrorKind::Unavailable,
-                            "cprng_draw failed",
-                            e.into_io_error()));
-                    }
-                };
-            }
+            fuchsia_cprng::cprng_draw(dest);
             Ok(())
         }
 
-        fn max_chunk_size(&self) -> usize {
-            fuchsia_zircon::sys::ZX_CPRNG_DRAW_MAX_LEN
-        }
-
         fn method_str(&self) -> &'static str { "cprng_draw" }
     }
 }