Skip to content

Commit 4d850b9

Browse files
authored
Merge pull request #709 from erickt/fuchsia-0.5
Replace uses of fuchsia-zircon with fuchsia-cprng in rand-0.5
2 parents 317651c + d4bbb3e commit 4d850b9

File tree

4 files changed

+12
-22
lines changed

4 files changed

+12
-22
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ A [separate changelog is kept for rand_core](rand_core/CHANGELOG.md).
99
You may also find the [Update Guide](UPDATING.md) useful.
1010

1111

12+
## [0.5.6] - 2019-01-25
13+
### Platforms
14+
- Fuchsia: Replaced fuchsia-zircon with fuchsia-cprng
15+
16+
1217
## [0.5.5] - 2018-08-07
1318
### Documentation
1419
- Fix links in documentation (#582)

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rand"
3-
version = "0.5.5" # NB: When modifying, also modify html_root_url in lib.rs
3+
version = "0.5.6" # NB: When modifying, also modify html_root_url in lib.rs
44
authors = ["The Rust Project Developers"]
55
license = "MIT/Apache-2.0"
66
readme = "README.md"
@@ -20,7 +20,7 @@ appveyor = { repository = "alexcrichton/rand" }
2020
[features]
2121
default = ["std" ] # without "std" rand uses libcore
2222
nightly = ["i128_support"] # enables all features requiring nightly rust
23-
std = ["rand_core/std", "alloc", "libc", "winapi", "cloudabi", "fuchsia-zircon"]
23+
std = ["rand_core/std", "alloc", "libc", "winapi", "cloudabi", "fuchsia-cprng"]
2424
alloc = ["rand_core/alloc"] # enables Vec and Box support (without std)
2525
i128_support = [] # enables i128 and u128 support
2626
serde1 = ["serde", "serde_derive", "rand_core/serde1"] # enables serialization for PRNGs
@@ -44,7 +44,7 @@ winapi = { version = "0.3", features = ["minwindef", "ntsecapi", "profileapi", "
4444
cloudabi = { version = "0.0.3", optional = true }
4545

4646
[target.'cfg(target_os = "fuchsia")'.dependencies]
47-
fuchsia-zircon = { version = "0.3.2", optional = true }
47+
fuchsia-cprng = { version = "0.1.0", optional = true }
4848

4949
[target.wasm32-unknown-unknown.dependencies]
5050
# use with `--target wasm32-unknown-unknown --features=stdweb`

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224

225225
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
226226
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
227-
html_root_url = "https://docs.rs/rand/0.5.5")]
227+
html_root_url = "https://docs.rs/rand/0.5.6")]
228228

229229
#![deny(missing_docs)]
230230
#![deny(missing_debug_implementations)]

src/rngs/os.rs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -924,9 +924,9 @@ mod imp {
924924

925925
#[cfg(target_os = "fuchsia")]
926926
mod imp {
927-
extern crate fuchsia_zircon;
927+
extern crate fuchsia_cprng;
928928

929-
use {Error, ErrorKind};
929+
use Error;
930930
use super::OsRngImpl;
931931

932932
#[derive(Clone, Debug)]
@@ -936,25 +936,10 @@ mod imp {
936936
fn new() -> Result<OsRng, Error> { Ok(OsRng) }
937937

938938
fn fill_chunk(&mut self, dest: &mut [u8]) -> Result<(), Error> {
939-
let mut read = 0;
940-
while read < dest.len() {
941-
match fuchsia_zircon::cprng_draw(&mut dest[read..]) {
942-
Ok(actual) => read += actual,
943-
Err(e) => {
944-
return Err(Error::with_cause(
945-
ErrorKind::Unavailable,
946-
"cprng_draw failed",
947-
e.into_io_error()));
948-
}
949-
};
950-
}
939+
fuchsia_cprng::cprng_draw(dest);
951940
Ok(())
952941
}
953942

954-
fn max_chunk_size(&self) -> usize {
955-
fuchsia_zircon::sys::ZX_CPRNG_DRAW_MAX_LEN
956-
}
957-
958943
fn method_str(&self) -> &'static str { "cprng_draw" }
959944
}
960945
}

0 commit comments

Comments
 (0)