| Age | Commit message (Collapse) | Author | Lines |
|
Optimize drain_filter
This PR cuts out two copies from each iteration of `drain_filter` by exchanging the swap operation for a copy_nonoverlapping function call instead. Since the data being swapped is not needed anymore we can just overwrite it instead.
|
|
|
|
|
|
Stabilized vec_splice and modified splice tracking issue
This stabilizes the vec_splice (Vec part of splice RFC)
Fixes #32310.
|
|
Implement `Arc`/`Rc` raw pointer conversions for `?Sized`
* Add `T: ?Sized` bound to {`Arc`,`Rc`}::{`from_raw`,`into_raw`}
|
|
|
|
|
|
Implement <Rc<Any>>::downcast
* Implement `<Rc<Any>>::downcast::<T>`
* New unstable method. Works just like Box\<Any\>, but for Rc.
* Any has two cases for its methods: Any and Any + Send; Rc is never Send, so that case is skipped for Rc.
* Motivation for being a method with self is to match Box and there is no user-supplied type; the inner type is Any and downcast does not conflict with any method of Any.
* Arc was skipped because Any itself has no downcast for the case that makes most sense: Any + Send + Sync
|
|
* Add `T: ?Sized` bound to {`Arc`,`Rc`}::{`from_raw`,`into_raw`}
|
|
|
|
Clarify return type of `String::from_utf16_lossy`.
Fixes https://github.com/rust-lang/rust/issues/32874
|
|
Remove unneeded `loop`.
None
|
|
Fix example in transmute; add safety requirement to Vec::from_raw_parts
This fixes the second bullet point on #44281 and also removes some incorrect information.
|
|
Fix drain_filter doctest.
Fixes #44499.
Also change some of the hidden logic in the doctest as a regression test; two bugs in the original would now cause test failure.
|
|
Add an example of std::str::encode_utf16
Closes #44419
|
|
Add doc example to str::from_boxed_utf8_unchecked
Fixes #44463.
|
|
Added an example for `std::str::into_boxed_bytes()`
This solves issue #44423.
|
|
Add doc example to String::as_mut_str
Fixes #44429.
|
|
Fixes https://github.com/rust-lang/rust/issues/32874
|
|
|
|
|
|
|
|
impl Hasher for {&mut Hasher, Box<Hasher>}
**Rationale:** The `Hash` trait has `fn hash<H: Hasher>(&self, state: &mut H)`, which can only accept a `Sized` hasher, even if the `Hasher` trait is object-safe. We cannot retroactively add the `?Sized` bound without breaking stability, thus implementing `Hasher` to a trait object reference is the next best solution.
**Warning:** These `impl` are insta-stable, and should need an FCP. I don't think a full RFC is necessary.
|
|
Closes #44419
|
|
Add or_default to Entry APIs
As argued for in #44324, this PR adds a new `or_default` method to the various `Entry` APIs (currently just for `BTreeMap` and `HashMap`) when `V: Default`. This method is effectively a shorthand for `or_insert_with(Default::default)`.
|
|
|
|
|
|
|
|
Fixes #44463.
|
|
|
|
|
|
Fixes #44429.
|
|
documentation update to demonstrate mutability
#44467
- demonstrate correct implementation returns `Some`
- demonstrate out of bounds returns `None`
- demonstrate mutability
|
|
Add doc examples for str::as_bytes_mut
Fixes #44427
|
|
|
|
Fixes #44427
|
|
Fixes #44428.
|
|
|
|
|
|
|
|
|
|
Moved the examples from split_at_mut to split_at so the example at
split_at_mut can just demonstrate mutability.
|
|
Implement downcast the like it exists for Box.
The implementation avoids using into_raw/from_raw, because the pointer
arithmetic which should cancel does not seem to optimize out at the
moment.
Since Rc<T> is never Send, only Rc<Any> and not Rc<Any + Send>
implements downcast.
|
|
API docs: macros. Standard Documentation Checklist
Fixes #29381
r? @steveklabnik
|
|
Remove Splice struct return value from String::splice
The implementation is now almost identical to the one in the RFC.
Fixes #44038
cc #32310
|
|
|
|
|
|
std: Mark allocation functions as nounwind
This commit flags all allocation-related functions in liballoc as "this can't
unwind" which should largely resolve the size-related issues found on #42808.
The documentation on the trait was updated with such a restriction (they can't
panic) as well as some other words about the relative instability about
implementing a bullet-proof allocator.
Closes #42808
|
|
Generator support
This adds experimental support for generators intended to land once https://github.com/rust-lang/rfcs/pull/2033 is approved.
This is not yet ready to be merged. Things to do:
- [x] Make closure arguments on generators an error
- [x] Spot FIXMEs
- [x] Pass make tidy
- [x] Write tests
- [x] Document the current syntax and semantics for generators somewhere
- [x] Use proper error message numbers
- [x] ~~Make the implicit argument type default to `()`~~
|
|
This commit flags all allocation-related functions in liballoc as "this can't
unwind" which should largely resolve the size-related issues found on #42808.
The documentation on the trait was updated with such a restriction (they can't
panic) as well as some other words about the relative instability about
implementing a bullet-proof allocator.
Closes #42808
|