Commit graph

149 commits

Author SHA1 Message Date
The8472
2a327394e4 mark SourceIter as unsafe, document invariants 2020-09-03 20:59:05 +02:00
The8472
bb2d533bb9 in-place collect for Vec. Box<[]> and BinaryHeap IntoIter and some adapters 2020-09-03 20:59:03 +02:00
The8472
038394a330 bench 2020-09-03 20:56:34 +02:00
The8472
076417e978 unrelated typo fix 2020-09-03 20:56:34 +02:00
bors
08deb863bd Auto merge of #76235 - jyn514:std-intra-links, r=poliorcetics
Convert many files to intra-doc links

Helps with https://github.com/rust-lang/rust/issues/75080
r? @poliorcetics
I recommend reviewing one commit at a time, but the diff is small enough you can do it all at once if you like :)
2020-09-03 05:53:48 +00:00
Joshua Nelson
44bacc3ffa Revert change to MaybeUninit until rustdoc bugs are fixed
https://github.com/rust-lang/rust/issues/76106
2020-09-02 17:38:21 -04:00
Joshua Nelson
59a1a05bff Convert many files to intra-doc links
- Use intra-doc links for `std::io` in `std::fs`
- Use intra-doc links for File::read in unix/ext/fs.rs
- Remove explicit intra-doc links for `true` in `net/addr.rs`
- Use intra-doc links in alloc/src/sync.rs
- Use intra-doc links in src/ascii.rs
- Switch to intra-doc links in alloc/rc.rs
- Use intra-doc links in core/pin.rs
- Use intra-doc links in std/prelude
- Use shorter links in `std/fs.rs`

  `io` is already in scope.
2020-09-02 17:37:40 -04:00
Anton
dbe50f5c24
Same typos in vec_deque 2020-09-02 14:09:42 +02:00
Anton
b67006422e
Fix typos in vec try_reserve(_exact) docs
`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`.
2020-09-02 13:12:44 +02:00
Joshua Nelson
726b187546 Use intra-doc links for MaybeUninit in boxed.rs 2020-09-01 23:54:17 -04:00
Jon Gjengset
8b55360f70
Will land in 1.48, not 1.47 2020-09-01 09:50:32 -04:00
Jon Gjengset
010891f8b8
Merge branch 'master' into stabilize-vecdeque-make_contiguous 2020-09-01 09:49:42 -04:00
Tyler Mandry
c307e90daa
Rollup merge of #76139 - CDirkx:cow-is-borrowed, r=ecstatic-morse
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
2020-08-31 19:18:21 -07:00
Aleksey Kladov
13c4f04561
Rollup merge of #76069 - pickfire:patch-16, r=jyn514
Use explicit intra-doc link in path for Vec resize

r? @jyn514
2020-08-31 12:51:53 +02:00
Aleksey Kladov
d829a5bcb1
Rollup merge of #76058 - pickfire:patch-11, r=jyn514
Use assertions on Vec doc

Clarify what the state of Vec after with_capacity on doc.

r? @jyn514
2020-08-31 12:51:51 +02:00
Aleksey Kladov
af1f46cf99
Rollup merge of #76055 - pickfire:patch-9, r=jyn514
Keep doc standard for Vec DrainFilter

r? @jyn514
2020-08-31 12:51:49 +02:00
Aleksey Kladov
6ce3243995
Rollup merge of #76033 - camelid:patch-7, r=Dylan-DPC
Add missing hyphen

reference counted pointer -> reference-counted pointer

@rustbot modify labels: T-doc
2020-08-31 12:51:45 +02:00
Aleksey Kladov
e59eb4e0fa
Rollup merge of #76023 - pickfire:patch-4, r=jyn514
Liballoc extend use intra doc link

Superseeds https://github.com/rust-lang/rust/pull/75729/commits

