| Age | Commit message (Collapse) | Author | Lines |
|
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.
|
|
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
|
|
Clarify that VecDeque::swap can panic
The previous documentation mentioned this, but ambiguously used the term "fail".
This clarifies that the function will panic if the index is out of bounds, instead of silently failing and not doing anything.
If there's anything else I can do to improve this PR, I'd be happy to do so! Just saw this when reading through the docs in passing - it was slightly unclear what "fail" meant.
|
|
|
|
The previous documentation mentioned this, but ambiguously used the term "fail".
This clarifies that the function will panic if the index is out of bounds, instead of silently failing and not doing anything.
|
|
|
|
|
|
Add missing link in string doc
r? @rust-lang/docs
|
|
Fix inconsistent doc headings
This fixes headings reading "Unsafety" and "Example", they should be "Safety" and "Examples" according to RFC 1574.
r? @steveklabnik
|
|
|
|
Fixes #41701.
|
|
|
|
Add [T]::swap_with_slice
The safe version of a method from `ptr`, like `[T]::copy_from_slice` is.
Tracking issue: https://github.com/rust-lang/rust/issues/44030
|
|
This fixes headings reading "Unsafety" and "Example", they should be
"Safety" and "Examples" according to RFC 1574.
|
|
Implement From<&[T]> and others for Arc/Rc (RFC 1845)
* Implements `From<`{`&[T]`, `&str`, `String`, `Box<T> where T: ?Sized`, `Vec<T>`}`>` for `Arc`/`Rc`
* Removes `rustc_private`-marked methods `Rc::__from_array` and `Rc::__from_str`, replacing their use with `Rc::from`
Tracking issue: #40475
|
|
The safe version of a method from ptr, like [T]::copy_from_slice
|