Commit graph

126526 commits

Author SHA1 Message Date
The8472
328a75f766 use add instead of offset 2020-09-03 20:59:07 +02:00
The8472
88b7ae642c implement drop handling 2020-09-03 20:59:06 +02:00
The8472
73a982e9ec assert that SourceIter requirements have not been violated by the pipeline 2020-09-03 20:59:06 +02:00
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
3edf11cf81 Auto merge of #76283 - RalfJung:miri, r=RalfJung
update miri

Fixes https://github.com/rust-lang/rust/issues/76190
Cc @rust-lang/miri r? @ghost
2020-09-03 16:00:55 +00:00
Ralf Jung
615c1460dd update miri 2020-09-03 12:41:27 +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
bors
1e33c742ca Auto merge of #75971 - Amjad50:libstd-deny-unsafe_op_in_unsafe_fn, r=Mark-Simulacrum
Applied `#![deny(unsafe_op_in_unsafe_fn)]` in library/std/src/wasi

partial fix for #73904

There are still more that was not applied in [mod.rs]( 38fab2ea92/library/std/src/sys/wasi/mod.rs) and that is due to its using files from `../unsupported`

like:
```
#[path = "../unsupported/cmath.rs"]
pub mod cmath;
```
2020-09-03 02:15:16 +00:00
Amjad Alsharafi
559679b8c3 Applied #![deny(unsafe_op_in_unsafe_fn)] in library/std/src/wasi
All refactoring needed was only in `alloc.rs`, changed part of the code
in `alloc` method to satisfy the SAFETY statement
2020-09-03 08:27:59 +08:00
bors
4f66117945 Auto merge of #76265 - Dylan-DPC:rollup-j3i509l, r=Dylan-DPC
Rollup of 12 pull requests

Successful merges:

 - #75150 (Add a note for Ipv4Addr::to_ipv6_compatible)
 - #76120 (Add `[T; N]::as_[mut_]slice`)
 - #76142 (Make all methods of `std::net::Ipv4Addr` const)
 - #76164 (Link to slice pattern in array docs)
 - #76167 (Replace MinGW library hack with heuristic controlling link mode)
 - #76204 (Rename and expose LoopState as ControlFlow)
 - #76238 (Move to intra-doc links for library/core/src/iter/traits/iterator.rs)
 - #76242 (Read: adjust a FIXME reference)
 - #76243 (Fix typos in vec try_reserve(_exact) docs)
 - #76245 (inliner: Avoid query cycles when optimizing generators)
 - #76255 (Update books)
 - #76261 (Use intra-doc links in `core::marker`)

Failed merges:

r? @ghost
2020-09-03 00:24:50 +00:00
Dylan DPC
af331a2d01
Rollup merge of #76261 - camelid:intra-doc-links-for-core-marker, r=jyn514
Use intra-doc links in `core::marker`

Part of #75080.

Also cleaned up a few things.

---

@rustbot modify labels: A-intra-doc-links T-doc
2020-09-03 02:22:18 +02:00
Dylan DPC
1f7ff67e51
Rollup merge of #76255 - ehuss:update-books, r=ehuss
Update books

## reference

