diff options
author | David LeGare <legare@google.com> | 2022-03-05 02:19:33 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-03-05 02:19:33 +0000 |
commit | 72e65b73c7ef7000dc2d17dd01186824c701bd42 (patch) | |
tree | 4bd872c7931921cfe12cc2fa1b72915778e481d3 | |
parent | 0f90a74cfab4221785a8f5e6771ec7b64284272b (diff) | |
parent | d97505630bfc2d27502dcffce98a1f6964aaf855 (diff) | |
download | futures-channel-android-13.0.0_r18.tar.gz |
Update futures-channel to 0.3.21 am: f7dc9c1e42 am: 99a38b94a8 am: d97505630bt_frc_odp_330442040t_frc_odp_330442000t_frc_ase_330444010android-13.0.0_r83android-13.0.0_r82android-13.0.0_r81android-13.0.0_r80android-13.0.0_r79android-13.0.0_r78android-13.0.0_r77android-13.0.0_r76android-13.0.0_r75android-13.0.0_r74android-13.0.0_r73android-13.0.0_r72android-13.0.0_r71android-13.0.0_r70android-13.0.0_r69android-13.0.0_r68android-13.0.0_r67android-13.0.0_r66android-13.0.0_r65android-13.0.0_r64android-13.0.0_r63android-13.0.0_r62android-13.0.0_r61android-13.0.0_r60android-13.0.0_r59android-13.0.0_r58android-13.0.0_r57android-13.0.0_r56android-13.0.0_r55android-13.0.0_r54android-13.0.0_r53android-13.0.0_r52android-13.0.0_r51android-13.0.0_r50android-13.0.0_r49android-13.0.0_r48android-13.0.0_r47android-13.0.0_r46android-13.0.0_r45android-13.0.0_r44android-13.0.0_r43android-13.0.0_r42android-13.0.0_r41android-13.0.0_r40android-13.0.0_r39android-13.0.0_r38android-13.0.0_r37android-13.0.0_r36android-13.0.0_r35android-13.0.0_r34android-13.0.0_r33android-13.0.0_r32android-13.0.0_r30android-13.0.0_r29android-13.0.0_r28android-13.0.0_r27android-13.0.0_r24android-13.0.0_r23android-13.0.0_r22android-13.0.0_r21android-13.0.0_r20android-13.0.0_r19android-13.0.0_r18android-13.0.0_r17android-13.0.0_r16aml_go_odp_330912000aml_go_ads_330915100aml_go_ads_330915000aml_go_ads_330913000android13-qpr3-s9-releaseandroid13-qpr3-s8-releaseandroid13-qpr3-s7-releaseandroid13-qpr3-s6-releaseandroid13-qpr3-s5-releaseandroid13-qpr3-s4-releaseandroid13-qpr3-s3-releaseandroid13-qpr3-s2-releaseandroid13-qpr3-s14-releaseandroid13-qpr3-s13-releaseandroid13-qpr3-s12-releaseandroid13-qpr3-s11-releaseandroid13-qpr3-s10-releaseandroid13-qpr3-s1-releaseandroid13-qpr3-releaseandroid13-qpr3-c-s8-releaseandroid13-qpr3-c-s7-releaseandroid13-qpr3-c-s6-releaseandroid13-qpr3-c-s5-releaseandroid13-qpr3-c-s4-releaseandroid13-qpr3-c-s3-releaseandroid13-qpr3-c-s2-releaseandroid13-qpr3-c-s12-releaseandroid13-qpr3-c-s11-releaseandroid13-qpr3-c-s10-releaseandroid13-qpr3-c-s1-releaseandroid13-qpr2-s9-releaseandroid13-qpr2-s8-releaseandroid13-qpr2-s7-releaseandroid13-qpr2-s6-releaseandroid13-qpr2-s5-releaseandroid13-qpr2-s3-releaseandroid13-qpr2-s2-releaseandroid13-qpr2-s12-releaseandroid13-qpr2-s11-releaseandroid13-qpr2-s10-releaseandroid13-qpr2-s1-releaseandroid13-qpr2-releaseandroid13-qpr2-b-s1-releaseandroid13-qpr1-s8-releaseandroid13-qpr1-s7-releaseandroid13-qpr1-s6-releaseandroid13-qpr1-s5-releaseandroid13-qpr1-s4-releaseandroid13-qpr1-s3-releaseandroid13-qpr1-s2-releaseandroid13-qpr1-s1-releaseandroid13-qpr1-releaseandroid13-mainline-go-adservices-releaseandroid13-frc-odp-releaseandroid13-devandroid13-d4-s2-releaseandroid13-d4-s1-releaseandroid13-d4-releaseandroid13-d3-s1-releaseandroid13-d2-release
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/futures-channel/+/2005931
Change-Id: I8291a944aff1c10ab0bd2cf9f7508080a56795b7
-rw-r--r-- | .cargo_vcs_info.json | 7 | ||||
-rw-r--r-- | Android.bp | 2 | ||||
-rw-r--r-- | Cargo.toml | 25 | ||||
-rw-r--r-- | Cargo.toml.orig | 9 | ||||
-rw-r--r-- | METADATA | 10 | ||||
-rw-r--r-- | README.md | 23 | ||||
-rw-r--r-- | build.rs | 21 | ||||
-rw-r--r-- | no_atomic_cas.rs | 2 | ||||
-rw-r--r-- | tests/mpsc-close.rs | 1 | ||||
-rw-r--r-- | tests/mpsc.rs | 25 | ||||
-rw-r--r-- | tests/oneshot.rs | 14 |
11 files changed, 101 insertions, 38 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index ffd4f55..deccf0d 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,5 +1,6 @@ { "git": { - "sha1": "7caefa51304e78fd5018cd5d2a03f3b9089cc010" - } -} + "sha1": "fc1e3250219170e31cddb8857a276cba7dd08d44" + }, + "path_in_vcs": "futures-channel" +}
\ No newline at end of file @@ -46,7 +46,7 @@ rust_library { host_supported: true, crate_name: "futures_channel", cargo_env_compat: true, - cargo_pkg_version: "0.3.17", + cargo_pkg_version: "0.3.21", srcs: ["src/lib.rs"], edition: "2018", features: [ @@ -11,23 +11,29 @@ [package] edition = "2018" +rust-version = "1.45" name = "futures-channel" -version = "0.3.17" -authors = ["Alex Crichton <alex@alexcrichton.com>"] -description = "Channels for asynchronous communication using futures-rs.\n" +version = "0.3.21" +description = """ +Channels for asynchronous communication using futures-rs. +""" homepage = "https://rust-lang.github.io/futures-rs" -documentation = "https://docs.rs/futures-channel/0.3" license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/futures-rs" + [package.metadata.docs.rs] all-features = true -rustdoc-args = ["--cfg", "docsrs"] +rustdoc-args = [ + "--cfg", + "docsrs", +] + [dependencies.futures-core] -version = "0.3.17" +version = "0.3.21" default-features = false [dependencies.futures-sink] -version = "0.3.17" +version = "0.3.21" optional = true default-features = false @@ -38,5 +44,8 @@ alloc = ["futures-core/alloc"] cfg-target-has-atomic = [] default = ["std"] sink = ["futures-sink"] -std = ["alloc", "futures-core/std"] +std = [ + "alloc", + "futures-core/std", +] unstable = [] diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 6bd240c..f356eab 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,12 +1,11 @@ [package] name = "futures-channel" +version = "0.3.21" edition = "2018" -version = "0.3.17" -authors = ["Alex Crichton <alex@alexcrichton.com>"] +rust-version = "1.45" license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/futures-rs" homepage = "https://rust-lang.github.io/futures-rs" -documentation = "https://docs.rs/futures-channel/0.3" description = """ Channels for asynchronous communication using futures-rs. """ @@ -23,8 +22,8 @@ unstable = [] cfg-target-has-atomic = [] [dependencies] -futures-core = { path = "../futures-core", version = "0.3.17", default-features = false } -futures-sink = { path = "../futures-sink", version = "0.3.17", default-features = false, optional = true } +futures-core = { path = "../futures-core", version = "0.3.21", default-features = false } +futures-sink = { path = "../futures-sink", version = "0.3.21", default-features = false, optional = true } [dev-dependencies] futures = { path = "../futures", default-features = true } @@ -7,13 +7,13 @@ third_party { } url { type: ARCHIVE - value: "https://static.crates.io/crates/futures-channel/futures-channel-0.3.17.crate" + value: "https://static.crates.io/crates/futures-channel/futures-channel-0.3.21.crate" } - version: "0.3.17" + version: "0.3.21" license_type: NOTICE last_upgrade_date { - year: 2021 - month: 9 - day: 22 + year: 2022 + month: 3 + day: 1 } } diff --git a/README.md b/README.md new file mode 100644 index 0000000..3287be9 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# futures-channel + +Channels for asynchronous communication using futures-rs. + +## Usage + +Add this to your `Cargo.toml`: + +```toml +[dependencies] +futures-channel = "0.3" +``` + +The current `futures-channel` requires Rust 1.45 or later. + +## License + +Licensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or +[MIT license](LICENSE-MIT) at your option. + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in the work by you, as defined in the Apache-2.0 license, shall +be dual licensed as above, without any additional terms or conditions. @@ -1,9 +1,3 @@ -#![warn(rust_2018_idioms, single_use_lifetimes)] - -use std::env; - -include!("no_atomic_cas.rs"); - // The rustc-cfg listed below are considered public API, but it is *unstable* // and outside of the normal semver guarantees: // @@ -13,10 +7,15 @@ include!("no_atomic_cas.rs"); // need to enable it manually when building for custom targets or using // non-cargo build systems that don't run the build script. // -// With the exceptions mentioned above, the rustc-cfg strings below are -// *not* public API. Please let us know by opening a GitHub issue if your build -// environment requires some way to enable these cfgs other than by executing -// our build script. +// With the exceptions mentioned above, the rustc-cfg emitted by the build +// script are *not* public API. + +#![warn(rust_2018_idioms, single_use_lifetimes)] + +use std::env; + +include!("no_atomic_cas.rs"); + fn main() { let target = match env::var("TARGET") { Ok(target) => target, @@ -34,7 +33,7 @@ fn main() { // `cfg(target_has_atomic = "ptr")` as true when the build script doesn't // run. This is needed for compatibility with non-cargo build systems that // don't run the build script. - if NO_ATOMIC_CAS_TARGETS.contains(&&*target) { + if NO_ATOMIC_CAS.contains(&&*target) { println!("cargo:rustc-cfg=futures_no_atomic_cas"); } diff --git a/no_atomic_cas.rs b/no_atomic_cas.rs index 4708bf8..9b05d4b 100644 --- a/no_atomic_cas.rs +++ b/no_atomic_cas.rs @@ -1,7 +1,7 @@ // This file is @generated by no_atomic_cas.sh. // It is not intended for manual editing. -const NO_ATOMIC_CAS_TARGETS: &[&str] = &[ +const NO_ATOMIC_CAS: &[&str] = &[ "avr-unknown-gnu-atmega328", "bpfeb-unknown-none", "bpfel-unknown-none", diff --git a/tests/mpsc-close.rs b/tests/mpsc-close.rs index 81203d3..1a14067 100644 --- a/tests/mpsc-close.rs +++ b/tests/mpsc-close.rs @@ -147,6 +147,7 @@ fn single_receiver_drop_closes_channel_and_drains() { // Stress test that `try_send()`s occurring concurrently with receiver // close/drops don't appear as successful sends. +#[cfg_attr(miri, ignore)] // Miri is too slow #[test] fn stress_try_send_as_receiver_closes() { const AMT: usize = 10000; diff --git a/tests/mpsc.rs b/tests/mpsc.rs index 88cdef1..da0899d 100644 --- a/tests/mpsc.rs +++ b/tests/mpsc.rs @@ -200,6 +200,9 @@ fn tx_close_gets_none() { #[test] fn stress_shared_unbounded() { + #[cfg(miri)] + const AMT: u32 = 100; + #[cfg(not(miri))] const AMT: u32 = 10000; const NTHREADS: u32 = 8; let (tx, rx) = mpsc::unbounded::<i32>(); @@ -229,6 +232,9 @@ fn stress_shared_unbounded() { #[test] fn stress_shared_bounded_hard() { + #[cfg(miri)] + const AMT: u32 = 100; + #[cfg(not(miri))] const AMT: u32 = 10000; const NTHREADS: u32 = 8; let (tx, rx) = mpsc::channel::<i32>(0); @@ -259,6 +265,9 @@ fn stress_shared_bounded_hard() { #[allow(clippy::same_item_push)] #[test] fn stress_receiver_multi_task_bounded_hard() { + #[cfg(miri)] + const AMT: usize = 100; + #[cfg(not(miri))] const AMT: usize = 10_000; const NTHREADS: u32 = 2; @@ -327,6 +336,11 @@ fn stress_receiver_multi_task_bounded_hard() { /// after sender dropped. #[test] fn stress_drop_sender() { + #[cfg(miri)] + const ITER: usize = 100; + #[cfg(not(miri))] + const ITER: usize = 10000; + fn list() -> impl Stream<Item = i32> { let (tx, rx) = mpsc::channel(1); thread::spawn(move || { @@ -335,7 +349,7 @@ fn stress_drop_sender() { rx } - for _ in 0..10000 { + for _ in 0..ITER { let v: Vec<_> = block_on(list().collect()); assert_eq!(v, vec![1, 2, 3]); } @@ -380,9 +394,12 @@ fn stress_close_receiver_iter() { } } +#[cfg_attr(miri, ignore)] // Miri is too slow #[test] fn stress_close_receiver() { - for _ in 0..10000 { + const ITER: usize = 10000; + + for _ in 0..ITER { stress_close_receiver_iter(); } } @@ -397,6 +414,9 @@ async fn stress_poll_ready_sender(mut sender: mpsc::Sender<u32>, count: u32) { #[allow(clippy::same_item_push)] #[test] fn stress_poll_ready() { + #[cfg(miri)] + const AMT: u32 = 100; + #[cfg(not(miri))] const AMT: u32 = 1000; const NTHREADS: u32 = 8; @@ -424,6 +444,7 @@ fn stress_poll_ready() { stress(16); } +#[cfg_attr(miri, ignore)] // Miri is too slow #[test] fn try_send_1() { const N: usize = 3000; diff --git a/tests/oneshot.rs b/tests/oneshot.rs index 979cd8a..c9f5508 100644 --- a/tests/oneshot.rs +++ b/tests/oneshot.rs @@ -35,6 +35,11 @@ fn cancel_notifies() { #[test] fn cancel_lots() { + #[cfg(miri)] + const N: usize = 100; + #[cfg(not(miri))] + const N: usize = 20000; + let (tx, rx) = mpsc::channel::<(Sender<_>, mpsc::Sender<_>)>(); let t = thread::spawn(move || { for (mut tx, tx2) in rx { @@ -43,7 +48,7 @@ fn cancel_lots() { } }); - for _ in 0..20000 { + for _ in 0..N { let (otx, orx) = oneshot::channel::<u32>(); let (tx2, rx2) = mpsc::channel(); tx.send((otx, tx2)).unwrap(); @@ -101,6 +106,11 @@ fn is_canceled() { #[test] fn cancel_sends() { + #[cfg(miri)] + const N: usize = 100; + #[cfg(not(miri))] + const N: usize = 20000; + let (tx, rx) = mpsc::channel::<Sender<_>>(); let t = thread::spawn(move || { for otx in rx { @@ -108,7 +118,7 @@ fn cancel_sends() { } }); - for _ in 0..20000 { + for _ in 0..N { let (otx, mut orx) = oneshot::channel::<u32>(); tx.send(otx).unwrap(); |