Commit graph

736 commits

Author SHA1 Message Date
The8472
e1151844fa bench larger allocations 2020-09-03 20:59:22 +02:00
The8472
fd16202e36 include in-place .zip() in test 2020-09-03 20:59:21 +02:00
The8472
fbb3371e5b remove unecessary feature flag
# Conflicts:
#	library/alloc/src/lib.rs
2020-09-03 20:59:21 +02:00
The8472
70293c658f make tidy happy 2020-09-03 20:59:20 +02:00
The8472
21a17d105c support in-place iteration for most adapters
`Take` is not included since users probably call it with small constants
and it doesn't make sense to hold onto huge allocations in that case
2020-09-03 20:59:20 +02:00
The8472
085eb20a61 move free-standing method into trait impl 2020-09-03 20:59:19 +02:00
The8472
0f122e1119 add in-place iteration for Zip
this picks the left hand side as source since it might be more natural to
consume that as IntoIter source
2020-09-03 20:59:19 +02:00
The8472
3d5e9f1904 bench in-place zip 2020-09-03 20:59:18 +02:00
The8472
2b0b2ae9f6 additional specializations tests 2020-09-03 20:59:17 +02:00
The8472
00a32eb54f fix some in-place-collect edge-cases
- it's an allocation optimization, so don't attempt to do it on ZSTs
- drop the tail of partially exhausted iters
2020-09-03 20:59:17 +02:00
The8472
8c816b96dd remove redundant code 2020-09-03 20:59:16 +02:00
The8472
cc67c8eb91 improve comments 2020-09-03 20:59:16 +02:00
The8472
290fe895ba specialize creating a Vec from a slice iterator where T: Copy
this was already implemented for Extend but not for FromIterator
2020-09-03 20:59:15 +02:00
The8472
dac0edfaaa restore SpecFrom<T, TrustedLen<Item=T>> specialization by nesting
specializations
2020-09-03 20:59:15 +02:00
The8472
582fbb1d62 use From specializations on extend if extended Vec is empty
this enables in-place iteration and allocation reuse in additional cases
2020-09-03 20:59:14 +02:00
The8472
a596ff36b5 exercise more of the in-place pipeline in the bench 2020-09-03 20:59:14 +02:00
The8472
a9c78e371e bench in-place collect of droppables 2020-09-03 20:59:13 +02:00
The8472
8ac96e6a98 cyclic in-place reuse bench 2020-09-03 20:59:13 +02:00
The8472
bb4f888a59 return the things under test so they get black_box()'ed 2020-09-03 20:59:12 +02:00
The8472
2f700d085a add benches from bluss' gists 2020-09-03 20:59:12 +02:00
The8472
a4e385a0d0 use memmove instead of generic in-place iteration for IntoIter source
this is the original SpecExtend<_, IntoIter> logic except generalizing
the fast-path to include a memmove
2020-09-03 20:59:11 +02:00
The8472
631543dcb4 restore Vec::extend specialization for vec::IntoIter sources that
was lost during refactoring
2020-09-03 20:59:11 +02:00
The8472
07a8c1b95a hide binary_heap::IntoIter internals behind impl Trait 2020-09-03 20:59:10 +02:00
The8472
b90816deb7 remove example that relied on non-public trait 2020-09-03 20:59:10 +02:00
The8472
232065074d recover vectorization
switch to try_fold and segregate the drop handling to keep
collect::<Vec<u8>>() and similar optimizer-friendly

It comes at the cost of less accurate debug_asserts and code complexity
2020-09-03 20:59:09 +02:00
The8472
6c5c47b82b update benches 2020-09-03 20:59:09 +02:00
The8472
bead910b21 simplify pointer arithmetic 2020-09-03 20:59:08 +02:00
The8472
f904d0339a fix doc link 2020-09-03 20:59:07 +02:00
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
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
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
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
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
Joshua Nelson
bb103476a9 Fix incorrect link in prelude 2020-09-02 17:38:21 -04:00