| Age | Commit message (Collapse) | Author | Lines |
|
|
|
`try_reserve` and `try_reserve_exact` docs refer to calling `reserve` and `reserve_exact`.
`try_reserve_exact` example uses `try_reserve` method instead of `try_reserve_exact`.
|
|
|
|
|
|
|
|
|
|
Make `cow_is_borrowed` methods const
Constify the following methods of `alloc::borrow::Cow`:
- `is_borrowed`
- `is_owned`
Analogous to the const methods `is_some` and `is_none` for Option, and `is_ok` and `is_err` for Result.
These methods are still unstable under `cow_is_borrowed`.
Possible because of #49146 (Allow if and match in constants).
Tracking issue: #65143
|
|
Use explicit intra-doc link in path for Vec resize
r? @jyn514
|
|
Use assertions on Vec doc
Clarify what the state of Vec after with_capacity on doc.
r? @jyn514
|
|
Keep doc standard for Vec DrainFilter
r? @jyn514
|
|
Add missing hyphen
reference counted pointer -> reference-counted pointer
@rustbot modify labels: T-doc
|
|
Liballoc extend use intra doc link
Superseeds https://github.com/rust-lang/rust/pull/75729/commits
r? @jyn514
|
|
Constify the following methods of `alloc::borrow::Cow`:
- `is_borrowed`
- `is_owned`
These methods are still unstable under `cow_is_borrowed`.
Possible because of #49146 (Allow if and match in constants).
Tracking issue: #65143
|
|
|
|
Shorten liballoc doc intra link while readable
r? @jyn514
Do you want to reviews these sort of pull requests in the future? I might send a few of them while reading vec code.
|
|
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
|
|
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
|
|
|
|
|
|
It is not always obvious that people could see the docs for `&`
especially for beginners, it also helps learnability.
|
|
Clarify what the state of Vec after with_capacity on doc.
|
|
See its documentation for more
|
|
|
|
|
|
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
|
|
Co-authored-by: Andrew Hickman <andrew.hickman1@sky.com>
|
|
reference counted pointer -> reference-counted pointer
|
|
|
|
|
|
|
|
Shorten liballoc vec resize intra-doc link
r? @jyn514
|
|
Allow reallocation to different alignment in `AllocRef`
The allocator-wg [has decided](https://github.com/rust-lang/wg-allocators/issues/5#issuecomment-672591112) to support reallocating to a different alignment in `AllocRef`. For more details please see the linked issue.
r? @Amanieu
closes https://github.com/rust-lang/wg-allocators/issues/5
|
|
|
|
|
|
|
|
Report an ambiguity if both modules and primitives are in scope for intra-doc links
Closes https://github.com/rust-lang/rust/issues/75381
- Add a new `prim@` disambiguator, since both modules and primitives are in the same namespace
- Refactor `report_ambiguity` into a closure
Additionally, I noticed that rustdoc would previously allow `[struct@char]` if `char` resolved to a primitive (not if it had a DefId). I fixed that and added a test case.
I also need to update libstd to use `prim@char` instead of `type@char`. If possible I would also like to refactor `ambiguity_error` to use `Disambiguator` instead of its own hand-rolled match - that ran into issues with `prim@` (I updated one and not the other) and it would be better for them to be in sync.
|
|
Add Arc::new_cyclic
Rework of #72443
References #75861
cc @Diggsey @RalfJung
r? @KodrAus
|
|
doc: Prefer https link for wikipedia URLs
A tiny changes.
|
|
|
|
|
|
stabilize ptr_offset_from
This stabilizes ptr::offset_from, and closes https://github.com/rust-lang/rust/issues/41079. It also removes the deprecated `wrapping_offset_from`. This function was deprecated 19 days ago and was never stable; given an FCP of 10 days and some waiting time until FCP starts, that leaves at least a month between deprecation and removal which I think is fine for a nightly-only API.
Regarding the open questions in https://github.com/rust-lang/rust/issues/41079:
* Should offset_from abort instead of panic on ZSTs? -- As far as I know, there is no precedent for such aborts. We could, however, declare this UB. Given that the size is always known statically and the check thus rather cheap, UB seems excessive.
* Should there be more methods like this with different restrictions (to allow nuw/nsw, perhaps) or that return usize (like how isize-taking offset is more conveniently done with usize-taking add these days)? -- No reason to block stabilization on that, we can always add such methods later.
Also nominating the lang team because this exposes an intrinsic.
The stabilized method is best described [by its doc-comment](https://github.com/RalfJung/rust/blob/56d4b2d69abb93e4f0ca79471deca7aaaaeca214/src/libcore/ptr/const_ptr.rs#L227). The documentation forgot to mention the requirement that both pointers must "have the same provenance", aka "be derived from pointers to the same allocation", which I am adding in this PR. This is a precondition that [Miri already implements](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=a3b9d0a07a01321f5202cd99e9613480) and that, should LLVM ever obtain a `psub` operation to subtract pointers, will likely be required for that operation (following the semantics in [this paper](https://people.mpi-sws.org/~jung/twinsem/twinsem.pdf)).
|
|
|
|
New zeroed slice
Add to #63291 the methods
```rust
impl<T> Box<[T]> { pub fn new_zeroed_slice(len: usize) -> Box<[MaybeUninit<T>]> {…} }
impl<T> Rc<[T]> { pub fn new_zeroed_slice(len: usize) -> Rc<[MaybeUninit<T>]> {…} }
impl<T> Arc<[T]> { pub fn new_zeroed_slice(len: usize) -> Arc<[MaybeUninit<T>]> {…} }
```
as suggested in https://github.com/rust-lang/rust/issues/63291#issuecomment-605511675 .
Also optimize `{Rc, Arc}::new_zeroed` to use `alloc_zeroed`, otherwise they are no more efficient than using `new_uninit` and zeroing the memory manually (which was the original implementation).
|
|
|
|
|
|
Use intra-doc-links in `alloc`
I didn't have time to test this, so I will let the CI do it for me.
r? @jyn514 cc #75080
|
|
|
|
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
|
|
|
|
Move to intra-doc links for task.rs and vec.rs
Partial fix for #75080
links for [`get`], [`get_mut`] skipped due to #75643
link for [`copy_from_slice`] skipped due to #63351
|