Commit Graph

627 Commits

Author SHA1 Message Date
CDirkx
b31cc8f83e Make all methods of std::net::Ipv6Addr const
Make the following methods of `std::net::Ipv6Addr` unstable const under the `const_ipv6` feature:
- `segments`
- `is_unspecified`
- `is_loopback`
- `is_global` (unstable)
- `is_unique_local`
- `is_unicast_link_local_strict`
- `is_documentation`
- `multicast_scope`
- `is_multicast`
- `to_ipv4_mapped`
- `to_ipv4`

Changed the implementation of `is_unspecified` and `is_loopback` to use a `match` instead of `==`.

Part of #76205
2020-09-01 19:00:20 +02:00
bors
d9cd4a33f5 Auto merge of #76047 - Dylan-DPC:rename/maybe, r=RalfJung
rename get_{ref, mut} to assume_init_{ref,mut} in Maybeuninit

References #63568

Rework with comments addressed from #66174

Have replaced most of the occurrences I've found, hopefully didn't miss out anything

r? @RalfJung

(thanks @danielhenrymantilla for the initial work on this)
2020-09-01 05:41:22 +00:00
Tyler Mandry
9d435d2543
Rollup merge of #76172 - ecstatic-morse:revert-75463, r=RalfJung
Revert #75463

This was approved by me prematurely. It needs T-libs approval. Sorry @CDirkx.

r? @RalfJung
2020-08-31 19:18:29 -07: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
Tyler Mandry
b675824493
Rollup merge of #75945 - pickfire:patch-7, r=jyn514
Use `env::func()`, not 'the function env::func' in docs for std::env

Follow up of https://github.com/rust-lang/rust/pull/75629

r? @jyn514
2020-08-31 19:18:13 -07:00
bors
45f638bd86 Auto merge of #75979 - lzutao:seprate-tests, r=Mark-Simulacrum
Move `#[cfg(test)]` modules into separate files to save recompiling the `std` crate

Implements an accepted proposal: https://github.com/rust-lang/compiler-team/issues/344

Some notes for reviewers:
* `mod tests` nested in `mod foo` in `mod bar`, I move `foo` to a new file, `tests` is a new file in foo: For example library/std/src/sys/sgx/abi/tls.rs
* `mod test` (not `mod tests`) also is moved.
* `mod benches` are moved.
* `mod tests` is placed before any `use` statements: The topic is discussed in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Code.20Style.20process
* Some files in cloudabi was changed too. But I notice copyright banners in those files, should we ping cloudabi people?
* I formatted files after moving tests around. I think that may make it easier to review :p .
* Some files don't need `ignore-tidy-filelength` anymore.
2020-08-31 20:03:33 +00:00
Dylan MacKenzie
4404cc5bc7 Revert #75463
This was approved by me prematurely. It needs T-libs approval.
2020-08-31 10:22:14 -07:00
bors
897ef3a0ec Auto merge of #75936 - sdroege:chunks-exact-construction-bounds-check, r=nagisa
Get rid of bounds check in slice::chunks_exact() and related function…

…s during construction

LLVM can't figure out in

    let rem = self.len() % chunk_size;
    let len = self.len() - rem;
    let (fst, snd) = self.split_at(len);

and

    let rem = self.len() % chunk_size;
    let (fst, snd) = self.split_at(rem);

that the index passed to split_at() is smaller than the slice length and
adds a bounds check plus panic for it.

Apart from removing the overhead of the bounds check this also allows
LLVM to optimize code around the ChunksExact iterator better.
2020-08-31 15:55:13 +00:00
DPC
943911cc8b the one left behind 2020-08-31 14:57:12 +02:00
bors
3b4797cb59 Auto merge of #76153 - matklad:rollup-vlblfup, r=matklad
Rollup of 9 pull requests

Successful merges:

 - #75969 (Switch to intra-doc links in core/src/{convert,iter}/mod.rs)
 - #76023 (Liballoc extend use intra doc link)
 - #76033 (Add missing hyphen)
 - #76052 (GH-66816:  Remove disable attr before return)
 - #76055 (Keep doc standard for Vec DrainFilter)
 - #76058 (Use assertions on Vec doc)
 - #76069 (Use explicit intra-doc link in path for Vec resize)
 - #76117 (Update README.md)
 - #76134 (Update MinGW instructions to include ninja)

