Commit graph

1514 commits

Author SHA1 Message Date
Scott McMurray
d74b8e0505 Replace some once(x).chain(once(y)) with [x, y] IntoIter
Now that we have by-value array iterators...
2020-10-03 16:51:43 -07:00
Stein Somers
a58089e097 BTreeMap/Set: complete the compile-time test cases 2020-10-04 01:04:29 +02:00
Stein Somers
3b051d0171 BTreeMap: comment why drain_filter's size_hint is somewhat pessimistictid 2020-10-03 21:18:18 +02:00
bors
738d4a7a36 Auto merge of #74160 - CAD97:weak-as-unsized-ptr, r=RalfJung
Allow Weak::as_ptr and friends for unsized T

Relaxes `impl<T> Weak<T>` to `impl<T: ?Sized> Weak<T>` for the methods `rc::Weak::as_ptr`, `into_raw`, and `from_raw`.

Follow-up to #73845, which did most of the impl work to make these functions work for `T: ?Sized`.

We still have to adjust the implementation of `Weak::from_raw` here, however, because I missed a use of `ptr.is_null()` previously. This check was necessary when `into`/`from_raw` were first implemented, as `into_raw` returned `ptr::null()` for dangling weak. However, we now just (wrapping) offset dangling weaks' pointers the same as nondangling weak, so the null check is no longer necessary (or even hit). (I can submit just 17a928f as a separate PR if desired.)

As a nice side effect, moves the `fn is_dangling` definition closer to `Weak::new`, which creates the dangling weak.

This technically stabilizes that "something like `align_of_val_raw`" is possible to do. However, I believe the part of the functionality required by these methods here -- specifically, getting the alignment of a pointee from a pointer where it may be dangling iff the pointee is `Sized` -- is uncontroversial enough to stabilize these methods without a way to implement them on stable Rust.

r? `@RalfJung,` who reviewed #73845.

ATTN: This changes (relaxes) the (input) generic bounds on stable fn!
2020-10-03 14:18:26 +00:00
Ralf Jung
e27ef130c1
grammar nit 2020-10-03 12:15:26 +02:00
bors
6f56fbdc1c Auto merge of #77347 - jyn514:dox, r=Amanieu
Remove --cfg dox from rustdoc.rs

This was added in https://github.com/rust-lang/rust/pull/53076 because
several dependencies were using `cfg(dox)` instead of `cfg(rustdoc)` (now `cfg(doc)`).
I ran `rg 'cfg\(dox\)'` on the source tree with no matches, so I think
this is now safe to remove.

r? `@Mark-Simulacrum`
cc `@QuietMisdreavus` :)
2020-10-03 07:23:02 +00:00
Stein Somers
d71d13e82d BTreeMap: refactoring around edges, missed spots 2020-10-03 01:06:55 +02:00
Jonas Schievink
01ca8299d4
Rollup merge of #77264 - fusion-engineering-forks:skip-local-stdio, r=dtolnay
Only use LOCAL_{STDOUT,STDERR} when set_{print/panic} is used.

The thread local `LOCAL_STDOUT` and `LOCAL_STDERR` are only used by the `test` crate to capture output from tests when running them in the same process in differen threads. However, every program will check these variables on every print, even outside of testing.

This involves allocating a thread local key, and registering a thread local destructor. This can be somewhat expensive.

This change keeps a global flag (`LOCAL_STREAMS`) which will be set to `true` when either of these local streams is used. (So, effectively only in test and benchmark runs.) When this flag is off, these thread locals are not even looked at and therefore will not be initialized on the first output on every thread, which also means no thread local destructors will be registered.

---

Together with https://github.com/rust-lang/rust/pull/77154, this should make output a little bit more efficient.
2020-10-03 00:31:14 +02:00
Jonas Schievink
ccc020ab42
Rollup merge of #77182 - GuillaumeGomez:missing-examples-fd-traits, r=pickfire
Add missing examples for Fd traits

Not sure what happened here... This is a reopening of #77142

r? @Dylan-DPC
2020-10-03 00:31:10 +02:00
Jonas Schievink
389f7cf7d6
Rollup merge of #76745 - workingjubilee:move-wrapping-tests, r=matklad
Move Wrapping<T> ui tests into library

Part of #76268
r? @matklad
2020-10-03 00:31:08 +02:00
Jonas Schievink
1118ab9930
Rollup merge of #75377 - canova:map_debug_impl, r=dtolnay
Fix Debug implementations of some of the HashMap and BTreeMap iterator types

HashMap's `ValuesMut`, BTreeMaps `ValuesMut`, IntoValues and `IntoKeys` structs were printing both keys and values on their Debug implementations. But they are iterators over either keys or values. Irrelevant values should not be visible. With this PR, they only show relevant fields.
This fixes #75297.

