summaryrefslogtreecommitdiffstats
path: root/vendor/futures-channel
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:29 +0000
commit631cd5845e8de329d0e227aaa707d7ea228b8f8f (patch)
treea1b87c8f8cad01cf18f7c5f57a08f102771ed303 /vendor/futures-channel
parentAdding debian version 1.69.0+dfsg1-1. (diff)
downloadrustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.tar.xz
rustc-631cd5845e8de329d0e227aaa707d7ea228b8f8f.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/futures-channel')
-rw-r--r--vendor/futures-channel/.cargo-checksum.json2
-rw-r--r--vendor/futures-channel/Cargo.toml25
-rw-r--r--vendor/futures-channel/README.md2
-rw-r--r--vendor/futures-channel/build.rs21
-rw-r--r--vendor/futures-channel/no_atomic_cas.rs6
-rw-r--r--vendor/futures-channel/src/mpsc/mod.rs71
-rw-r--r--vendor/futures-channel/src/mpsc/queue.rs2
-rw-r--r--vendor/futures-channel/src/oneshot.rs4
-rw-r--r--vendor/futures-channel/tests/mpsc-close.rs1
-rw-r--r--vendor/futures-channel/tests/mpsc-size_hint.rs40
-rw-r--r--vendor/futures-channel/tests/mpsc.rs18
-rw-r--r--vendor/futures-channel/tests/oneshot.rs8
12 files changed, 156 insertions, 44 deletions
diff --git a/vendor/futures-channel/.cargo-checksum.json b/vendor/futures-channel/.cargo-checksum.json
index 4b321d3c3..464d87435 100644
--- a/vendor/futures-channel/.cargo-checksum.json
+++ b/vendor/futures-channel/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"2843b3fc245065891decdfce5244144f4b8a3e35d0d9499db431073930e9b550","LICENSE-APACHE":"275c491d6d1160553c32fd6127061d7f9606c3ea25abfad6ca3f6ed088785427","LICENSE-MIT":"6652c868f35dfe5e8ef636810a4e576b9d663f3a17fb0f5613ad73583e1b88fd","README.md":"fb9330147e41a15b5e569b8bad7692628be89b5fc219a5323a57fa63024c1684","benches/sync_mpsc.rs":"1019dd027f104f58883f396ff70efc3dd69b3a7d62df17af090e07b2b05eaf66","build.rs":"f6e21c09f18cc405bd7048cb7a2958f92d5414b9ca6b301d137e120a84fa020a","no_atomic_cas.rs":"ff8be002b49a5cd9e4ca0db17b1c9e6b98e55f556319eb6b953dd6ff52c397a6","src/lib.rs":"2955e70d292208747fbb29810ef88f390f0f1b22b112fa59d60f95480d470e75","src/lock.rs":"38655a797456ea4f67d132c42055cf74f18195e875c3b337fc81a12901f79292","src/mpsc/mod.rs":"71c8fb3ac645bc587684a9e115b8859044acbade540299a1f9dd952aa27d6ba5","src/mpsc/queue.rs":"8822f466e7fe5a8d25ba994b7022ad7c14bcfd473d354a6cd0490240d3e170e7","src/mpsc/sink_impl.rs":"c9977b530187e82c912fcd46e08316e48ed246e77bb2419d53020e69e403d086","src/oneshot.rs":"d1170289b39656ea5f0d5f42b905ddbd5fa9c1202aa3297c9f25280a48229910","tests/channel.rs":"88f4a41d82b5c1b01e153d071a2bf48e0697355908c55ca42342ed45e63fdec8","tests/mpsc-close.rs":"456e43d3b4aad317c84da81297b05743609af57b26d10470e478f1677e4bf731","tests/mpsc.rs":"c929860c11be704692e709c10a3f5e046d6c01df2cacf568983419cdf82aab97","tests/oneshot.rs":"c44b90681c577f8d0c88e810e883328eefec1d4346b9aa615fa47cc3a7c25c01"},"package":"ba3dda0b6588335f360afc675d0564c17a77a2bda81ca178a4b6081bd86c7f0b"} \ No newline at end of file
+{"files":{"Cargo.toml":"b9e4a55febf64f3b1e637d4e7e2fe7efcf9963c1c10d1e62e989e0ebd491e914","LICENSE-APACHE":"275c491d6d1160553c32fd6127061d7f9606c3ea25abfad6ca3f6ed088785427","LICENSE-MIT":"6652c868f35dfe5e8ef636810a4e576b9d663f3a17fb0f5613ad73583e1b88fd","README.md":"faccd17503a06e7df67feb53da22dba6a8ea80ee88736ed37fae038d0d0906dd","benches/sync_mpsc.rs":"1019dd027f104f58883f396ff70efc3dd69b3a7d62df17af090e07b2b05eaf66","build.rs":"5b263bd2bd587511a9c8daef580b05e0613c15a6c5f800b1e5bc145fa013d99e","no_atomic_cas.rs":"7ae747b83b08dd926c1696faf4ecab9399c652ae77d5179221258c73b8eecb6f","src/lib.rs":"2955e70d292208747fbb29810ef88f390f0f1b22b112fa59d60f95480d470e75","src/lock.rs":"38655a797456ea4f67d132c42055cf74f18195e875c3b337fc81a12901f79292","src/mpsc/mod.rs":"2991f3972780fd16b1aaac3a1b5a489112cd7114a2e8bcaa67cc35d7ab3d8866","src/mpsc/queue.rs":"0856f8b744c537c291d60cc7879ddb2d8cd686a6ac0e4a79c6877f8c3f8f6dbc","src/mpsc/sink_impl.rs":"c9977b530187e82c912fcd46e08316e48ed246e77bb2419d53020e69e403d086","src/oneshot.rs":"c7b5224d52b8c257baf23c385442503ad2ebfccd75ed894e7a4a259097ac9cb5","tests/channel.rs":"88f4a41d82b5c1b01e153d071a2bf48e0697355908c55ca42342ed45e63fdec8","tests/mpsc-close.rs":"cb3a427403051a731701de5d2a489f8a7b7a5eaceb5edfafef4a539e63588d3c","tests/mpsc-size_hint.rs":"50fba3495bdf4e91a84ad105b148b6cd72f73f64a85703414eeb2d07732c66b9","tests/mpsc.rs":"8b0caa7a6c45c0878e0384485b848ac496e4bcd75a0de598e0aee5246348a71b","tests/oneshot.rs":"0f97d28852a1fd1327211772f43322c93916a639be3f2581e49ad37c9f8a2f88"},"package":"955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2"} \ No newline at end of file
diff --git a/vendor/futures-channel/Cargo.toml b/vendor/futures-channel/Cargo.toml
index 99454ccaa..a9f2c430d 100644
--- a/vendor/futures-channel/Cargo.toml
+++ b/vendor/futures-channel/Cargo.toml
@@ -11,22 +11,30 @@
[package]
edition = "2018"
-rust-version = "1.45"
+rust-version = "1.56"
name = "futures-channel"
-version = "0.3.19"
-description = "Channels for asynchronous communication using futures-rs.\n"
+version = "0.3.28"
+description = """
+Channels for asynchronous communication using futures-rs.
+"""
homepage = "https://rust-lang.github.io/futures-rs"
+readme = "README.md"
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.19"
+version = "0.3.28"
default-features = false
[dependencies.futures-sink]
-version = "0.3.19"
+version = "0.3.28"
optional = true
default-features = false
@@ -37,5 +45,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/vendor/futures-channel/README.md b/vendor/futures-channel/README.md
index 3287be924..e886bd1ca 100644
--- a/vendor/futures-channel/README.md
+++ b/vendor/futures-channel/README.md
@@ -11,7 +11,7 @@ Add this to your `Cargo.toml`:
futures-channel = "0.3"
```
-The current `futures-channel` requires Rust 1.45 or later.
+The current `futures-channel` requires Rust 1.56 or later.
## License
diff --git a/vendor/futures-channel/build.rs b/vendor/futures-channel/build.rs
index 07b50bd55..05e0496d9 100644
--- a/vendor/futures-channel/build.rs
+++ b/vendor/futures-channel/build.rs
@@ -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/vendor/futures-channel/no_atomic_cas.rs b/vendor/futures-channel/no_atomic_cas.rs
index 4708bf853..16ec628cd 100644
--- a/vendor/futures-channel/no_atomic_cas.rs
+++ b/vendor/futures-channel/no_atomic_cas.rs
@@ -1,13 +1,17 @@
// 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] = &[
+ "armv4t-none-eabi",
+ "armv5te-none-eabi",
"avr-unknown-gnu-atmega328",
"bpfeb-unknown-none",
"bpfel-unknown-none",
"msp430-none-elf",
"riscv32i-unknown-none-elf",
+ "riscv32im-unknown-none-elf",
"riscv32imc-unknown-none-elf",
"thumbv4t-none-eabi",
+ "thumbv5te-none-eabi",
"thumbv6m-none-eabi",
];
diff --git a/vendor/futures-channel/src/mpsc/mod.rs b/vendor/futures-channel/src/mpsc/mod.rs
index 44834b7c9..cf45fe77f 100644
--- a/vendor/futures-channel/src/mpsc/mod.rs
+++ b/vendor/futures-channel/src/mpsc/mod.rs
@@ -94,13 +94,11 @@ mod queue;
#[cfg(feature = "sink")]
mod sink_impl;
-#[derive(Debug)]
struct UnboundedSenderInner<T> {
// Channel state shared between the sender and receiver.
inner: Arc<UnboundedInner<T>>,
}
-#[derive(Debug)]
struct BoundedSenderInner<T> {
// Channel state shared between the sender and receiver.
inner: Arc<BoundedInner<T>>,
@@ -122,13 +120,11 @@ impl<T> Unpin for BoundedSenderInner<T> {}
/// The transmission end of a bounded mpsc channel.
///
/// This value is created by the [`channel`](channel) function.
-#[derive(Debug)]
pub struct Sender<T>(Option<BoundedSenderInner<T>>);
/// The transmission end of an unbounded mpsc channel.
///
/// This value is created by the [`unbounded`](unbounded) function.
-#[derive(Debug)]
pub struct UnboundedSender<T>(Option<UnboundedSenderInner<T>>);
trait AssertKinds: Send + Sync + Clone {}
@@ -137,7 +133,6 @@ impl AssertKinds for UnboundedSender<u32> {}
/// The receiving end of a bounded mpsc channel.
///
/// This value is created by the [`channel`](channel) function.
-#[derive(Debug)]
pub struct Receiver<T> {
inner: Option<Arc<BoundedInner<T>>>,
}
@@ -145,7 +140,6 @@ pub struct Receiver<T> {
/// The receiving end of an unbounded mpsc channel.
///
/// This value is created by the [`unbounded`](unbounded) function.
-#[derive(Debug)]
pub struct UnboundedReceiver<T> {
inner: Option<Arc<UnboundedInner<T>>>,
}
@@ -261,7 +255,6 @@ impl fmt::Display for TryRecvError {
impl std::error::Error for TryRecvError {}
-#[derive(Debug)]
struct UnboundedInner<T> {
// Internal channel state. Consists of the number of messages stored in the
// channel as well as a flag signalling that the channel is closed.
@@ -277,7 +270,6 @@ struct UnboundedInner<T> {
recv_task: AtomicWaker,
}
-#[derive(Debug)]
struct BoundedInner<T> {
// Max buffer size of the channel. If `None` then the channel is unbounded.
buffer: usize,
@@ -300,7 +292,7 @@ struct BoundedInner<T> {
}
// Struct representation of `Inner::state`.
-#[derive(Debug, Clone, Copy)]
+#[derive(Clone, Copy)]
struct State {
// `true` when the channel is open
is_open: bool,
@@ -324,7 +316,6 @@ const MAX_CAPACITY: usize = !(OPEN_MASK);
const MAX_BUFFER: usize = MAX_CAPACITY >> 1;
// Sent to the consumer to wake up blocked producers
-#[derive(Debug)]
struct SenderTask {
task: Option<Waker>,
is_parked: bool,
@@ -947,6 +938,18 @@ impl<T> Drop for BoundedSenderInner<T> {
}
}
+impl<T> fmt::Debug for Sender<T> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.debug_struct("Sender").field("closed", &self.is_closed()).finish()
+ }
+}
+
+impl<T> fmt::Debug for UnboundedSender<T> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.debug_struct("UnboundedSender").field("closed", &self.is_closed()).finish()
+ }
+}
+
/*
*
* ===== impl Receiver =====
@@ -1075,6 +1078,14 @@ impl<T> Stream for Receiver<T> {
}
}
}
+
+ fn size_hint(&self) -> (usize, Option<usize>) {
+ if let Some(inner) = &self.inner {
+ decode_state(inner.state.load(SeqCst)).size_hint()
+ } else {
+ (0, Some(0))
+ }
+ }
}
impl<T> Drop for Receiver<T> {
@@ -1107,6 +1118,18 @@ impl<T> Drop for Receiver<T> {
}
}
+impl<T> fmt::Debug for Receiver<T> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ let closed = if let Some(ref inner) = self.inner {
+ decode_state(inner.state.load(SeqCst)).is_closed()
+ } else {
+ false
+ };
+
+ f.debug_struct("Receiver").field("closed", &closed).finish()
+ }
+}
+
impl<T> UnboundedReceiver<T> {
/// Closes the receiving half of a channel, without dropping it.
///
@@ -1207,6 +1230,14 @@ impl<T> Stream for UnboundedReceiver<T> {
}
}
}
+
+ fn size_hint(&self) -> (usize, Option<usize>) {
+ if let Some(inner) = &self.inner {
+ decode_state(inner.state.load(SeqCst)).size_hint()
+ } else {
+ (0, Some(0))
+ }
+ }
}
impl<T> Drop for UnboundedReceiver<T> {
@@ -1239,6 +1270,18 @@ impl<T> Drop for UnboundedReceiver<T> {
}
}
+impl<T> fmt::Debug for UnboundedReceiver<T> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ let closed = if let Some(ref inner) = self.inner {
+ decode_state(inner.state.load(SeqCst)).is_closed()
+ } else {
+ false
+ };
+
+ f.debug_struct("Receiver").field("closed", &closed).finish()
+ }
+}
+
/*
*
* ===== impl Inner =====
@@ -1285,6 +1328,14 @@ impl State {
fn is_closed(&self) -> bool {
!self.is_open && self.num_messages == 0
}
+
+ fn size_hint(&self) -> (usize, Option<usize>) {
+ if self.is_open {
+ (self.num_messages, None)
+ } else {
+ (self.num_messages, Some(self.num_messages))
+ }
+ }
}
/*
diff --git a/vendor/futures-channel/src/mpsc/queue.rs b/vendor/futures-channel/src/mpsc/queue.rs
index 57dc7f565..02ec633fe 100644
--- a/vendor/futures-channel/src/mpsc/queue.rs
+++ b/vendor/futures-channel/src/mpsc/queue.rs
@@ -61,7 +61,6 @@ pub(super) enum PopResult<T> {
Inconsistent,
}
-#[derive(Debug)]
struct Node<T> {
next: AtomicPtr<Self>,
value: Option<T>,
@@ -70,7 +69,6 @@ struct Node<T> {
/// The multi-producer single-consumer structure. This is not cloneable, but it
/// may be safely shared so long as it is guaranteed that there is only one
/// popper at a time (many pushers are allowed).
-#[derive(Debug)]
pub(super) struct Queue<T> {
head: AtomicPtr<Node<T>>,
tail: UnsafeCell<*mut Node<T>>,
diff --git a/vendor/futures-channel/src/oneshot.rs b/vendor/futures-channel/src/oneshot.rs
index 5af651b91..70449f43d 100644
--- a/vendor/futures-channel/src/oneshot.rs
+++ b/vendor/futures-channel/src/oneshot.rs
@@ -390,7 +390,7 @@ impl<T> Drop for Sender<T> {
}
}
-impl<T: fmt::Debug> fmt::Debug for Sender<T> {
+impl<T> fmt::Debug for Sender<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Sender").field("complete", &self.inner.complete).finish()
}
@@ -481,7 +481,7 @@ impl<T> Drop for Receiver<T> {
}
}
-impl<T: fmt::Debug> fmt::Debug for Receiver<T> {
+impl<T> fmt::Debug for Receiver<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Receiver").field("complete", &self.inner.complete).finish()
}
diff --git a/vendor/futures-channel/tests/mpsc-close.rs b/vendor/futures-channel/tests/mpsc-close.rs
index 81203d334..1a14067ec 100644
--- a/vendor/futures-channel/tests/mpsc-close.rs
+++ b/vendor/futures-channel/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/vendor/futures-channel/tests/mpsc-size_hint.rs b/vendor/futures-channel/tests/mpsc-size_hint.rs
new file mode 100644
index 000000000..d9cdaa31f
--- /dev/null
+++ b/vendor/futures-channel/tests/mpsc-size_hint.rs
@@ -0,0 +1,40 @@
+use futures::channel::mpsc;
+use futures::stream::Stream;
+
+#[test]
+fn unbounded_size_hint() {
+ let (tx, mut rx) = mpsc::unbounded::<u32>();
+ assert_eq!((0, None), rx.size_hint());
+ tx.unbounded_send(1).unwrap();
+ assert_eq!((1, None), rx.size_hint());
+ rx.try_next().unwrap().unwrap();
+ assert_eq!((0, None), rx.size_hint());
+ tx.unbounded_send(2).unwrap();
+ tx.unbounded_send(3).unwrap();
+ assert_eq!((2, None), rx.size_hint());
+ drop(tx);
+ assert_eq!((2, Some(2)), rx.size_hint());
+ rx.try_next().unwrap().unwrap();
+ assert_eq!((1, Some(1)), rx.size_hint());
+ rx.try_next().unwrap().unwrap();
+ assert_eq!((0, Some(0)), rx.size_hint());
+}
+
+#[test]
+fn channel_size_hint() {
+ let (mut tx, mut rx) = mpsc::channel::<u32>(10);
+ assert_eq!((0, None), rx.size_hint());
+ tx.try_send(1).unwrap();
+ assert_eq!((1, None), rx.size_hint());
+ rx.try_next().unwrap().unwrap();
+ assert_eq!((0, None), rx.size_hint());
+ tx.try_send(2).unwrap();
+ tx.try_send(3).unwrap();
+ assert_eq!((2, None), rx.size_hint());
+ drop(tx);
+ assert_eq!((2, Some(2)), rx.size_hint());
+ rx.try_next().unwrap().unwrap();
+ assert_eq!((1, Some(1)), rx.size_hint());
+ rx.try_next().unwrap().unwrap();
+ assert_eq!((0, Some(0)), rx.size_hint());
+}
diff --git a/vendor/futures-channel/tests/mpsc.rs b/vendor/futures-channel/tests/mpsc.rs
index 88cdef13d..444c8e10f 100644
--- a/vendor/futures-channel/tests/mpsc.rs
+++ b/vendor/futures-channel/tests/mpsc.rs
@@ -200,7 +200,7 @@ fn tx_close_gets_none() {
#[test]
fn stress_shared_unbounded() {
- const AMT: u32 = 10000;
+ const AMT: u32 = if cfg!(miri) { 100 } else { 10000 };
const NTHREADS: u32 = 8;
let (tx, rx) = mpsc::unbounded::<i32>();
@@ -229,7 +229,7 @@ fn stress_shared_unbounded() {
#[test]
fn stress_shared_bounded_hard() {
- const AMT: u32 = 10000;
+ const AMT: u32 = if cfg!(miri) { 100 } else { 10000 };
const NTHREADS: u32 = 8;
let (tx, rx) = mpsc::channel::<i32>(0);
@@ -259,7 +259,7 @@ fn stress_shared_bounded_hard() {
#[allow(clippy::same_item_push)]
#[test]
fn stress_receiver_multi_task_bounded_hard() {
- const AMT: usize = 10_000;
+ const AMT: usize = if cfg!(miri) { 100 } else { 10_000 };
const NTHREADS: u32 = 2;
let (mut tx, rx) = mpsc::channel::<usize>(0);
@@ -327,6 +327,8 @@ fn stress_receiver_multi_task_bounded_hard() {
/// after sender dropped.
#[test]
fn stress_drop_sender() {
+ const ITER: usize = if cfg!(miri) { 100 } else { 10000 };
+
fn list() -> impl Stream<Item = i32> {
let (tx, rx) = mpsc::channel(1);
thread::spawn(move || {
@@ -335,7 +337,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]);
}
@@ -382,7 +384,9 @@ fn stress_close_receiver_iter() {
#[test]
fn stress_close_receiver() {
- for _ in 0..10000 {
+ const ITER: usize = if cfg!(miri) { 50 } else { 10000 };
+
+ for _ in 0..ITER {
stress_close_receiver_iter();
}
}
@@ -397,7 +401,7 @@ async fn stress_poll_ready_sender(mut sender: mpsc::Sender<u32>, count: u32) {
#[allow(clippy::same_item_push)]
#[test]
fn stress_poll_ready() {
- const AMT: u32 = 1000;
+ const AMT: u32 = if cfg!(miri) { 100 } else { 1000 };
const NTHREADS: u32 = 8;
/// Run a stress test using the specified channel capacity.
@@ -426,7 +430,7 @@ fn stress_poll_ready() {
#[test]
fn try_send_1() {
- const N: usize = 3000;
+ const N: usize = if cfg!(miri) { 100 } else { 3000 };
let (mut tx, rx) = mpsc::channel(0);
let t = thread::spawn(move || {
diff --git a/vendor/futures-channel/tests/oneshot.rs b/vendor/futures-channel/tests/oneshot.rs
index 979cd8a15..6b48376dc 100644
--- a/vendor/futures-channel/tests/oneshot.rs
+++ b/vendor/futures-channel/tests/oneshot.rs
@@ -35,6 +35,8 @@ fn cancel_notifies() {
#[test]
fn cancel_lots() {
+ const N: usize = if cfg!(miri) { 100 } else { 20000 };
+
let (tx, rx) = mpsc::channel::<(Sender<_>, mpsc::Sender<_>)>();
let t = thread::spawn(move || {
for (mut tx, tx2) in rx {
@@ -43,7 +45,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 +103,8 @@ fn is_canceled() {
#[test]
fn cancel_sends() {
+ const N: usize = if cfg!(miri) { 100 } else { 20000 };
+
let (tx, rx) = mpsc::channel::<Sender<_>>();
let t = thread::spawn(move || {
for otx in rx {
@@ -108,7 +112,7 @@ fn cancel_sends() {
}
});
- for _ in 0..20000 {
+ for _ in 0..N {
let (otx, mut orx) = oneshot::channel::<u32>();
tx.send(otx).unwrap();