rust/library/alloc/src
Matthias Krüger 22f91aefd5
Rollup merge of #142484 - dtolnay:bsetextract, r=m-ou-se
Remove unneeded lifetime bound from signature of BTreeSet::extract_if

One way to observe the difference between these signatures, using 0 explicit lifetimes and 0 contrived where-clauses:

```rust
use std::collections::btree_set::{BTreeSet, ExtractIf};
use std::ops::RangeFull;

fn repro(
    set: &mut BTreeSet<i32>,
    predicate: impl Fn(i32) -> bool,
) -> ExtractIf<i32, RangeFull, impl FnMut(&i32) -> bool> {
    set.extract_if(.., move |x| predicate(*x))
}
```

**Before:**

```console
error[E0311]: the parameter type `impl Fn(i32) -> bool` may not live long enough
 --> src/lib.rs:8:5
  |
5 |     set: &mut BTreeSet<i32>,
  |          ------------------ the parameter type `impl Fn(i32) -> bool` must be valid for the anonymous lifetime defined here...
...
8 |     set.extract_if(.., move |x| predicate(*x))
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `impl Fn(i32) -> bool` will meet its required lifetime bounds
  |
help: consider adding an explicit lifetime bound
  |
4 ~ fn repro<'a>(
5 ~     set: &'a mut BTreeSet<i32>,
6 ~     predicate: impl Fn(i32) -> bool + 'a,
7 ~ ) -> ExtractIf<'a, i32, RangeFull, impl FnMut(&i32) -> bool> {
  |
```

**After:** compiles success.

- Tracking issue: https://github.com/rust-lang/rust/issues/70530
2025-06-14 11:27:12 +02:00
..
boxed library: Use size_of from the prelude instead of imported 2025-03-06 20:20:38 -08:00
collections Remove unneeded lifetimes from signature of BTreeSet::extract_if 2025-06-13 20:33:54 -07:00
ffi Delegate <CStr as Debug> to ByteStr 2025-06-12 12:53:14 -04:00
raw_vec Simplify Vec::as_non_null implementation and make it const 2025-05-05 21:56:33 +02:00
vec update docs, test 2025-06-11 22:57:57 -04:00
alloc.rs update cfgs 2025-04-09 12:29:59 +01:00
borrow.rs Fully test the alloc crate through alloctests 2025-03-07 19:11:13 +00:00
boxed.rs replace version placeholder 2025-04-09 12:29:59 +01:00
bstr.rs Fully test the alloc crate through alloctests 2025-03-07 19:11:13 +00:00
fmt.rs Fix typo in documentation 2025-04-12 22:26:38 +08:00
lib.miri.rs add 'x.py miri', and make it work for 'library/{core,alloc,std}' 2024-04-03 20:27:20 +02:00
lib.rs stabilize nonnull_provenance 2025-06-09 12:36:24 +02:00
macros.rs Streamline the format macro. 2025-04-28 06:56:13 +10:00
rc.rs Update rc.rs docs 2025-05-06 13:19:42 -07:00
slice.rs remove extraneous text 2025-06-06 06:39:51 +02:00
str.rs remove extraneous text 2025-06-06 06:39:51 +02:00
string.rs Auto merge of #136264 - GuillaumeGomez:optimize-integers-to-string, r=Amanieu 2025-05-15 20:20:30 +00:00
sync.rs Auto merge of #136316 - GrigorenkoPV:generic_atomic, r=Mark-Simulacrum 2025-04-28 05:12:59 +00:00
task.rs Stabilize noop_waker 2024-12-05 14:14:17 -08:00