[Here's an example code.](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=0c79356ed860e347a0c1a205616f93b7) This prints this on nightly:
```
ValuesMut { inner: IterMut { range: [(1, "hello"), (2, "goodbye")], length: 2 } }
IntoKeys { inner: [(1, "hello"), (2, "goodbye")] }
IntoValues { inner: [(1, "hello"), (2, "goodbye")] }
[(2, "goodbye"), (1, "hello")]
```

After the patch this example prints these instead:
```
["hello", "goodbye"]
["hello", "goodbye"]
[1, 2]
["hello", "goodbye"]
```

I didn't add test cases for them, since I couldn't see any tests for Debug implementations anywhere. But please let me know if I should add it to a specific place.

r? @dtolnay
2020-10-03 00:31:04 +02:00
Jubilee Young
4e973966b9 Remove unnecessary mod-cfg 2020-10-02 11:40:57 -07:00
Jonas Schievink
14d8ee3465
Rollup merge of #77442 - pickfire:patch-7, r=scottmcm
Clean up on example doc fixes for ptr::copy

Follow up of #77385

r? @scottmcm
2020-10-02 20:27:14 +02:00
Jonas Schievink
72d275d844
Rollup merge of #77432 - tmiasko:posix-spawn-musl, r=cuviper
Use posix_spawn on musl targets

The posix_spawn had been available in a form suitable for use in a
Command implementation since musl 0.9.12. Use it in a preference to a
fork when possible, to benefit from CLONE_VM|CLONE_VFORK used there.
2020-10-02 20:27:11 +02:00
Jonas Schievink
18ac26d1c5
Rollup merge of #77409 - pickfire:patch-6, r=GuillaumeGomez
Add example for iter chain struct

r? @GuillaumeGomez
2020-10-02 20:27:06 +02:00
Jonas Schievink
2a09c184c0
Rollup merge of #77405 - timvermeulen:iter_advance_by_tracking_issue, r=scottmcm
Add tracking issue of iter_advance_by feature
2020-10-02 20:27:04 +02:00
Guillaume Gomez
d6b838b93a Simplify fd examples 2020-10-02 16:38:15 +02:00
Stein Somers
90c8b43bc3 BTreeMap: document DrainFilterInner better 2020-10-02 13:13:28 +02:00
bors
154f1f544d Auto merge of #77029 - ehuss:command-access, r=dtolnay
Add accessors to Command.

This adds some accessor methods to `Command` to provide a way to access the values set when building the `Command`. An example where this can be useful is to display the command to be executed. This is roughly based on the [`ProcessBuilder`](13b73cdaf7/src/cargo/util/process_builder.rs (L105-L134)) in Cargo.

Possible concerns about the API:
- Values with NULs on Unix will be returned as `"<string-with-nul>"`. I don't think it is practical to avoid this, since otherwise a whole separate copy of all the values would need to be kept in `Command`.
- Does not handle `arg0` on Unix. This can be awkward to support in `get_args` and is rarely used. I figure if someone really wants it, it can be added to `CommandExt` as a separate method.
- Does not offer a way to detect `env_clear`. I'm uncertain if it would be useful for anyone.
- Does not offer a way to get an environment variable by name (`get_env`). I figure this can be added later if anyone really wants it. I think the motivation for this is weak, though. Also, the API could be a little awkward (return a `Option<Option<&OsStr>>`?).
- `get_envs` could skip "cleared" entries and just return `&OsStr` values instead of `Option<&OsStr>`. I'm on the fence here. My use case is to display a shell command, and I only intend it to be roughly equivalent to the actual execution, and I probably won't display `None` entries. I erred on the side of providing extra information, but I suspect many situations will just filter out the `None`s.
- Could implement more iterator stuff (like `DoubleEndedIterator`).

I have not implemented new std items before, so I'm uncertain if the existing issue should be reused, or if a new tracking issue is needed.

cc #44434
2020-10-02 07:51:24 +00:00
Mara Bos
b1ce7a38a6 Disable condvar::two_mutexes test on non-unix platforms.
Condvars are no longer guaranteed to panic in this case on all
platforms. At least the unix implementation still does.
2020-10-02 09:47:08 +02:00
Mara Bos
f3837e788b No longer put windows condvars in a box.
Windows condition variables are movable (while not borrowed) according
to their documentation.
2020-10-02 09:47:08 +02:00
Mara Bos
ec69a858e4 No longer put wasm condvars in a box.
These condvars are just an AtomicUsize, so can be moved without
problems.
2020-10-02 09:47:08 +02:00
Mara Bos
7f56a35411 No longer put condvars on the 'unsupported' platform in a box.
These condvars are unsupported and implemented as a ZST, so can be moved
without problems.
2020-10-02 09:47:08 +02:00
Mara Bos
5769a46788 No longer put cloudabi condvars in a box.
Cloudabi condvars may be moved safely.
2020-10-02 09:47:08 +02:00
Mara Bos
b181f5a923 Make it possible to have unboxed condvars on specific platforms.
This commit keeps all condvars boxed on all platforms, but makes it
trivial to remove the box on some platforms later.
2020-10-02 09:47:08 +02:00
Mara Bos
dc81cbdcb1 No longer put windows mutexes in a box.
Windows SRW locks are movable (while not borrowed) according to their
documentation.
2020-10-02 09:47:08 +02:00
Mara Bos
4f1353e54f No longer put wasm mutexes in a box.
These mutexes are just an AtomicUsize, so can be moved without
problems.
2020-10-02 09:47:08 +02:00
Mara Bos
2f0386771d No longer put mutexes on the 'unsupported' platform in a box.
These mutexes are just a bool (in a cell), so can be moved without
problems.
2020-10-02 09:47:08 +02:00
Mara Bos
def5188ca8 No longer put cloudabi mutexes in a box.
Cloudabi mutexes may be moved safely.
2020-10-02 09:47:08 +02:00
Mara Bos
58deb7001d Make it possible to have unboxed mutexes on specific platforms.
This commit keeps all mutexes boxed on all platforms, but makes it
trivial to remove the box on some platforms later.
2020-10-02 09:47:08 +02:00
Mara Bos
a8c2d4fc3d Move boxing and mutex checking logic of condvar into sys_common. 2020-10-02 09:47:08 +02:00
Harald Hoyer
cadd12b5f0 Implement Make handle_alloc_error default to panic (for no_std + liballoc)
Related: https://github.com/rust-lang/rust/issues/66741

Guarded with `#![feature(default_alloc_error_handler)]` a default
`alloc_error_handler` is called, if a custom allocator is used and no
other custom `#[alloc_error_handler]` is defined.

The panic message does not contain the size anymore, because it would
pull in the fmt machinery, which would blow up the code size
significantly.
2020-10-02 09:00:29 +02:00
Ivan Tham
ddd19866a7
Clean up on example doc fixes for ptr::copy
Follow up of #77385
2020-10-02 14:44:01 +08:00
Yuki Okushi
5a7218009e
Rollup merge of #77429 - WaffleLapkin:doc_link_default_hasher_new, r=jyn514
Link `new` method in `DefautHasher`s doc

FIXME referenced #56922 which was resolved

r? @jyn514
2020-10-02 08:25:27 +09:00
Yuki Okushi
c820a522ca
Rollup merge of #77399 - ssomers:btree_cleanup_5, r=Mark-Simulacrum
BTreeMap: use Unique::from to avoid a cast where type information exists

r? @Mark-Simulacrum
2020-10-02 08:25:25 +09:00
Yuki Okushi
fbb3dd4780
Rollup merge of #77389 - jyn514:THE-PAPERCLIP-COMETH, r=Mark-Simulacrum
Fix some clippy lints

Found while working on https://github.com/rust-lang/rust/pull/77351;
these are just the ones that could be fixed automatically.
2020-10-02 08:25:24 +09:00
Yuki Okushi
2e749ab5a4
Rollup merge of #77385 - scottmcm:fix-77220, r=jyn514
Improve the example for ptr::copy

Fixes #77220
2020-10-02 08:25:22 +09:00
Yuki Okushi
55d0959328
Rollup merge of #77362 - RReverser:patch-1, r=dtolnay
Fix is_absolute on WASI

WASI does not match `cfg(unix)`, but its paths are Unix-like (`/some/path`) and don't have Windows-like prefixes.

Without this change, `is_absolute` for any paths, including `/some/path`, was returning `false`on a WASI target, which is obviously not true and undesirable.
2020-10-02 08:25:19 +09:00
Yuki Okushi
1c4a5f8d1e
Rollup merge of #77147 - fusion-engineering-forks:static-mutex, r=dtolnay
Split sys_common::Mutex in StaticMutex and MovableMutex.

The (unsafe) `Mutex` from `sys_common` had a rather complicated interface. You were supposed to call `init()` manually, unless you could guarantee it was neither moved nor used reentrantly.

Calling `destroy()` was also optional, although it was unclear if 1) resources might be leaked or not, and 2) if `destroy()` should only be called when `init()` was called.

