| Age | Commit message (Collapse) | Author | Lines |
|
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
|
|
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
|
|
|
|
Implements RFC 1845, adding implementations of:
* `From<&[T]>` for `Rc<[T]>`
* `From<&str>` for `Rc<str>`
* `From<String>` for `Rc<str>`
* `From<Box<T: ?Sized>>` for `Rc<T>`
* `From<Vec<T>>` for `Rc<[T]>`
* and likewise for `Arc<_>`
Also removes now-obsolete internal methods `Rc::__from_array` and
`Rc::__from_str`, replacing their use with `Rc::from`.
|
|
|
|
|
|
|
|
Fix typos & us spellings
Fixing some typos and non en-US spellings.
(Update of PR https://github.com/rust-lang/rust/pull/42812 )
|
|
|
|
r=Mark-Simulacrum
use field init shorthand EVERYWHERE
Like #43008 (f668999), but [(lacking reasons to be more timid)](https://github.com/rust-lang/rust/pull/43008#issuecomment-312463564) _much more aggressive_.
r? @Mark-Simulacrum
|
|
Like #43008 (f668999), but _much more aggressive_.
|