3383 Commits

Author SHA1 Message Date
Taiki Endo
63f0682606 ci: Work around sanitizer-related regression
```
     Running unittests src/lib.rs (target/debug/deps/futures_macro-cb16371840b70586)

/home/runner/work/futures-rs/futures-rs/target/debug/deps/futures_macro-cb16371840b70586: error while loading shared libraries: libstd-f157c25fb2dbfbe0.so: cannot open shared object file: No such file or directory
error: test failed, to rerun pass `-p futures-macro --lib`

Caused by:
  process didn't exit successfully: `/home/runner/work/futures-rs/futures-rs/target/debug/deps/futures_macro-cb16371840b70586 --skip panic_on_drop_fut` (exit status: 127)
```
2024-10-13 15:06:30 +09:00
Taiki Endo
bf1cc19c94 Set warn_non_default_branch = true in triagebot.toml 2024-10-13 15:06:26 +09:00
Taiki Endo
1e052816b0 Release 0.3.31 0.3.31 2024-10-05 16:05:53 +09:00
Taiki Endo
8a8b085a8c Fix clippy::uninit_vec warning
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
      --> futures-util/src/io/buf_reader.rs:52:13
       |
    52 |             let mut buffer = Vec::with_capacity(capacity);
       |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    53 |             buffer.set_len(capacity);
       |             ^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = note: `#[deny(clippy::uninit_vec)]` on by default
       = help: initialize the buffer or wrap the content in `MaybeUninit`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninit_vec