This allowed for a number of interesting (confusing?) different ways to use this `Mutex`, all captured in a single type.

In practice, this type was only ever used in two ways:

1. As a static variable. In this case, neither `init()` nor `destroy()` are called. The variable is never moved, and it is never used reentrantly. It is only ever locked using the `LockGuard`, never with `raw_lock`.

2. As a `Box`ed variable. In this case, both `init()` and `destroy()` are called, it will be moved and possibly used reentrantly.

No other combinations are used anywhere in `std`.

This change simplifies things by splitting this `Mutex` type into two types matching the two use cases: `StaticMutex` and `MovableMutex`.

The interface of both new types is now both safer and simpler. The first one does not call nor expose `init`/`destroy`, and the second one calls those automatically in its `new()` and `Drop` functions. Also, the locking functions of `MovableMutex` are no longer unsafe.

---

This will also make it easier to conditionally box mutexes later, by moving that decision into sys/sys_common. Some of the mutex implementations (at least those of Wasm and 'sys/unsupported') are safe to move, so wouldn't need a box. ~~(But that's blocked on  #76932 for now.)~~ (See #77380.)
2020-10-02 08:25:15 +09:00
Yuki Okushi
9eaf536c32
Rollup merge of #77111 - fusion-engineering-forks:stabilize-slice-ptr-range, r=dtolnay
Stabilize slice_ptr_range.

This has been unstable for almost a year now. Time to stabilize?

Closes #65807.

@rustbot modify labels: +T-libs +A-raw-pointers +A-slice +needs-fcp
2020-10-02 08:25:13 +09:00
Yuki Okushi
00b3450bbc
Rollup merge of #76979 - fusion-engineering-forks:windows-fallback-check, r=dtolnay
Improve std::sys::windows::compat

Improves the compat_fn macro in sys::windows, which is used for conditionally loading APIs that might not be available.

- The module (dll) name can now be any string, not just an ident. (Not all Windows api modules are valid Rust identifiers. E.g. `WaitOnAddress` comes from `API-MS-Win-Core-Synch-l1-2-0.dll`.)
- Adds `FuncName::is_available()` for checking if a function is really available without having to do a duplicate lookup.
- Add comment explaining the lack of locking.
- Use `$_:block` to simplify the macro_rules.
- Apply `allow(unused_variables)` only to the fallback instead of everything.

---

The second point (`is_available()`) simplifies code that needs to pick an implementation depening on what is available, like `sys/windows/mutex.rs`. Before this change, it'd do its own lookup and keep its own `AtomicUsize` to track the result. Now it can just use `c::AcquireSRWLockExclusive::is_available()` directly.

This will also be useful when park/unpark/CondVar/etc. get improved implementations (e.g. from parking_lot or something else), as the best APIs for those are not available before Windows 8.
2020-10-02 08:25:11 +09:00
Waffle
1c2c336dbc Link new method in DefautHashers doc 2020-10-02 00:30:19 +03:00
Michael Howell
cd159fd7f9 Uplift drop-bounds lint from clippy 2020-10-01 12:06:33 -07:00
bors
8fe73e80d7 Auto merge of #76971 - bugadani:issue-75659, r=Amanieu
Refactor memchr to allow optimization

Closes #75659

The implementation already uses naive search if the slice if short enough, but the case is complicated enough to not be optimized away. This PR refactors memchr so that it exists early when the slice is short enough.

Codegen-wise, as shown in #75659, memchr was not inlined previously so the only way I could find to test this is to check if there is no memchr call. Let me know if there is a more robust solution here.
2020-10-01 18:16:02 +00:00
Ivan Tham
aea3f8dbc9
Remove trailing whitespace in iter chain doc 2020-10-02 01:21:36 +08:00
Joshua Nelson
ca987789ea Update stdarch submodule
The primary purpose is to get the fixes from
https://github.com/rust-lang/stdarch/pull/920
and https://github.com/rust-lang/stdarch/pull/922.

The other changes included are
https://github.com/rust-lang/stdarch/pull/917 and
https://github.com/rust-lang/stdarch/pull/919.
2020-10-01 13:06:22 -04:00
Ivan Tham
676e4f193c
Add example for iter chain struct 2020-10-02 00:45:19 +08:00
bors
2ad6187ce5 Auto merge of #76969 - withoutboats:rawfd-refexive-traits, r=dtolnay
Make RawFd implement the RawFd traits

This PR makes `RawFd` implement `AsRawFd`, `IntoRawFd` and `FromRawFd`, so it can be passed to interfaces that use one of those traits as a bound.
2020-10-01 15:39:33 +00:00
Tim Vermeulen
4404c1afae Add tracking issue 2020-10-01 16:52:22 +02:00
Mara Bos
63b6007d5b Work around potential merging/duplication issues in sys/windows/compat. 2020-10-01 16:52:11 +02:00
Mara Bos
09cbaf4367 Formatting. 2020-10-01 16:08:58 +02:00
Mara Bos
93310efdbe Use AcquireSRWLockExclusive::is_available() instead of an extra lookup. 2020-10-01 16:08:58 +02:00
Mara Bos
8b2bdfd453 Improve std::sys::windows::compat.
- Module name can now be any string, not just an ident.
  (Not all Windows api modules are valid Rust identifiers.)
- Adds c::FuncName::is_available() for checking if a function is really
  available without having to do a duplicate lookup.