Failed merges:

r? @ghost
2020-08-31 11:01:40 +00: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
Aleksey Kladov
c6017142a3
Rollup merge of #75969 - nixphix:docs/mod, r=jyn514
Switch to intra-doc links in core/src/{convert,iter}/mod.rs

Partial fix for #75080

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

r? @jyn514

couldn't fix these

```rust
     ../../std/string/struct.String.html
     ../../std/primitive.never.html
     ../../std/sync/mpsc/struct.TryIter.html
```
2020-08-31 12:51:40 +02:00
bors
8bfe289886 Auto merge of #75932 - Amjad50:intra-doc-core-slice, r=jyn514
Use intra-doc links for `core/src/slice.mod.rs`

partial help in #75080

r? @jyn514

- most are using primitive types links, which cannot be used with intra links at the moment
- also `std` cannot be referenced in any link, `std::ptr::NonNull` and `std::slice` could not be referenced
2020-08-31 09:09:37 +00:00
bors
e98f0632bb Auto merge of #75082 - Aaron1011:feature/proc-macro-backtrace, r=petrochenkov
Add `-Z proc-macro-backtrace` to allow showing proc-macro panics

Fixes #75050

Previously, we would unconditionally suppress the panic hook during
proc-macro execution. This commit adds a new flag
`-Z proc-macro-backtrace`, which allows running the panic hook for
easier debugging.
2020-08-31 03:19:05 +00:00
Lzu Tao
a4e926daee std: move "mod tests/benches" to separate files
Also doing fmt inplace as requested.
2020-08-31 02:56:59 +00:00
Aaron Hill
d9208665b5
Add -Z proc-macro-backtrace to allow showing proc-macro panics
Fixes #75050

Previously, we would unconditionally suppress the panic hook during
proc-macro execution. This commit adds a new flag
-Z proc-macro-backtrace, which allows running the panic hook for
easier debugging.
2020-08-30 22:17:24 -04: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
bors
92290d1631 Auto merge of #75463 - CDirkx:ordering-const, r=CDirkx
Make some Ordering methods const

Constify the following methods of `core::cmp::Ordering`:
 - `reverse`
 - `then`

Possible because of #49146 (Allow `if` and `match` in constants).

Tracking issue:  #76113
2020-08-31 01:28:42 +00:00
DPC
6d35f8475f fix 2020-08-31 02:27:38 +02:00
CDirkx
12f4624f71 Update since to correct release
`const_ordering` will stabilize in version 1.48.0
2020-08-30 23:59:37 +02:00
CDirkx
89fc3fb93b Stabilize feature const_ordering 2020-08-30 23:48:54 +02:00
Sebastian Dröge
8d3cf9237d Improve documentation of slice::get_unchecked() / split_at_unchecked()
Thanks to Ivan Tham, who gave the majority of these suggestions during
their review.
2020-08-30 23:13:47 +03:00
Sebastian Dröge
d08996ac54 Get rid of bounds check in slice::chunks_exact() and related functions during construction
LLVM can't figure out in

    let rem = self.len() % chunk_size;
    let len = self.len() - rem;
    let (fst, snd) = self.split_at(len);

and

    let rem = self.len() % chunk_size;
    let (fst, snd) = self.split_at(rem);

that the index passed to split_at() is smaller than the slice length and
adds a bounds check plus panic for it.

Apart from removing the overhead of the bounds check this also allows
LLVM to optimize code around the ChunksExact iterator better.
2020-08-30 23:13:47 +03:00
Sebastian Dröge
30dc32b10e Add (non-public) slice::split_at_unchecked() and split_at_mut_unchecked()
These are unsafe variants of the non-unchecked functions and don't do
any bounds checking.

