| Age | Commit message (Collapse) | Author | Lines |
|
Closes #60271.
|
|
|
|
|
|
|
|
|
|
DoubleEndedIterators.
r?Manishearth
|
|
fix LinkedList invalidating mutable references
The test `test_insert_prev` failed in Miri due to what I consider a bug in `LinkedList`: in various places, `NonNull::as_mut` got called to modify the `prev`/`next` pointers of existing nodes. In particular, the unstable `insert_next` has to modify the `next` pointer of the node that was last handed out by the iterator; to this end it creates a mutable reference to the *entire node* that overlaps with the mutable reference to the node's content that was handed out by the iterator! Thus, the next use if said mutable reference is UB.
In code:
```rust
loop {
match it.next() { // mutable reference handed to us
None => break,
Some(elt) => {
it.insert_next(*elt + 1); // this invalidates `elt` because it creates an overlapping mutable reference
match it.peek_next() {
Some(x) => assert_eq!(*x, *elt + 2), // this use of `elt` now is a use of an invalid pointer
None => assert_eq!(8, *elt),
}
}
}
}
```
This PR fixes that by using `as_ptr` instead of `as_mut`. This avoids invalidating the mutable reference that was handed to the user. I did this in all methods called by iterators, just to be sure.
Cc @Gankro
|
|
|
|
make liballoc internal test suite mostly pass in Miri
I discovered, to my surprise, that liballoc has two test suites: `liballoc/tests`, and a bunch of stuff embedded directly within liballoc. The latter was not covered by [miri-test-libstd](https://github.com/RalfJung/miri-test-libstd) yet. This disables in Miri the tests that Miri cannot support or runs too slowly.
|
|
|
|
Make clear that format padding doesn't work for Debug
As mentioned in
https://github.com/rust-lang/rust/issues/46006#issuecomment-345260633
|
|
|
|
Re-export core::str::{EscapeDebug, EscapeDefault, EscapeUnicode} in std
cc #59893
|
|
|
|
|
|
|
|
|
|
|
|
Stabilize the `alloc` crate.
This implements RFC 2480:
* https://github.com/rust-lang/rfcs/pull/2480
* https://github.com/rust-lang/rfcs/blob/master/text/2480-liballoc.md
Closes https://github.com/rust-lang/rust/issues/27783
|
|
As mentioned in
https://github.com/rust-lang/rust/issues/46006#issuecomment-345260633
|
|
This implements RFC 2480:
* https://github.com/rust-lang/rfcs/pull/2480
* https://github.com/rust-lang/rfcs/blob/master/text/2480-liballoc.md
Closes https://github.com/rust-lang/rust/issues/27783
|
|
Fix broken links on std::boxed doc page
r? @QuietMisdreavus
|
|
|
|
|
|
|
|
Allow Strings to be created from borrowed Strings. This is mostly
to make things like passing &String to an `impl Into<String>`
parameter frictionless.
|
|
Future-proof the Futures API
cc https://github.com/rust-lang/rust/issues/59113, @carllerche, @rust-lang/libs
r? @withoutboats
|
|
|
|
This updates the `Extend` implementations to use `for_each` for many
collections: `BinaryHeap`, `BTreeMap`, `BTreeSet`, `LinkedList`, `Path`,
`TokenStream`, `VecDeque`, and `Wtf8Buf`.
Folding with `for_each` enables better performance than a `for`-loop for
some iterators, especially if they can just forward to internal
iterators, like `Chain` and `FlatMap` do.
|
|
|
|
|
|
|
|
|
|
|
|
r=KodrAus
improve worst-case performance of BTreeSet intersection v3
Variation of [#59078](https://github.com/rust-lang/rust/pull/59078) with `Intersection` remaining a struct
r? @scottmcm
|
|
|
|
|
|
uninitialized -> uninit
into_initialized -> assume_init
read_initialized -> read
set -> write
|
|
Implement specialized nth_back() for Box and Windows.
Hi there, this is my first pull request to rust :-)
I started implementing some specializations for DoubleEndedIterator::nth_back() and these are the first two. The problem has been discussed in #54054 and nth_back() is tracked in #56995.
I'm stuck with the next implementation so I though I do a PR for the ones I'm confident with to get some feedback.
|
|
Improved test output
|
|
we can now skip should_panic tests with the libtest harness
|
|
Move alloc::prelude::* to alloc::prelude::v1, make alloc a subset of std
This was one of the unresolved questions of https://github.com/rust-lang/rfcs/pull/2480. As the RFC says this is maybe not useful in the sense that we are unlikely to ever have a second version, but making the crate a true subset makes one less issue to think about if we stabilize it and later want to merge standard library crates and have Cargo feature flags to enable or disable parts of the `std` crate.
See also discussion in https://github.com/rust-lang/rust/pull/58175.
Also rename the feature gate and point to a dedicated tracking issue: https://github.com/rust-lang/rust/issues/58935
|
|
|
|
|
|
|
|
|
|
|
|
… to separate it from that of the crate.
New tracking issue: https://github.com/rust-lang/rust/issues/58935
|
|
This was one of the unresolved questions of https://github.com/rust-lang/rfcs/pull/2480.
As the RFC says this is maybe not useful in the sense that we are unlikely
to ever have a second version, but making the crate a true subset
makes one less issue to think about if we stabilize it and later
want to merge standard library crates and have Cargo feature flags
to enable or disable parts of the `std` crate.
See also discussion in https://github.com/rust-lang/rust/pull/58175
|
|
In bluss/indexmap#88, we found that there was no easy way to implement
`Debug` for our `IterMut` and `Drain` iterators. Those are built on
`slice::IterMut` and `vec::Drain`, which implement `Debug` themselves,
but have no other way to access their data. With a new `as_slice()`
method, we can read the data and customize its presentation.
|