- Add comment explaining the lack of locking.
- Use `$_:block` to simplify the macro_rules.
- Apply allow(unused_variables) only to the fallback instead of
  everything.
2020-10-01 16:08:57 +02:00
bors
782013564e Auto merge of #76919 - fusion-engineering-forks:thread-parker, r=dtolnay
Use futex-based thread::park/unpark on Linux.

This moves the parking/unparking logic out of `thread/mod.rs` into a module named `thread_parker` in `sys_common`. The current implementation is moved to `sys_common/thread_parker/generic.rs` and the new implementation using futexes is added in `sys_common/thread_parker/futex.rs`.
2020-10-01 13:21:34 +00:00
Stein Somers
424347527d BTreeMap: use Unique::from to avoid a cast where type information exists 2020-10-01 15:03:51 +02:00
Stein Somers
df76cf89ad BTreeMap: admit the existence of leaf edges in comments 2020-10-01 13:20:39 +02:00
scottmcm
e58f3d352d
Things are only moved if non-copy 2020-10-01 07:04:20 +00:00
bors
00730fd0f1 Auto merge of #77383 - pickfire:patch-6, r=Mark-Simulacrum
Fix typo in vec doc "tries to reserves"

Superseeds #77192
2020-10-01 05:35:48 +00:00
Joshua Nelson
8164218181 Fix some clippy issues
Found while working on https://github.com/rust-lang/rust/pull/77351;
these are just the ones that could be fixed automatically.
2020-10-01 01:34:38 -04:00
Scott McMurray
20202da09e Improve the example for ptr::copy
Fixes #77220
2020-09-30 20:00:09 -07:00
Ivan Tham
86e30b605c
Fix typo in vec doc "tries to reserves" 2020-10-01 10:08:51 +08:00
bors
b218b952f8 Auto merge of #77381 - Dylan-DPC:rollup-0sr6p5p, r=Dylan-DPC
Rollup of 12 pull requests

Successful merges:

 - #76909 (Add Iterator::advance_by and DoubleEndedIterator::advance_back_by)
 - #77153 (Fix recursive nonterminal expansion during pretty-print/reparse check)
 - #77202 (Defer Apple SDKROOT detection to link time.)
 - #77303 (const evaluatable: improve `TooGeneric` handling)
 - #77305 (move candidate_from_obligation_no_cache)
 - #77315 (Rename AllocErr to AllocError)
 - #77319 (Stable hashing: add comments and tests concerning platform-independence)
 - #77324 (Don't fire `const_item_mutation` lint on writes through a pointer)
 - #77343 (Validate `rustc_args_required_const`)
 - #77349 (Update cargo)
 - #77360 (References to ZSTs may be at arbitrary aligned addresses)
 - #77371 (Remove trailing space in error message)

Failed merges:

r? `@ghost`
2020-10-01 01:12:41 +00:00
Dylan DPC
70740b1b82
Rollup merge of #77315 - exrook:rename-allocerror, r=joshtriplett
Rename AllocErr to AllocError

Implements rust-lang/wg-allocators#57
2020-10-01 02:13:39 +02:00
Dylan DPC
8bd4ed9f95
Rollup merge of #76909 - timvermeulen:advance_by, r=Amanieu
Add Iterator::advance_by and DoubleEndedIterator::advance_back_by

This PR adds the iterator method

```rust
fn advance_by(&mut self, n: usize) -> Result<(), usize>
```

that advances the iterator by `n` elements, returning `Ok(())` if this succeeds or `Err(len)` if the length of the iterator was less than `n`.