4 commits in 1b6c4b0afab97c0230433466c97167bbbe8445f6..25391dba46262f882fa846beefaff54a966a8fa5
2020-08-18 17:04:28 -0700 to 2020-09-02 07:22:55 -0700
- clarify when reading uninititalized memory is allowed (rust-lang-nursery/reference#852)
- Update patterns chapter, add rest patterns. (rust-lang-nursery/reference#876)
- Improve Type-Coersion Documentation (rust-lang-nursery/reference#843)
- Added variable back into example. (rust-lang-nursery/reference#880)

## book

3 commits in c0a6a61b8205da14ac955425f74258ffd8ee065d..e5ed97128302d5fa45dbac0e64426bc7649a558c
2020-08-14 14:21:49 -0500 to 2020-08-31 12:53:40 -0500
- Fix type mismatch in listing 10-5 (rust-lang/book#2441)
- Update ppendix-06-translation.md (rust-lang/book#2437)
- Correct no-listing-10-result-in-tests: Take tests module out of the main function (rust-lang/book#2430)

## rust-by-example

3 commits in 80a10e22140e28392b99d24ed02f4c6d8cb770a0..19f0a0372af497b34369cf182d9d16156cab2969
2020-08-08 09:56:46 -0300 to 2020-08-26 09:38:48 -0300
- prefer `length` over `size` when talking about number of elements vs. bytesize (rust-lang/rust-by-example#1372)
- Split out variable shadowing into a separate example (rust-lang/rust-by-example#1370)
- Update extern crate related sections (rust-lang/rust-by-example#1369)

## edition-guide

1 commits in bd6e4a9f59c5c1545f572266af77f5c7a5bad6d1..81f16863014de60b53de401d71ff904d163ee030
2020-07-12 17:37:08 -0500 to 2020-08-27 13:56:31 -0700
- Fix a small typo. (rust-lang/edition-guide#218)
2020-09-03 02:22:16 +02:00
Dylan DPC
cd6829382d
Rollup merge of #76245 - tmiasko:inline-generators, r=ecstatic-morse
inliner: Avoid query cycles when optimizing generators

The HIR Id trick is insufficient to prevent query cycles when optimizing
generators, since merely requesting a layout of a generator also
computes its `optimized_mir`.

Make no attempts to inline functions into generators within the same
crate to avoid query cycles.

Fixes #76181.
2020-09-03 02:22:14 +02:00
Dylan DPC
3368f5c820
Rollup merge of #76243 - ama0:patch-1, r=jonas-schievink
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-03 02:22:13 +02:00
Dylan DPC
6d2b885112
Rollup merge of #76242 - RalfJung:read-fixme, r=Dylan-DPC
Read: adjust a FIXME reference

There's already another reference to https://github.com/rust-lang/rust/issues/42788 for basically the same problem, so lets reuse it here:
5e208efaa8/library/std/src/io/mod.rs (L369-L376)

r? @Dylan-DPC
2020-09-03 02:22:11 +02:00
Dylan DPC
4918ed96ee
Rollup merge of #76238 - denisvasilik:intra-doc-links-core-iterator, r=jyn514
Move to intra-doc links for library/core/src/iter/traits/iterator.rs

Helps with #75080.

@jyn514 We're almost finished with this issue. Thanks for mentoring. If you have other topics to work on just let me know, I will be around in Discord.

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

Known issues:

* Link from `core` to `std` (#74481):

    [`OsStr`]
    [`String`]
    [`VecDeque<T>`]
2020-09-03 02:22:10 +02:00
Dylan DPC
d059f2619f
Rollup merge of #76204 - NoraCodes:nora/control_flow_enum, r=scottmcm
Rename and expose LoopState as ControlFlow

Basic PR for #75744. Addresses everything there except for documentation; lots of examples are probably a good idea.
2020-09-03 02:22:07 +02:00
Dylan DPC
a4e30a6ae7
Rollup merge of #76167 - mati865:mingw-self-contained-heuristic, r=petrochenkov
Replace MinGW library hack with heuristic controlling link mode

Depends on https://github.com/rust-lang/rust/pull/76158
Closes https://github.com/rust-lang/rust/issues/68887
2020-09-03 02:22:06 +02:00
Dylan DPC
3e156cfe90
Rollup merge of #76164 - lzutao:slice-array, r=ehuss
Link to slice pattern in array docs

Fix a todo in https://github.com/rust-lang/reference/issues/739#issuecomment-578408449
2020-09-03 02:22:04 +02:00
Dylan DPC
9605f94f69
Rollup merge of #76142 - CDirkx:const-ip, r=ecstatic-morse
Make all methods of `std::net::Ipv4Addr` const

Make the following methods of `std::net::Ipv4Addr` unstable const under the `const_ipv4` feature:
 - `octets`
 - `is_loopback`
 - `is_private`
 - `is_link_local`
 - `is_global` (unstable)
 - `is_shared` (unstable)
 - `is_ietf_protocol_assignment` (unstable)
 - `is_benchmarking` (unstable)
 - `is_reserved` (unstable)
 - `is_multicast`
 - `is_broadcast`
 - `is_documentation`
 - `to_ipv6_compatible`
 - `to_ipv6_mapped`

This would make all methods of `Ipv6Addr` const.

Of these methods, `is_global`, `is_broadcast`, `to_ipv6_compatible`, and `to_ipv6_mapped` require a change in implementation.

Part of #76205
2020-09-03 02:22:02 +02:00
Dylan DPC
10aa3d3f89
Rollup merge of #76120 - LukasKalbertodt:add-as-slice-method-to-array, r=Mark-Simulacrum
Add `[T; N]::as_[mut_]slice`

Part of me trying to populate arrays with a couple of basic useful methods, like slices already have. The ability to add methods to arrays were added in #75212.  Tracking issue: #76118

This adds:

```rust
impl<T, const N: usize> [T; N] {
    pub fn as_slice(&self) -> &[T];
    pub fn as_mut_slice(&mut self) -> &mut [T];
}
```

These methods are like the ones on `std::array::FixedSizeArray` and in the crate `arraytools`.
2020-09-03 02:22:00 +02:00
Dylan DPC
536b0c0c90
Rollup merge of #75150 - nanpuyue:deprecate_to_ipv6_compatible, r=LukasKalbertodt
Add a note for Ipv4Addr::to_ipv6_compatible

Previous discussion: #75019

> I think adding a comment saying "This isn't typically the method you want; these addresses don't typically function on modern systems. Use `to_ipv6_mapped` instead." would be a good first step, whether this method gets marked as deprecated or not.

_Originally posted by @joshtriplett in https://github.com/rust-lang/rust/pull/75150#issuecomment-680267745_
2020-09-03 02:21:58 +02:00
Camelid
7926435317
Add back missing link 2020-09-02 15:48:35 -07:00
Camelid
2908ed64aa Use intra-doc links in core::marker 2020-09-02 15:22:40 -07:00
bors
51f79b618d Auto merge of #76233 - cuviper:unhasher, r=Mark-Simulacrum
Avoid rehashing Fingerprint as a map key

This introduces a no-op `Unhasher` for map keys that are already hash-
like, for example `Fingerprint` and its wrapper `DefPathHash`. For these
we can directly produce the `u64` hash for maps. The first use of this
is `def_path_hash_to_def_id: Option<UnhashMap<DefPathHash, DefId>>`.

cc #56308
r? @eddyb
2020-09-02 22:16:22 +00:00
Joshua Nelson
bb103476a9 Fix incorrect link in prelude 2020-09-02 17:38:21 -04: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
bors
80fc9b0ecb Auto merge of #76160 - scileo:format-recovery, r=petrochenkov
Improve recovery on malformed format call

The token following a format expression should be a comma. However, when it is replaced with a similar token (such as a dot), then the corresponding error is emitted, but the token is treated as a comma, and the parsing step continues.

r? @petrochenkov
2020-09-02 19:29:27 +00:00
Leonora Tindall
96eb5e1751 Format ControlFlow changes with rustfmt 2020-09-02 14:12:21 -05:00
Eric Huss
c012487bde Update books 2020-09-02 11:10:36 -07:00
bors
a167485e27 Auto merge of #75960 - camelid:patch-6, r=jyn514
Improve docs for the `const` keyword

@rustbot modify labels: T-doc
2020-09-02 17:35:46 +00:00
Denis Vasilik
89e7fb3bbd Revert link removal of Some(T) 2020-09-02 19:11:19 +02:00
Denis Vasilik
83143a1ef4 Revert link removal of 2020-09-02 19:07:32 +02:00
Denis Vasilik
3a035891f0 Revert link removal 2020-09-02 18:51:53 +02:00
Denis Vasilik
1a438bbcb7 Revert module level documentation link 2020-09-02 18:51:08 +02:00
Denis Vasilik
7cf0fe1d02 Apply suggestions from review 2020-09-02 18:32:46 +02:00
bors
95815c9b2b Auto merge of #76241 - RalfJung:flt2dec, r=Mark-Simulacrum
flt2dec: properly handle uninitialized memory

The float-to-str code currently uses uninitialized memory incorrectly (see https://github.com/rust-lang/rust/issues/76092). This PR fixes that.

Specifically, that code used `&mut [T]` as "out references", but it would be incorrect for the caller to actually pass uninitialized memory. So the PR changes this to `&mut [MaybeUninit<T>]`, and then functions return a `&[T]` to the part of the buffer that they initialized (some functions already did that, indirectly via `&Formatted`, others were adjusted to return that buffer instead of just the initialized length).

What I particularly like about this is that it moves `unsafe` to the right place: previously, the outermost caller had to use `unsafe` to assert that things are initialized; now it is the functions that do the actual initializing which have the corresponding `unsafe` block when they call `MaybeUninit::slice_get_ref` (renamed in https://github.com/rust-lang/rust/pull/76217 to `slice_assume_init_ref`).

Reviewers please be aware that I have no idea how any of this code actually works. My changes were purely mechanical and type-driven. The test suite passes so I guess I didn't screw up badly...

Cc @sfackler this is somewhat related to your RFC, and possibly some of this code could benefit from (a generalized version of) the API you describe there. But for now I think what I did is "good enough".

Fixes https://github.com/rust-lang/rust/issues/76092.
2020-09-02 15:23:08 +00:00
南浦月
3b29913295 add a note for Ipv4Addr::to_ipv6_compatible 2020-09-02 21:08:09 +08:00
Anton
dbe50f5c24
Same typos in vec_deque 2020-09-02 14:09:42 +02:00
Sasha
3524c3ef43 Improve recovery on malformed format call
If a comma in a format call is replaced with a similar token, then we
emit an error and continue parsing, instead of stopping at this point.
2020-09-02 13:18:19 +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
Ralf Jung
56129d39c0 flt2dec: properly handle uninitialized memory 2020-09-02 12:41:38 +02:00
Ralf Jung
0af3bd01df Read: adjust a FIXME reference 2020-09-02 12:34:15 +02:00
bors
da897dfb6d Auto merge of #76216 - marmeladema:use-once-cell-from-std, r=matklad
compiler: use `OnceCell` from std

Fixes #76192

The only remaining direct use of `lazy_static` crate is in `src/bootstrap`  but I am not sure how I can remove that dependency for now.

r? @matklad
2020-09-02 06:46:21 +00:00
Joshua Nelson
726b187546 Use intra-doc links for MaybeUninit in boxed.rs 2020-09-01 23:54:17 -04:00
Joshua Nelson
cafab51b29 Remove explicit links to true and false in ip.rs 2020-09-01 23:33:44 -04:00