2024-10-05 16:05:53 +09:00
Andrew Lamb
f3fb74df31 Document how BoxFutures / BoxStreams are often made (#2887) 2024-10-05 16:05:53 +09:00
Imbris
f00e7afb46 Fix use after free of task in FuturesUnordered when dropped future panics (#2886) 2024-10-05 16:05:53 +09:00
Taiki Endo
33c46b3dc6 ci: Work around sanitizer issue on latest Linux kernel 2024-10-05 16:05:53 +09:00
Hans Kratz
7bf5a72826 Fix issues with AsyncBufRead::read_line and AsyncBufReadExt::lines (#2884)
Fixes the following issues in `AsyncBufRead::read_line`:
* When the future is dropped the previous string contents are not restored so the string is empty.
* If invalid UTF-8 is encountered the previous string contents are not restored.
* If an IO error occurs after `read_until_internal` already read a couple of bytes a debug assertion fails.
* Performance: The whole string to which read contents are appended is check for UTF-8 validity instead of just the added bytes.

Fixes the following issues in `AsyncBufRead::read_line`:
* If an IO error occurs after `read_until_internal` already read a couple of bytes a debug assertion fails. (#2862)

Fixes #2862
2024-10-05 16:05:53 +09:00
AF
87afaf3973 Use #[inline(always)] on clone_arc_raw (#2865) 2024-10-05 16:05:53 +09:00
Bill Fraser
549b90b179 Add accessors for the inner of stream::Iter (#2875) 2024-10-05 16:05:53 +09:00
cui fliter
07b004ac7e Add missing symbols (#2883)
Signed-off-by: cuishuang <imcusg@gmail.com>
2024-10-05 16:05:53 +09:00
Hans Kratz
86dc069fa2 Various fixes too make the CI green (#2885)
* Fix unexpected `cfg` condition name: ... warnings introduced in Rust 1.80

See https://blog.rust-lang.org/2024/05/06/check-cfg.html

* io_slice_advance feature is now stable

* clippy: enable missing_const_for_thread_local lint, now checks for MSRV (see https://github.com/rust-lang/rust-clippy/issues/12404)

* clippy: fixes for "doc list item without indentation" lint

* clippy: ignore incorrect "first doc comment paragraph is too long" warning

see https://github.com/rust-lang/rust-clippy/issues/13315

* clippy: allow long first paragraphs in select... fn doc comments

* use workspace level setting to ignore error about the futures_sanitizer unexpected config
2024-10-05 16:05:53 +09:00
Taiki Endo
a9a4aa0d90 Tweak imports in tests 2024-10-05 16:05:53 +09:00
Taiki Endo
a0d9554672 Remove no longer needed extern crate proc_macro 2024-10-05 16:05:53 +09:00
Taiki Endo
d5fc37861b ci: Set timeout-minutes in all jobs 2024-10-05 16:05:53 +09:00
Taiki Endo
e767ad0c72 Remove unused direct dependency on pin-utils
They use pin_mut via futures-util.
2024-10-05 16:05:53 +09:00
gwo
1448bec785 Make non constructor methods of futures::io::{BufReader,BufWriter} not require inner trait bound (#2848) 2024-10-05 16:05:53 +09:00
Gnome!
001abd5d5e Add a helper for always ready futures (#2825) 2024-10-05 16:05:53 +09:00
Taiki Endo
27d3fc0b72 ci: Use taiki-e/checkout-action action
https://github.com/taiki-e/checkout-action#why-not-actionscheckout
2024-10-05 16:05:53 +09:00
Taiki Endo
1475000372 Use *::MAX associated constants 2024-10-05 16:05:53 +09:00
David Tolnay
3ad64f9d8b Parse rhs of select! arms using match-arm rules 2024-10-05 16:05:53 +09:00
David Tolnay
b73f293065 Add test of select's grammar 2024-10-05 16:05:53 +09:00
Taiki Endo
738c25072c Add 'static bound to waker_ref 2024-10-05 16:05:53 +09:00
Taiki Endo
d2a1b58a1f Fix rustdoc::redundant_explicit_links warning
```
error: redundant explicit link target
   --> futures-executor/src/local_pool.rs:314:25
    |
314 | /// Use a [`LocalPool`](LocalPool) if you need finer-grained control over
    |            -----------  ^^^^^^^^^ explicit target is redundant
    |            |
    |            because label contains path that resolves to same destination
    |
    = note: when a link's destination is not specified,
            the label is used to resolve intra-doc links
    = note: `-D rustdoc::redundant-explicit-links` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(rustdoc::redundant_explicit_links)]`
help: remove explicit link target
    |
314 | /// Use a [`LocalPool`] if you need finer-grained control over
    |           ~~~~~~~~~~~~~

error: redundant explicit link target
  --> futures-executor/src/local_pool.rs:37:33
   |
37 | /// A handle to a [`LocalPool`](LocalPool) that implements
   |                    -----------  ^^^^^^^^^ explicit target is redundant
   |                    |
   |                    because label contains path that resolves to same destination
   |
   = note: when a link's destination is not specified,
           the label is used to resolve intra-doc links
help: remove explicit link target
   |
37 | /// A handle to a [`LocalPool`] that implements
   |                   ~~~~~~~~~~~~~
```
2024-10-05 16:05:53 +09:00
Taiki Endo
ff38f831d5 Ignore dead_code lint on Assert* traits
```
warning: trait `AssertSync` is never used
   --> futures-core/src/task/__internal/atomic_waker.rs:209:15
    |
209 |         trait AssertSync: Sync {}
    |               ^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

warning: trait `AssertKinds` is never used
   --> futures-channel/src/mpsc/mod.rs:130:7
    |
130 | trait AssertKinds: Send + Sync + Clone {}
    |       ^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

warning: trait `AssertSendSync` is never used
  --> futures-executor/src/thread_pool.rs:48:7
   |
48 | trait AssertSendSync: Send + Sync {}
   |       ^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: trait `AssertSend` is never used
  --> futures-channel/tests/mpsc.rs:13:7
   |
13 | trait AssertSend: Send {}
   |       ^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default
```
2024-10-05 16:05:53 +09:00
Taiki Endo
88822a4810 Always set #![no_std] and remove redundant imports
```
error: the item `Box` is imported redundantly
  --> futures-core/src/future.rs:89:9
   |
89 |     use alloc::boxed::Box;
   |         ^^^^^^^^^^^^^^^^^
  --> /rustc/381d69953bb7c3390cec0fee200f24529cb6320f/library/std/src/prelude/mod.rs:115:13
   |
   = note: the item `Box` is already defined here
   |
   = note: `-D unused-imports` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(unused_imports)]`

error: the item `Box` is imported redundantly
   --> futures-core/src/stream.rs:203:9
    |
203 |     use alloc::boxed::Box;
    |         ^^^^^^^^^^^^^^^^^
   --> /rustc/381d69953bb7c3390cec0fee200f24529cb6320f/library/std/src/prelude/mod.rs:115:13
    |
    = note: the item `Box` is already defined here
```
2024-10-05 16:05:53 +09:00
Taiki Endo
5e9b9e101a Apply unsafe_op_in_unsafe_fn lint if available on MSRV 2024-10-05 16:05:53 +09:00
Taiki Endo
665302a822 Use Self keyword instead of concrete type name 2024-10-05 16:05:53 +09:00
Taiki Endo
c6ae4e923b Use [lints] in Cargo.toml 2024-10-05 16:05:53 +09:00
vuittont60
4cd69065fc Fix typos (#2821) 2024-10-05 16:05:53 +09:00
Taiki Endo
5fec1cbab0 tests: Fix dead_code warning for tuple struct
```
error: field `0` is never read
  --> futures-executor/tests/local_pool.rs:13:16
   |
13 | struct Pending(Rc<()>);
   |        ------- ^^^^^^
   |        |
   |        field in this struct
   |
   = note: `-D dead-code` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(dead_code)]`
help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
   |
13 | struct Pending(());
   |                ~~
```
2024-10-05 16:05:53 +09:00
Taiki Endo
de1a0fd64a Release 0.3.30 0.3.30 2023-12-24 23:36:58 +09:00
TennyZhuang
68d284545f Remove a redundant space in example (#2816) 2023-12-24 23:36:58 +09:00
Jules Bertholet
fdd2ce716c Fix broken link in CopyBufAbortable docs (#2815)
Also re-enable docs in CI.
2023-12-24 23:36:58 +09:00
Taiki Endo
272a3c709f Use cfg(target_has_atomic) on no-std targets 2023-12-24 23:36:58 +09:00
Taiki Endo
c179201bd1 FillBuf: Do not call poll_fill_buf twice 2023-12-24 23:36:58 +09:00
Taiki Endo
e6735f3d01 FuturesUnordered: Fix clear implementation 2023-12-24 23:36:58 +09:00
Taiki Endo
04d01a00a2 FuturesOrdered: Use 64-bit index 2023-12-24 23:36:58 +09:00
zhiqiangxu
e4aa659649 remove redundant impl Unpin 2023-12-24 23:36:58 +09:00
Paul Sbarra
17851c1f05 provide a mechanism to determine if io read/write halves are from the same stream 2023-12-24 23:36:58 +09:00
Paul Sbarra
49107994e5 provide a non-destructive mechanism to determine if a sink/stream are paired 2023-12-24 23:36:58 +09:00
Collin Styles
40eed5c179 Fix the documentation for the TryAny adapter 2023-12-24 23:36:58 +09:00
Collin Styles
8189e72a4b Import TryAll and TryAny in the stream module
This makes them show up on the documentation page for the `stream`
module. It also makes the return types on the `TryStreamExt`
documentation page link to the adapter types.
2023-12-24 23:36:58 +09:00
edef
0fe4b8853b FillBuf: don't poll a second time on EOF
There is no hard guarantee that polling a second time will return
Poll::Ready, and this is particularly likely to break in the EOF case,
which is precisely where we don't need to do so at all.

Both tokio::io::BufReader and futures::io::BufReader always attempt to
read from the underlying reader when the buffer is empty, rather than
fusing EOF.
2023-11-20 23:17:38 +09:00
Taiki Endo
f75c4c1cde Update ci/publish.sh 2023-10-26 23:24:13 +09:00
Taiki Endo
86f2a6aa8c Release 0.3.29 0.3.29 2023-10-26 23:18:44 +09:00
Taiki Endo
a40204d698 Provide AtomicWaker if portable-atomic feature is enabled, even if atomic CAS is not available 2023-10-26 23:18:44 +09:00
Collin Styles
24cca65c7a Add TryAny adapter 2023-10-26 23:18:44 +09:00
Collin Styles
e60a439bde Add TryAll adapter 2023-10-26 23:18:44 +09:00
Taiki Endo
5051335313 Remove unsafe code from AssertUnmoved 2023-10-26 23:18:44 +09:00