Currently `Iterator::nth` is the method to override for efficiently advancing an iterator by multiple elements at once. `advance_by` is superior for this purpose because
- it's simpler to implement: instead of advancing the iterator and producing the next element you only need to advance the iterator
- it composes better: iterators like `Chain` and `FlatMap` can implement `advance_by` in terms of `advance_by` on their inner iterators, but they cannot implement `nth` in terms of `nth` on their inner iterators (see #60395)
- the default implementation of `nth` can trivially be implemented in terms of `advance_by` and `next`, which this PR also does

This PR also adds `DoubleEndedIterator::advance_back_by` for all the same reasons.

I'll make a tracking issue if it's decided this is worth merging. Also let me know if anything can be improved, this went through several iterations so there might very well still be room for improvement (especially in the doc comments). I've written overrides of these methods for most iterators that already override `nth`/`nth_back`, but those still need tests so I'll add them in a later PR.

cc @cuviper @scottmcm @Amanieu
2020-10-01 02:13:29 +02:00
Tomasz Miąsko
9845e7d5fb Use posix_spawn on musl targets
The posix_spawn had been available in a form suitable for use in a
Command implementation since musl 0.9.12. Use it in a preference to a
fork when possible, to benefit from CLONE_VM|CLONE_VFORK used there.
2020-10-01 00:00:00 +00:00
bors
9bb55dc864 Auto merge of #76325 - lzutao:split-core-str, r=Amanieu
Split core/str/mod.rs to smaller files

Note for reviewer:
* I split to multiple commits for easier reviewing, but I could git squash them all to one if requested.
* Recommend pulling this change locally and using advanced git diff viewer or this command:
  ```bash
  git show --reverse --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space master..
  ```

---

I split `core/str/mod.rs` to these modules:

* `converts`: Contains helper functions to convert from bytes to str.
* `error`: For error structs like Utf8Error.
* `iter`: For iterators of many str methods.
* `traits`: For indexing operations and build in traits on str.
* `validations`: For functions validating utf8 --- This name is awkward, maybe utf8.rs is better.
2020-09-30 23:04:16 +00:00
Jonas Schievink
fea2ad8a0a
Rollup merge of #77340 - pickfire:patch-9, r=kennytm
Alloc vec use imported path

mem::ManuallyDrop::new -> ManuallyDrop::new

cc @the8472
2020-09-30 20:56:21 +02:00
Jonas Schievink
054ba3db2d
Rollup merge of #77338 - pickfire:patch-7, r=jyn514
Fix typo in alloc vec comment

cc @the8472
2020-09-30 20:56:19 +02:00
Jonas Schievink
c46f5784a6
Rollup merge of #77328 - hyd-dev:assert-to-rtassert, r=Amanieu
Use `rtassert!` instead of `assert!` from the child process after fork() in std::sys::unix::process::Command::spawn()

As discussed in #73894, `assert!` panics on failure, which is not signal-safe, and `rtassert!` is a suitable replacement.

Fixes #73894.

r? @Amanieu @cuviper @joshtriplett
2020-09-30 20:56:15 +02:00
Jonas Schievink
87387fd23e
Rollup merge of #77284 - josephlr:mem, r=Mark-Simulacrum
library: Forward compiler-builtins "mem" feature

This fixes https://github.com/rust-lang/wg-cargo-std-aware/issues/53

Now users will be able to do:
```
cargo build -Zbuild-std=core -Zbuild-std-features=compiler-builtins-mem
```
and correctly get the Rust implemenations for `memcpy` and friends.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-30 20:56:10 +02:00
Jonas Schievink
7ad03dd91d
Rollup merge of #77233 - ssomers:btree_size_matters, r=Mark-Simulacrum
BTreeMap: keep an eye out on the size of the main components

r? @Mark-Simulacrum
2020-09-30 20:56:07 +02:00
Ingvar Stepanyan
494d6e514b
Fix is_absolute on WASI
WASI does not match `cfg(unix)`, but its paths are Unix-like (`/some/path`) and don't have Windows-like prefixes.

Without this change, `is_absolute` for paths like `/some/path` was returning `false`on a WASI target, which is obviously not true and undesirable.
2020-09-30 13:12:25 +01:00
bors
c0127e4dbf Auto merge of #77292 - lzutao:std_asm, r=Amanieu
Prefer asm! in std - all in sgx module

Similar to the change in #76669 but all `llvm_asm!` is gate in x86/x86_64 target.
Godbolt:
- https://rust.godbolt.org/z/h7nG1h
- https://rust.godbolt.org/z/xx39hW
2020-09-30 05:27:16 +00:00
bors
0d97f7a968 Auto merge of #77289 - TimDiekmann:alloc-ref-by-ref, r=Amanieu
Change `AllocRef::by_ref` to take `&self` instead of `&mut self`

r? `@Amanieu`
2020-09-29 22:13:37 +00:00
Ivan Tham
f9b625f8e0
Alloc vec use imported path
mem::ManuallyDrop::new -> ManuallyDrop::new
2020-09-29 23:00:02 +08:00
Ivan Tham
b141e49d87
Fix typo in alloc vec comment 2020-09-29 22:33:57 +08:00
bors
9e34b72964 Auto merge of #77253 - jyn514:crate-link, r=Manishearth
Resolve `crate` in intra-doc links properly across crates

Closes https://github.com/rust-lang/rust/issues/77193; see https://github.com/rust-lang/rust/issues/77193#issuecomment-699065946 for an explanation of what's going on here.
~~This also fixes the BTreeMap docs that have been broken for a while; see the description on the second commit for why and how.~~ Nope, see the second commit for why the link had to be changed.

r? `@Manishearth`
cc `@dylni`

`@dylni` note that this doesn't solve your original problem - now _both_ `with_code` and `crate::with_code` will be broken links. However this will fix a lot of other broken links (in particular I think https://docs.rs/sqlx/0.4.0-beta.1/sqlx/query/struct.Query.html is because of this bug). I'll open another issue for resolving additional docs in the new scope.
2020-09-29 12:11:17 +00:00
Shahar Or (mightyiam)
badf4afdd5 core::global_allocator docs link to std::alloc::GlobalAlloc 2020-09-29 14:39:44 +07:00
hyd-dev
a2526b416f
Use rtassert! instead of assert! from the child process after fork() in std::sys::unix::process::Command::spawn()
`assert!` panics on failure, which is not signal-safe.
2020-09-29 15:16:46 +08:00
kadmin
3f1d2aadd1 Use more efficient scheme for display u128/i128
Add zero padding

Add benchmarks for fmt u128

This tests both when there is the max amount of work(all characters used)
And least amount of work(1 character used)
2020-09-28 20:38:38 +00:00
Jacob Hughes
5829560a68 Rename AllocErr to AllocError 2020-09-28 14:51:03 -04:00
Ralf Jung
a966f54bbb
Rollup merge of #77288 - RalfJung:miri-macos, r=Amanieu
fix building libstd for Miri on macOS

Fixes a Miri regression introduced by https://github.com/rust-lang/rust/pull/75295
Cc @tmiasko @Amanieu
2020-09-28 18:39:47 +02:00
Ralf Jung
aba966a592
Rollup merge of #77194 - pickfire:patch-7, r=withoutboats
Add doc alias for iterator fold

fold is known in python and javascript as reduce,
not sure about inject but it was written in doc there.

This was my first confusion when coming into rust, I somehow cannot find where is reduce, sometimes I still forget that it is known as `fold`.
2020-09-28 18:39:46 +02:00
Ralf Jung
85a59d40f1
Rollup merge of #77170 - ecstatic-morse:const-fn-ptr, r=oli-obk
Remove `#[rustc_allow_const_fn_ptr]` and add `#![feature(const_fn_fn_ptr_basics)]`

`rustc_allow_const_fn_ptr` was a hack to work around the lack of an escape hatch for the "min `const fn`" checks in const-stable functions. Now that we have co-opted `allow_internal_unstable` for this purpose, we no longer need a bespoke attribute.

Now this functionality is gated under `const_fn_fn_ptr_basics` (how concise!), and `#[allow_internal_unstable(const_fn_fn_ptr_basics)]` replaces `#[rustc_allow_const_fn_ptr]`. `const_fn_fn_ptr_basics` allows function pointer types to appear in the arguments and locals of a `const fn` as well as function pointer casts to be performed inside a `const fn`. Both of these were allowed in constants and statics already. Notably, this does **not** allow users to invoke function pointers in a const context. Presumably, we will use a nicer name for that (`const_fn_ptr`?).

r? @oli-obk
2020-09-28 18:39:44 +02:00
Ralf Jung
734c57d45c
Rollup merge of #76454 - poliorcetics:ui-to-unit-test-1, r=matklad
UI to unit test for those using Cell/RefCell/UnsafeCell

Helps with #76268.

I'm working on all files using `Cell` and moving them to unit tests when possible.

r? @matklad
2020-09-28 18:39:39 +02:00
Lzu Tao
d4772014d9 Prefer asm! in std - all in sgx module 2020-09-28 13:08:34 +00:00
bors
1d5a865b2f Auto merge of #77282 - glaubitz:sparc-linux, r=nagisa
Add missing definitions required by the sparc-unknown-linux-gnu target

This PR adds a few missing definitions required by sparc-unknown-linux-target which were discovered during build tests.
2020-09-28 10:37:41 +00:00
Tim Diekmann
c22d896b9b Change AllocRef::by_ref to take &self instead of &mut self 2020-09-28 10:42:29 +02:00
Ralf Jung
dc8414b607 fix building libstd for Miri on macOS 2020-09-28 10:32:05 +02:00
Joe Richey
37f795697c
libary: Forward compiler-builtins "mem" feature
This fixes https://github.com/rust-lang/wg-cargo-std-aware/issues/53

Now users will be able to do:
```
cargo build -Zbuild-std=core -Zbuild-std-features=compiler-builtins-mem
```
and correctly get the Rust implemenations for `memcpy` and friends.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-27 20:31:06 -07:00
John Paul Adrian Glaubitz
d25b0364e1 library/std: Set OS raw type definitions for sparc-unknown-linux-gnu 2020-09-28 00:39:57 +02:00
John Paul Adrian Glaubitz
d9de08d65c library/std/sys_common: Define MIN_ALIGN for sparc-unknown-linux-gnu 2020-09-28 00:39:57 +02:00
John Paul Adrian Glaubitz
1fefba5e0b library/{panic_,}unwind: Add definitions for sparc-unknow-linux-gnu 2020-09-28 00:39:57 +02:00
Tomasz Miąsko
7d98d2207a Reopen standard streams when they are closed on Unix
The syscalls returning a new file descriptors generally use
lowest-numbered file descriptor not currently opened, without any
exceptions for those corresponding to the standard streams.

Previously when any of standard streams has been closed before starting
the application, operations on std::io::{stderr,stdin,stdout} objects
were likely to operate on other logically unrelated file resources
opened afterwards.

Avoid the issue by reopening the standard streams when they are closed.
2020-09-27 22:55:43 +02:00
Dylan MacKenzie
3cbd17fcc6 Remove rustc_allow_const_fn_ptr
This was a hack to work around the lack of an escape hatch for the "min
`const fn`" checks in const-stable functions. Now that we have co-opted
`allow_internal_unstable` for this purpose, we no longer need the
bespoke attribute.
2020-09-27 10:46:41 -07:00
Dylan MacKenzie
1ff143191c Add a feature gate for basic function pointer use in const fn 2020-09-27 10:46:41 -07:00
Joshua Nelson
406584621a Use relative links instead of intra-doc links
Previously, `BTreeMap` tried to link to `crate::collections`, intending
for the link to go to `std/collections/index.html`. But `BTreeMap` is
defined in `alloc`, so after the fix in the previous commit, the links
instead went to `alloc/collections/index.html`, which has almost no
information.

This changes it to link to `index.html`, which only works when viewing
from `std::collections::BTreeMap`, the most common place to visit the
docs. Fixing it to work from anywhere would require the docs for
`std::collections` to be duplicated in `alloc::collections`, which in
turn would require HashMap to be `alloc` for intra-doc links to work
(https://github.com/rust-lang/rust/issues/74481).
2020-09-27 11:28:13 -04:00
bors
1d216fef3e Auto merge of #77259 - dgbo:master, r=kennytm
update stdarch submodule

This commit update the src/stdarch submodule, we primarily want to include [https://github.com/rust-lang/stdarch/pull/918](url) which provides prefetch hints for aarch64. This PR could deliver ~20% performance gain on our aarch64 server in Filecoin. Wish this could be used as soon as possible.

Thanks.
2020-09-27 15:14:55 +00:00
Mara Bos
de597fca40 Optimize set_{panic,print}(None). 2020-09-27 16:04:25 +02:00
Mara Bos
ed3ead013f Relax memory ordering of LOCAL_STREAMS and document it. 2020-09-27 16:04:25 +02:00
Mara Bos
07fd17f701 Only use LOCAL_{STDOUT,STDERR} when set_{print/panic} is used.
The thread local LOCAL_STDOUT and LOCAL_STDERR are only used by the test
crate to capture output from tests when running them in the same process
in differen threads. However, every program will check these variables
on every print, even outside of testing.

This involves allocating a thread local key, and registering a thread
local destructor. This can be somewhat expensive.

This change keeps a global flag (LOCAL_STREAMS) which will be set to
true when either of these local streams is used. (So, effectively only
in test and benchmark runs.) When this flag is off, these thread locals
are not even looked at and therefore will not be initialized on the
first output on every thread, which also means no thread local
destructors will be registered.
2020-09-27 16:04:25 +02:00
Dániel Buga
89b8a97aea Refactor memchr to allow optimization 2020-09-27 15:10:48 +02:00
Mara Bos
0b73fd7105 Move thread parker to sys_common. 2020-09-27 12:28:58 +02:00
Mara Bos
4301b5c1cc Add notes about memory ordering to futex parker implementation. 2020-09-27 11:56:43 +02:00
Mara Bos
485f882d77 Check conversion from Duration to timespec in futex_wait. 2020-09-27 11:56:43 +02:00
Mara Bos
2cf0f64722 Move linux-specific futex code into sys module. 2020-09-27 11:56:43 +02:00
Mara Bos
568d9696e9 Fix warning. 2020-09-27 11:56:43 +02:00
Mara Bos
f18f93d44c Mark unpark() as #[inline]. 2020-09-27 11:56:43 +02:00
Mara Bos
ec13df4ec4 Add fast futex-based thread parker for Linux. 2020-09-27 11:56:42 +02:00
Mara Bos
1464fc3a0c Move thread parker to a separate module. 2020-09-27 11:56:42 +02:00
Mara Bos
6f6336b4a1 Split sys_common::Mutex in StaticMutex and MovableMutex.
The (unsafe) Mutex from sys_common had a rather complicated interface.
You were supposed to call init() manually, unless you could guarantee it
was neither moved nor used reentrantly.

Calling `destroy()` was also optional, although it was unclear if 1)
resources might be leaked or not, and 2) if destroy() should only be
called when `init()` was called.

This allowed for a number of interesting (confusing?) different ways to
use this Mutex, all captured in a single type.

In practice, this type was only ever used in two ways:

1. As a static variable. In this case, neither init() nor destroy() are
   called. The variable is never moved, and it is never used
   reentrantly. It is only ever locked using the LockGuard, never with
   raw_lock.

2. As a Boxed variable. In this case, both init() and destroy() are
   called, it will be moved and possibly used reentrantly.

No other combinations are used anywhere in `std`.

This change simplifies things by splitting this Mutex type into
two types matching the two use cases: StaticMutex and MovableMutex.

The interface of both new types is now both safer and simpler. The first
one does not call nor expose init/destroy, and the second one calls
those automatically in its new() and Drop functions. Also, the locking
functions of MovableMutex are no longer unsafe.
2020-09-27 10:05:56 +02:00
Dong Bo
2e64ff9e6a fix redundant delarations of const_fn_transmute 2020-09-27 15:13:32 +08:00
Dong Bo
653fa5a7e6 update stdarch submodule 2020-09-27 13:41:08 +08:00
bors
c9e5e6a53a Auto merge of #77154 - fusion-engineering-forks:lazy-stdio, r=dtolnay
Remove std::io::lazy::Lazy in favour of SyncOnceCell

The (internal) std::io::lazy::Lazy was used to lazily initialize the stdout and stdin buffers (and mutexes). It uses atexit() to register a destructor to flush the streams on exit, and mark the streams as 'closed'. Using the stream afterwards would result in a panic.

Stdout uses a LineWriter which contains a BufWriter that will flush the buffer on drop. This one is important to be executed during shutdown, to make sure no buffered output is lost. It also forbids access to stdout afterwards, since the buffer is already flushed and gone.

Stdin uses a BufReader, which does not implement Drop. It simply forgets any previously read data that was not read from the buffer yet. This means that in the case of stdin, the atexit() function's only effect is making stdin inaccessible to the program, such that later accesses result in a panic. This is uncessary, as it'd have been safe to access stdin during shutdown of the program.

---

This change removes the entire io::lazy module in favour of SyncOnceCell. SyncOnceCell's fast path is much faster (a single atomic operation) than locking a sys_common::Mutex on every access like Lazy did.

However, SyncOnceCell does not use atexit() to drop the contained object during shutdown.

As noted above, this is not a problem for stdin. It simply means stdin is now usable during shutdown.

The atexit() call for stdout is moved to the stdio module. Unlike the now-removed Lazy struct, SyncOnceCell does not have a 'gone and unusable' state that panics. Instead of adding this again, this simply replaces the buffer with one with zero capacity. This effectively flushes the old buffer *and* makes any writes afterwards pass through directly without touching a buffer, making print!() available during shutdown without panicking.

---

In addition, because the contents of the SyncOnceCell are no longer dropped, we can now use `&'static` instead of `Arc` in `Stdout` and `Stdin`. This also saves two levels of indirection in `stdin()` and `stdout()`, since Lazy effectively stored a `Box<Arc<T>>`, and SyncOnceCell stores the `T` directly.
2020-09-27 04:50:46 +00:00
Eric Huss
c297e20e03 Add accessors to Command. 2020-09-26 18:58:38 -07:00
Jonas Schievink
bb416f3a59
Rollup merge of #77184 - pickfire:patch-4, r=kennytm
Rust vec bench import specific rand::RngCore

Using `RngCore` import for side effects is clearer than `*` which may bring it unnecessary more stuff than needed, it is also more explicit doing so.

@pickfire change `LEN = 16384` (and pos) and `once` instead of `[0].iter()` after this.

@rustbot modify labels: +C-cleanup +A-testsuite
2020-09-27 01:53:22 +02:00
Jonas Schievink
5926c43743
Rollup merge of #77167 - fusion-engineering-forks:fix-fixme-min-max-sign-test, r=nagisa
Fix FIXME in core::num test: Check sign of zero in min/max tests.

r? nagisa

@rustbot modify labels: +C-cleanup
2020-09-27 01:53:20 +02:00
Jonas Schievink
9ab95c36e2
Rollup merge of #76917 - GuillaumeGomez:map-missing-code-examples, r=Dylan-DPC
Add missing code examples on HashMap types

r? @Dylan-DPC
2020-09-27 01:53:13 +02:00
Stein Somers
3e485d7cf5 BTreeMap: keep an eye out on the size of the main components 2020-09-26 20:07:48 +02:00
Ralf Jung
0a19836a81
Rollup merge of #77181 - GuillaumeGomez:add-pointer-alias, r=jyn514,pickfire
Add doc alias for pointer primitive
2020-09-26 12:58:28 +02:00
Ralf Jung
3b544e73ae
Rollup merge of #77122 - ecstatic-morse:const-fn-arithmetic, r=RalfJung,oli-obk
Add `#![feature(const_fn_floating_point_arithmetic)]`

cc #76618

This is a template for splitting up `const_fn` into granular feature gates. I think this will make it easier, both for us and for users, to track stabilization of each individual feature. We don't *have* to do this, however. We could also keep stabilizing things out from under `const_fn`.

cc @rust-lang/wg-const-eval
r? @oli-obk
2020-09-26 12:58:20 +02:00
Ralf Jung
31fd0ad69f
Rollup merge of #77076 - GuillaumeGomez:missing-code-examples-slice-iter, r=Dylan-DPC
Add missing code examples on slice iter types

r? @Dylan-DPC
2020-09-26 12:58:15 +02:00
Ralf Jung
1e62382a4f
Rollup merge of #75454 - ltratt:option_optimisation_guarantees, r=dtolnay
Explicitly document the size guarantees that Option makes.

Triggered by a discussion on wg-unsafe-code-guidelines about which layouts of `Option<T>` one can guarantee are optimised to a single pointer.

CC @RalfJung
2020-09-26 12:58:12 +02:00
Guillaume Gomez
21ee1716ee Add doc alias for pointer primitive 2020-09-26 11:21:24 +02:00
bors
fd15e6180d Auto merge of #70743 - oli-obk:eager_const_to_pat_conversion, r=eddyb
Fully destructure constants into patterns

r? `@varkor`

as discussed in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/constants.20in.20patterns/near/192789924

we should probably crater it once reviewed
2020-09-26 06:44:28 +00:00
Lzu Tao
dce7248a39 Remove unneeded tidy comment 2020-09-26 05:20:53 +00:00
Lzu Tao
37cd79cd32 Gather all ZST structs of str together 2020-09-26 05:20:53 +00:00
Lzu Tao
653b5bf18c Move functions converting bytes to str to new mod 2020-09-26 05:20:53 +00:00
Lzu Tao
90c813a0f0 Move utf-8 validating helpers to new mod 2020-09-26 05:20:53 +00:00
Lzu Tao
5f0d724e29 Move str's impl of iterations to new mod 2020-09-26 05:20:51 +00:00
Lzu Tao
5b533fccf3 Move traits implementation of str to new mod
Also move FromStr trait
2020-09-26 05:04:58 +00:00
Lzu Tao
d31ca4fc8e Move Utf8Error to new mod 2020-09-26 05:04:58 +00:00
bors
9e1c436178 Auto merge of #74225 - poliorcetics:std-thread-unsafe-op-in-unsafe-fn, r=joshtriplett
Std/thread: deny unsafe op in unsafe fn

Partial fix of #73904.

This encloses `unsafe` operations in `unsafe fn` in `libstd/thread`.
`@rustbot` modify labels: F-unsafe-block-in-unsafe-fn
2020-09-26 03:54:00 +00:00
Mara Bos
f289468045 Stabilize slice_ptr_range.
Closes #65807.
2020-09-26 00:25:32 +02:00
bors
043f6d747c Auto merge of #77201 - matthewjasper:rename-get-unchecked, r=spastorino
Rename Iterator::get_unchecked

Closes #76479

r? `@pnkfelix`
2020-09-25 21:44:26 +00:00
Alexis Bourget
a61b9638bb review: fix nits and move panic safety tests to the correct place 2020-09-25 23:10:24 +02:00
Guillaume Gomez
980e1ff40f Add missing examples for Fd traits 2020-09-25 21:20:42 +02:00
Guillaume Gomez
187162e991 Add missing code examples on slice iter types 2020-09-25 21:17:22 +02:00
Matthew Jasper
04a0b1d087 Rename Iterator::get_unchecked
It's possible for method resolution to pick this method over a lower
priority stable method,  causing compilation errors. Since this method
is permanently unstable, give it a name that is very unlikely to be used
in user code.
2020-09-25 19:52:01 +01:00
Matthew Jasper
323a27967a Improve <vec::IntoIter>::get_unchecked` safety comment 2020-09-25 19:46:06 +01:00
Jonas Schievink
d72b7cc329
Rollup merge of #77189 - pickfire:patch-5, r=Mark-Simulacrum
Remove extra space from vec drawing
2020-09-25 19:42:54 +02:00
Jonas Schievink
a7bdf851cf
Rollup merge of #77176 - austinkeeley:intrinsics-documentatation-error, r=jyn514
Removing erroneous semicolon in transmute documentation

There is a semicolon in the example code that causes the expected value to not be returned.
2020-09-25 19:42:50 +02:00
Jonas Schievink
1149b308cd
Rollup merge of #77097 - fusion-engineering-forks:slice-ptr-range-const-fn, r=oli-obk
Make [].as_[mut_]ptr_range() (unstably) const.

Gated behind `const_ptr_offset`, as suggested by https://github.com/rust-lang/rust/issues/65807#issuecomment-697229404

This also marks `[].as_mut_ptr()` as const, because it's used by `as_mut_ptr_range`. I gated it behind the same feature, because I figured it's not worth adding a separate tracking issue for const `as_mut_ptr`.
2020-09-25 19:42:39 +02:00
Jonas Schievink
e8dc07c242
Rollup merge of #77005 - ssomers:btree_cleanup_3, r=Mark-Simulacrum
BtreeMap: refactoring around edges

Parts chipped off a more daring effort, that the btree benchmarks judge to be performance-neutral.

r? @Mark-Simulacrum
2020-09-25 19:42:31 +02:00
Jonas Schievink
1b8c939a8d
Rollup merge of #76973 - lzutao:unstably-const-assume, r=oli-obk
Unstably allow assume intrinsic in const contexts

Not sure much about this usage because there are concerns
about [blocking  optimization][1] and [slowing down LLVM][2] when using `assme` intrinsic
in inline functions.
But since Oli suggested in https://github.com/rust-lang/rust/issues/76960#issuecomment-695772221,
here we are.

[1]: https://github.com/rust-lang/rust/pull/54995#issuecomment-429302709
[2]: https://github.com/rust-lang/rust/issues/49572#issuecomment-589615423
2020-09-25 19:42:29 +02:00
Jonas Schievink
a835af174c
Rollup merge of #76932 - fusion-engineering-forks:condvar-promise, r=sfackler
Relax promises about condition variable.

For quite a while now, there have been plans to at some point use parking_lot or some other more efficient implementation of mutexes and condition variables. Right now, Mutex and CondVar both Box the 'real' mutex/condvar inside, to give it a stable address. This was done because implementations like pthread and Windows critical sections may not be moved. More efficient implementations based on futexes, WaitOnAddress, Windows SRW locks, parking_lot, etc. may be moved (while not borrowed), so wouldn't need boxing.

However, not boxing them (which would be great goal to achieve), breaks a promise std currently makes about CondVar. CondVar promises to panic when used with different mutexes, to ensure consistent behaviour on all platforms. To this check, a mutex is considered 'the same' if the address of the 'real mutex' in the Box is the same. This address doesn't change when moving a `std::mutex::Mutex` object, effectively giving it an identity that survives moves of the Mutex object. If we ever switch to a non-boxed version, they no longer carry such an identity, and this check can no longer be made.

Four options:
1. Always box mutexes.
2. Add a `MutexId` similar to `ThreadId`. Making mutexes bigger, and making it hard to ever have a `const fn new` for them.
3. Making the requirement of CondVar stricter: panic if the Mutex object itself moved.
4. Making the promise of CondVar weaker: don't promise to panic.

1, 2, and 3 seem like bad options. This PR updates the documentation for 4.
2020-09-25 19:42:28 +02:00
Dylan MacKenzie
6a52c09440 Add new feature gate to standard library 2020-09-25 10:38:21 -07:00
Ivan Tham
ea0065ad4f
Reposition iterator doc alias reduce before inline 2020-09-26 00:05:37 +08:00
Ivan Tham
1994cee61a
Add alias for iterator fold
fold is known in python and javascript as reduce,
not sure about inject but it was written in doc there.
2020-09-26 00:04:34 +08:00
follower
e4943ac811
Link to documentation-specific guidelines.
Changed because it's not obvious how to get from the previously used URL to the documentation-specific content.

This is partly because the original URL was previously changed to point to different content:

 * https://github.com/rust-lang/rust/pull/74037/files#diff-242481015141f373dcb178e93cffa850L88

 * 3f6928f1f6 (diff-6a3371457528722a734f3c51d9238c13L12)
2020-09-26 03:26:45 +12:00