aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Galenson <jgalenson@google.com>2021-07-02 22:21:27 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-07-02 22:21:27 +0000
commit9798e8c92187bb3b824d79e72f78b2c12bd15bd9 (patch)
tree2b15f3e218f5e80220d37701bda0babfdcce9f44
parent2457aa51b16f4a626de7116e327103d3cf15c76b (diff)
parentb73ecfa75f4b9579dde4123d1be3687cc79e3d55 (diff)
downloadrand_core-9798e8c92187bb3b824d79e72f78b2c12bd15bd9.tar.gz
Upgrade rust/crates/rand_core to 0.6.3 am: fe04fdcde4 am: b73ecfa75f
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/rand_core/+/1740265 Change-Id: I89222a11943718fd2d2e7414ee9889f22b9c5d69
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Android.bp5
-rw-r--r--CHANGELOG.md5
-rw-r--r--Cargo.toml2
-rw-r--r--Cargo.toml.orig2
-rw-r--r--METADATA8
-rw-r--r--TEST_MAPPING229
-rw-r--r--src/block.rs6
-rw-r--r--src/lib.rs9
9 files changed, 255 insertions, 13 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 3fd44e0..7f98fc0 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
{
"git": {
- "sha1": "3a03c9eb5350e03a3f540dba2ee34e0984f2c2c2"
+ "sha1": "8792268dfe57e49bb4518190bf4fe66176759a44"
}
}
diff --git a/Android.bp b/Android.bp
index 67a44cc..f530d1f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,4 +1,5 @@
// This file is generated by cargo2android.py --device --run --features=std --dependencies --tests.
+// Do not modify this file as changes will be overridden on upgrade.
package {
default_applicable_licenses: ["external_rust_crates_rand_core_license"],
@@ -85,5 +86,5 @@ rust_test {
// dependent_library ["feature_list"]
// cfg-if-1.0.0
-// getrandom-0.2.2 "std"
-// libc-0.2.86
+// getrandom-0.2.3 "std"
+// libc-0.2.97
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 23d1fa5..82c8300 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [0.6.3] - 2021-06-15
+### Changed
+- Improved bound for `serde` impls on `BlockRng` (#1130)
+- Minor doc additions (#1118)
+
## [0.6.2] - 2021-02-12
### Fixed
- Fixed assertions in `le::read_u32_into` and `le::read_u64_into` which could
diff --git a/Cargo.toml b/Cargo.toml
index 51b8385..06ba1e8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
[package]
edition = "2018"
name = "rand_core"
-version = "0.6.2"
+version = "0.6.3"
authors = ["The Rand Project Developers", "The Rust Project Developers"]
description = "Core random number generator traits and tools for implementation.\n"
homepage = "https://rust-random.github.io/book"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index d460757..6604bc5 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "rand_core"
-version = "0.6.2"
+version = "0.6.3"
authors = ["The Rand Project Developers", "The Rust Project Developers"]
license = "MIT OR Apache-2.0"
readme = "README.md"
diff --git a/METADATA b/METADATA
index 0e7aa20..6c047cf 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/rand_core/rand_core-0.6.2.crate"
+ value: "https://static.crates.io/crates/rand_core/rand_core-0.6.3.crate"
}
- version: "0.6.2"
+ version: "0.6.3"
license_type: NOTICE
last_upgrade_date {
year: 2021
- month: 2
- day: 17
+ month: 6
+ day: 21
}
}
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 963506b..a8cbf10 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -2,16 +2,241 @@
{
"presubmit": [
{
- "name": "rand_xorshift_device_test_tests_mod"
+ "name": "crossbeam-epoch_device_test_src_lib"
+ },
+ {
+ "name": "crossbeam-epoch_device_test_tests_loom"
+ },
+ {
+ "name": "crossbeam-utils_device_test_src_lib"
+ },
+ {
+ "name": "crossbeam-utils_device_test_tests_atomic_cell"
+ },
+ {
+ "name": "crossbeam-utils_device_test_tests_cache_padded"
+ },
+ {
+ "name": "crossbeam-utils_device_test_tests_parker"
+ },
+ {
+ "name": "crossbeam-utils_device_test_tests_sharded_lock"
+ },
+ {
+ "name": "crossbeam-utils_device_test_tests_thread"
+ },
+ {
+ "name": "crossbeam-utils_device_test_tests_wait_group"
},
{
"name": "keystore2_test"
},
{
+ "name": "rand_core_device_test_src_lib"
+ },
+ {
"name": "rand_xorshift_device_test_src_lib"
},
{
- "name": "rand_core_device_test_src_lib"
+ "name": "rand_xorshift_device_test_tests_mod"
+ },
+ {
+ "name": "tokio_device_test_tests__require_full"
+ },
+ {
+ "name": "tokio_device_test_tests_buffered"
+ },
+ {
+ "name": "tokio_device_test_tests_io_async_fd"
+ },
+ {
+ "name": "tokio_device_test_tests_io_async_read"
+ },
+ {
+ "name": "tokio_device_test_tests_io_chain"
+ },
+ {
+ "name": "tokio_device_test_tests_io_copy"
+ },
+ {
+ "name": "tokio_device_test_tests_io_copy_bidirectional"
+ },
+ {
+ "name": "tokio_device_test_tests_io_driver"
+ },
+ {
+ "name": "tokio_device_test_tests_io_driver_drop"
+ },
+ {
+ "name": "tokio_device_test_tests_io_lines"
+ },
+ {
+ "name": "tokio_device_test_tests_io_mem_stream"
+ },
+ {
+ "name": "tokio_device_test_tests_io_read"
+ },
+ {
+ "name": "tokio_device_test_tests_io_read_buf"
+ },
+ {
+ "name": "tokio_device_test_tests_io_read_exact"
+ },
+ {
+ "name": "tokio_device_test_tests_io_read_line"
+ },
+ {
+ "name": "tokio_device_test_tests_io_read_to_end"
+ },
+ {
+ "name": "tokio_device_test_tests_io_read_to_string"
+ },
+ {
+ "name": "tokio_device_test_tests_io_read_until"
+ },
+ {
+ "name": "tokio_device_test_tests_io_split"
+ },
+ {
+ "name": "tokio_device_test_tests_io_take"
+ },
+ {
+ "name": "tokio_device_test_tests_io_write"
+ },
+ {
+ "name": "tokio_device_test_tests_io_write_all"
+ },
+ {
+ "name": "tokio_device_test_tests_io_write_buf"
+ },
+ {
+ "name": "tokio_device_test_tests_io_write_int"
+ },
+ {
+ "name": "tokio_device_test_tests_macros_join"
+ },
+ {
+ "name": "tokio_device_test_tests_macros_pin"
+ },
+ {
+ "name": "tokio_device_test_tests_macros_select"
+ },
+ {
+ "name": "tokio_device_test_tests_macros_test"
+ },
+ {
+ "name": "tokio_device_test_tests_macros_try_join"
+ },
+ {
+ "name": "tokio_device_test_tests_net_bind_resource"
+ },
+ {
+ "name": "tokio_device_test_tests_net_lookup_host"
+ },
+ {
+ "name": "tokio_device_test_tests_no_rt"
+ },
+ {
+ "name": "tokio_device_test_tests_process_kill_on_drop"
+ },
+ {
+ "name": "tokio_device_test_tests_rt_basic"
+ },
+ {
+ "name": "tokio_device_test_tests_rt_common"
+ },
+ {
+ "name": "tokio_device_test_tests_rt_threaded"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_barrier"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_broadcast"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_errors"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_mpsc"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_mutex"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_mutex_owned"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_notify"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_oneshot"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_rwlock"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_semaphore"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_semaphore_owned"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_watch"
+ },
+ {
+ "name": "tokio_device_test_tests_task_abort"
+ },
+ {
+ "name": "tokio_device_test_tests_task_blocking"
+ },
+ {
+ "name": "tokio_device_test_tests_task_local"
+ },
+ {
+ "name": "tokio_device_test_tests_task_local_set"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_accept"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_connect"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_echo"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_into_split"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_into_std"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_peek"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_shutdown"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_socket"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_split"
+ },
+ {
+ "name": "tokio_device_test_tests_time_rt"
+ },
+ {
+ "name": "tokio_device_test_tests_udp"
+ },
+ {
+ "name": "tokio_device_test_tests_uds_cred"
+ },
+ {
+ "name": "tokio_device_test_tests_uds_split"
+ },
+ {
+ "name": "vpnprofilestore_test"
}
]
}
diff --git a/src/block.rs b/src/block.rs
index 005d071..a54cadf 100644
--- a/src/block.rs
+++ b/src/block.rs
@@ -114,6 +114,12 @@ pub trait BlockRngCore {
/// [`try_fill_bytes`]: RngCore::try_fill_bytes
#[derive(Clone)]
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))]
+#[cfg_attr(
+ feature = "serde1",
+ serde(
+ bound = "for<'x> R: Serialize + Deserialize<'x> + Sized, for<'x> R::Results: Serialize + Deserialize<'x>"
+ )
+)]
pub struct BlockRng<R: BlockRngCore + ?Sized> {
results: R::Results,
index: usize,
diff --git a/src/lib.rs b/src/lib.rs
index 7e847ae..bc24270 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -76,12 +76,17 @@ pub mod le;
/// [`next_u32`] or [`next_u64`] since the latter methods are almost always used
/// with algorithmic generators (PRNGs), which are normally infallible.
///
+/// Implementers should produce bits uniformly. Pathological RNGs (e.g. always
+/// returning the same value, or never setting certain bits) can break rejection
+/// sampling used by random distributions, and also break other RNGs when
+/// seeding them via [`SeedableRng::from_rng`].
+///
/// Algorithmic generators implementing [`SeedableRng`] should normally have
/// *portable, reproducible* output, i.e. fix Endianness when converting values
/// to avoid platform differences, and avoid making any changes which affect
/// output (except by communicating that the release has breaking changes).
///
-/// Typically implementators will implement only one of the methods available
+/// Typically an RNG will implement only one of the methods available
/// in this trait directly, then use the helper functions from the
/// [`impls`] module to implement the other methods.
///
@@ -480,7 +485,7 @@ mod test {
// This is the binomial distribution B(64, 0.5), so chance of
// weight < 20 is binocdf(19, 64, 0.5) = 7.8e-4, and same for
// weight > 44.
- assert!(weight >= 20 && weight <= 44);
+ assert!((20..=44).contains(&weight));
for (i2, r2) in results.iter().enumerate() {
if i1 == i2 {