For the time being these are not public and only a preparation for the
following commit. Making it public and stabilization can follow later
and be discussed in https://github.com/rust-lang/rust/issues/76014 .
2020-08-30 23:13:46 +03:00
CDirkx
5fac991bf6 Add unstable const_ordering feature, and some tests. 2020-08-30 19:40:00 +02:00
Prabakaran Kumaresshan
523fea4d14 revert Some(Item) link 2020-08-30 19:19:20 +05:30
Ivan Tham
1d017eb6a4
Fix env doc vars_os broken link 2020-08-30 21:19:21 +08:00
DPC
b3d7b7bdcb update fixmes 2020-08-30 14:43:52 +02:00
Prabakaran Kumaresshan
7ea4c28af2 add i32::MAX link 2020-08-30 17:07:50 +05:30
Amjad Alsharafi
300a0072a2 Fix intra-doc path resolution problem in library/alloc/src/slice.rs
`alloc::slice` uses `core::slice` functions, documentation are copied
from there and the links as well without resolution. `crate::ptr...`
cannot be resolved in `alloc::slice`, but `ptr` itself is imported in
both `alloc::slice` and `core::slice`, so we used that instead.
2020-08-30 15:22:27 +08:00
Ivan Tham
00cf550c2b Env use shorter intra-doc links in path
vars() rather than vars function

Co-authored-by: Joshua Nelson <joshua@yottadb.com>

Use [xxx()] rather than the [xxx] function

Co-authored-by: Joshua Nelson <joshua@yottadb.com>

Env text representation of function intra-doc link

Suggested by @jyn514

Link join_paths in env doc for parity

Change xxx to env::xxx for lib env doc

Add link requsted by @jyn514

Fix doc build with same link

Co-authored-by: Joshua Nelson <joshua@yottadb.com>

Fix missing intra-doc link

Fix added whitespace in doc

Co-authored-by: Joshua Nelson <joshua@yottadb.com>

Add brackets for `join_paths`

Co-authored-by: Joshua Nelson <joshua@yottadb.com>

Use unused link join_paths

Removed same link for join_paths

Co-authored-by: Joshua Nelson <joshua@yottadb.com>

Remove unsed link join_paths
2020-08-30 11:16:06 +08:00
Prabakaran Kumaresshan
01d95f241b resolve comments 2020-08-30 05:40:47 +05:30
Prabakaran Kumaresshan
8a92718b64 Switch to intra-doc links in core/src/{convert,iter}/mod.rs 2020-08-30 05:40:47 +05:30
Dylan DPC
11193ca202
Rollup merge of #76029 - denisvasilik:intra-doc-links-core-atomic, r=kennytm
Move to intra-doc links for library/core/src/sync/atomic.rs

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

Known issues:

* Link from core to std:

    [`Arc`]
	[`std:🧵:yield_now`]
	[`std:🧵:sleep`]
	[`std::sync::Mutex`]
2020-08-30 01:43:59 +02:00
Dylan DPC
96e0bc7b6b
Rollup merge of #75990 - rylev:arm-fastfail, r=alexcrichton
Add __fastfail for Windows on arm/aarch64

Fixes #73215
2020-08-30 01:43:54 +02:00
Dylan DPC
9225aabef4
Rollup merge of #75917 - poliorcetics:intra-doc-core-nonnull, r=jyn514
Move to intra doc links for core::ptr::non_null

Helps with #75080.

@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc

r? @jyn514
2020-08-30 01:43:50 +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
Dylan DPC
d17db64b8d
Rollup merge of #75852 - camelid:patch-3, r=jyn514
Switch to intra-doc links in `core::hash`

Part of #75080.

@rustbot modify labels: A-intra-doc-links T-doc T-rustdoc
2020-08-30 01:43:39 +02:00
Dylan DPC
027b2f1e06
Rollup merge of #75832 - kofls:intradoc-fix, r=jyn514
Move to intra-doc links for wasi/ext/fs.rs, os_str_bytes.rs…

…, primitive_docs.rs & poison.rs

Partial fix for #75080

r? @jyn514
2020-08-30 01:43:37 +02:00
DPC
ea800d529a fix tests 2020-08-29 17:25:14 +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
Ryan Levick
d931e97402 Explicitly look for 'thumb-mode' before using __fastfail on 'arm' 2020-08-29 12:30:49 +02:00
Ivan Tham
d727442f2d
Remove brackets in drain filter docs 2020-08-29 18:23:29 +08:00