r? @jyn514
2020-08-31 12:51:42 +02:00
CDirkx
af24bdbd96 Make cow_is_borrowed methods const
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
2020-08-31 03:43:47 +02:00
Dylan DPC
75d6b109c2
Rollup merge of #75874 - pickfire:patch-3, r=jyn514
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.
2020-08-30 01:43:41 +02:00
Ivan Tham
2d1ab83834
Remove empty vec assertion flow distrupt
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-29 23:07:40 +08:00
Ivan Tham
be8b5eb529
Reuse description from drain_filter
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-29 22:39:34 +08:00
Ivan Tham
237c5005d6
Use explicit intra-doc link in path for Vec resize 2020-08-29 20:40:05 +08:00
Ivan Tham
12b4cf8c6c
Use assertions on Vec doc
Clarify what the state of Vec after with_capacity on doc.
2020-08-29 18:38:18 +08:00
Ivan Tham
d727442f2d
Remove brackets in drain filter docs 2020-08-29 18:23:29 +08:00
Ivan Tham
d504d553f1
Keep doc standard for Vec DrainFilter 2020-08-29 18:21:47 +08:00
Ivan Tham
c7e428e862
Liballoc vec doc use associated function
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-29 16:13:05 +08:00
Camelid
7be129e53a
Add missing hyphen
reference counted pointer -> reference-counted pointer
2020-08-28 09:29:06 -07:00
Ivan Tham
2d6ab122b7
Liballoc extend use intra doc link 2020-08-28 19:33:53 +08:00
Dylan DPC
11e9769a97
Rollup merge of #75875 - pickfire:patch-4, r=jyn514
Shorten liballoc vec resize intra-doc link

r? @jyn514
2020-08-27 01:14:17 +02:00
bors
ffd59bf9c6 Auto merge of #75687 - TimDiekmann:realloc-align, r=Amanieu
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
2020-08-26 10:44:28 +00:00
Ivan Tham
adc492573e
Shorten liballoc vec resize intra-doc link 2020-08-24 20:52:41 +08:00
Ivan Tham
bc7ea6f52e
Shorten liballoc doc intra link while readable 2020-08-24 20:02:02 +08:00
bors
aa7010df90 Auto merge of #75815 - jyn514:ambiguous-primitives, r=guillaumegomez
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.
2020-08-24 10:29:29 +00:00
bors
9d74562432 Auto merge of #75505 - Dylan-DPC:feature/arc_new, r=KodrAus
Add Arc::new_cyclic

Rework of #72443

References #75861

cc @Diggsey @RalfJung

r? @KodrAus
2020-08-24 08:26:59 +00:00
Yuki Okushi
25a677ccef
Rollup merge of #75831 - lzutao:https, r=Dylan-DPC
doc: Prefer https link for wikipedia URLs

A tiny changes.
2020-08-24 11:48:47 +09:00
Joshua Nelson
373432e47f Convert from str -> prim@str for alloc 2020-08-23 22:40:20 -04:00
Dylan DPC
c26a8d5772
add issue number 2020-08-24 02:34:52 +02:00
bors
9d606d939a Auto merge of #74238 - RalfJung:offset_from, r=oli-obk
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](56d4b2d69a/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)).
2020-08-23 14:50:15 +00:00
Lzu Tao
2c995d29f7 Prefer https link for wikipedia URLs 2020-08-23 10:02:42 +00:00
bors
663d2f5cd3 Auto merge of #75171 - amosonn:new_zeroed_slice, r=Amanieu
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).
2020-08-22 18:46:42 +00:00
Ralf Jung
0e4f335e63 stabilize ptr_offset_from 2020-08-22 14:37:10 +02:00
Dylan DPC
ec629800ec
Rollup merge of #75725 - LeSeulArtichaut:alloc-intra-doc, r=jyn514
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
2020-08-22 02:14:45 +02:00
amosonn
5aba816672
Update rc.rs 2020-08-21 22:25:09 +02:00
LeSeulArtichaut
97072c6b90 Apply suggestions from code review
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-08-21 19:31:00 +02:00
LeSeulArtichaut
1ababd8794 Use intra-doc-links in alloc 2020-08-21 00:25:25 +02:00
Josh Stone
6ac1523b23
Rollup merge of #75733 - pickfire:patch-3, r=matklad
Remove duplicated alloc vec bench push_all_move

push_all_move is the same as extend
2020-08-20 10:07:32 -07:00
Josh Stone
f29f21285e
Rollup merge of #75672 - kofls:intradoc-fix, r=jyn514
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
2020-08-20 10:07:19 -07:00
Ivan Tham
4f2e182c5f
Liballoc bench rename push_all extend_from_slice 2020-08-20 19:04:52 +08:00
Tim Diekmann
46b547cb58 Assume same alignment in RawVec 2020-08-20 11:56:46 +02:00