]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoImprove docs for `std::env::args()`
Camelid [Fri, 4 Sep 2020 21:00:09 +0000 (14:00 -0700)]
Improve docs for `std::env::args()`

3 years agoAuto merge of #76292 - Aaron1011:fix/proc-macro-panic-hide, r=petrochenkov
bors [Fri, 4 Sep 2020 20:58:37 +0000 (20:58 +0000)]
Auto merge of #76292 - Aaron1011:fix/proc-macro-panic-hide, r=petrochenkov

Respect `-Z proc-macro-backtrace` flag for panics inside libproc_macro

Fixes #76270

Previously, any panic occuring during a call to a libproc_macro method
(e.g. calling `Ident::new` with an invalid identifier) would always
cause an ICE message to be printed.

3 years agoRemove unused duplicated `trivial_dropck_outlives`
Jonas Schievink [Fri, 4 Sep 2020 20:24:03 +0000 (22:24 +0200)]
Remove unused duplicated `trivial_dropck_outlives`

3 years agoadd some intra-doc links to `Iterator`
Andy Russell [Fri, 4 Sep 2020 19:51:58 +0000 (15:51 -0400)]
add some intra-doc links to `Iterator`

3 years agoAuto merge of #76315 - lcnr:map-track-caller, r=Mark-Simulacrum
bors [Fri, 4 Sep 2020 19:05:20 +0000 (19:05 +0000)]
Auto merge of #76315 - lcnr:map-track-caller, r=Mark-Simulacrum

add `#[track_caller]` to `local_def_id_to_hir_id`

Improves one of the more frequent ICE

3 years agoAccount for version number in NtIdent hack
Aaron Hill [Fri, 4 Sep 2020 17:10:23 +0000 (13:10 -0400)]
Account for version number in NtIdent hack

Issue #74616 tracks a backwards-compatibility hack for certain macros.
This has is implemented by hard-coding the filenames and macro names of
certain code that we want to continue to compile.

However, the initial implementation of the hack was based on the
directory structure when building the crate from its repository (e.g.
`js-sys/src/lib.rs`). When the crate is build as a dependency, it will
include a version number from the clone from the cargo registry (e.g.
`js-sys-0.3.17/src/lib.rs`), which would fail the check.

This commit modifies the backwards-compatibility hack to check that
desired crate name (`js-sys` or `time-macros-impl`) is a prefix of the
proper part of the path.

See https://github.com/rust-lang/rust/issues/76070#issuecomment-687215646
for more details.

3 years agoAuto merge of #75077 - LeSeulArtichaut:tys-kind, r=nikomatsakis
bors [Fri, 4 Sep 2020 17:07:39 +0000 (17:07 +0000)]
Auto merge of #75077 - LeSeulArtichaut:tys-kind, r=nikomatsakis

Refractor ty.kind -> ty.kind() and ty.flags -> ty.flags()

First step for the ["shared library to represent Rust types"](https://rust-lang.github.io/compiler-team/minutes/design-meeting/2020-03-12-shared-library-for-types/) work (rust-lang/wg-traits#16).

This PR makes the `TyS::kind` field private and adds a `kind()` method to access it.
As noted [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/144729-wg-traits/topic/Looking.20to.20contribute/near/205185412), this refractoring might require a MCP. I am perfectly fine with having to wait until MCP is accepted and resolving the conflicts that pop up afterwards.

r? @nikomatsakis

3 years agoty.flags -> ty.flags()
LeSeulArtichaut [Thu, 6 Aug 2020 15:49:46 +0000 (17:49 +0200)]
ty.flags -> ty.flags()

3 years ago`ty.kind` -> `ty.kind()` in rustdoc and clippy
LeSeulArtichaut [Mon, 3 Aug 2020 22:18:29 +0000 (00:18 +0200)]
`ty.kind` -> `ty.kind()` in rustdoc and clippy

3 years agoChange ty.kind to a method
LeSeulArtichaut [Sun, 2 Aug 2020 22:49:11 +0000 (00:49 +0200)]
Change ty.kind to a method

3 years agoAuto merge of #75655 - nielx:fix/haiku-llvm-libz, r=Mark-Simulacrum
bors [Fri, 4 Sep 2020 14:32:33 +0000 (14:32 +0000)]
Auto merge of #75655 - nielx:fix/haiku-llvm-libz, r=Mark-Simulacrum

Disable zlib in LLVM on Haiku

PR #72696 enabled the option LLVM_ENABLE_ZLIB for the LLVM builds. Like NetBSD and aarch64-apple-darwin (see PR #75500), the LLVM build system not explicitly linking to libz on these platforms cause issues. For Haiku, this meant the runtime loader complaining about undefined symbols..

3 years agoImplementation of incompatible features error
Amjad Alsharafi [Thu, 3 Sep 2020 17:47:35 +0000 (01:47 +0800)]
Implementation of incompatible features error

If two features are defined as incompatible, using them together would
result in an error

3 years agoFix rust.use-lld when linker is not set
Mateusz Mikuła [Fri, 4 Sep 2020 13:20:13 +0000 (15:20 +0200)]
Fix rust.use-lld when linker is not set

3 years agoFix warning whe building profiler_builtins crate
Mateusz Mikuła [Mon, 24 Aug 2020 09:57:32 +0000 (11:57 +0200)]
Fix warning whe building profiler_builtins crate

3 years agoEnable profiler tests on Windows-gnu
Mateusz Mikuła [Wed, 5 Aug 2020 08:58:04 +0000 (10:58 +0200)]
Enable profiler tests on Windows-gnu

3 years agoMisc cleanup
Joshua Nelson [Sat, 29 Aug 2020 19:19:43 +0000 (15:19 -0400)]
Misc cleanup

- Preserve suffixes when displaying
- Rename test file to match `intra-link*`
- Remove unnecessary .clone()s
- Improve comments and naming
- Fix more bugs and add tests
- Escape intra-doc link example in public documentation

3 years agoAuto merge of #75207 - dylni:add-slice-check-range, r=KodrAus
bors [Fri, 4 Sep 2020 12:21:43 +0000 (12:21 +0000)]
Auto merge of #75207 - dylni:add-slice-check-range, r=KodrAus

Add `slice::check_range`

This method is useful for [`RangeBounds`] parameters. It's even been [rewritten](https://github.com/rust-lang/rust/blob/22ee68dc586440f96b76b32fbd6087507c6afdb9/src/librustc_data_structures/sorted_map.rs#L214) [many](https://github.com/rust-lang/rust/blob/22ee68dc586440f96b76b32fbd6087507c6afdb9/library/alloc/src/vec.rs#L1299) [times](https://github.com/rust-lang/rust/blob/22ee68dc586440f96b76b32fbd6087507c6afdb9/library/core/src/slice/mod.rs#L2441) in the standard library, sometimes assuming that the bounds won't be [`usize::MAX`].

For example, [`Vec::drain`] creates an empty iterator when [`usize::MAX`] is used as an inclusive end bound:

```rust
assert!(vec![1].drain(..=usize::max_value()).eq(iter::empty()));
```

If this PR is merged, I'll create another to use it for those methods.

[`RangeBounds`]: https://doc.rust-lang.org/std/ops/trait.RangeBounds.html
[`usize::MAX`]: https://doc.rust-lang.org/std/primitive.usize.html#associatedconstant.MAX
[`Vec::drain`]: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.drain

3 years agoMove Vec slice UI tests in library
Ayush Kumar Mishra [Fri, 4 Sep 2020 11:48:26 +0000 (17:18 +0530)]
Move Vec slice UI tests in library

3 years agoUse ops::ControlFlow in graph::iterate
Scott McMurray [Fri, 4 Sep 2020 07:59:41 +0000 (00:59 -0700)]
Use ops::ControlFlow in graph::iterate

3 years agoadd track_caller to `local_def_id_to_hir_id`
Bastian Kauschke [Fri, 4 Sep 2020 07:24:44 +0000 (09:24 +0200)]
add track_caller to `local_def_id_to_hir_id`

3 years agotime.rs: Make spelling of "Darwin" consistent
numbermaniac [Fri, 4 Sep 2020 04:21:52 +0000 (14:21 +1000)]
time.rs: Make spelling of "Darwin" consistent

3 years agoRemove a useless allowed attr
Lzu Tao [Fri, 4 Sep 2020 02:42:50 +0000 (02:42 +0000)]
Remove a useless allowed attr

3 years agoAdd slice primitive link to vec
Ivan Tham [Fri, 4 Sep 2020 01:50:50 +0000 (09:50 +0800)]
Add slice primitive link to vec

3 years agoAuto merge of #76004 - richkadel:llvm-coverage-map-gen-6b.5, r=tmandry
bors [Fri, 4 Sep 2020 01:31:07 +0000 (01:31 +0000)]
Auto merge of #76004 - richkadel:llvm-coverage-map-gen-6b.5, r=tmandry

Tools, tests, and experimenting with MIR-derived coverage counters

Leverages the new mir_dump output file in HTML+CSS (from #76074) to visualize coverage code regions
and the MIR features that they came from (including overlapping spans).

See example below.

The `run-make-fulldeps/instrument-coverage` test has been refactored to maximize test coverage and reduce code duplication. The new tests support testing with and without `-Clink-dead-code`, so Rust coverage can be tested on MSVC (which, currently, only works with `link-dead-code` _disabled_).

New tests validate coverage region generation and coverage reports with multiple counters per function. Starting with a simple `if-else` branch tests, coverage tests for each additional syntax type can be added by simply dropping in a new Rust sample program.

Includes a basic, MIR-block-based implementation of coverage injection,
available via `-Zexperimental-coverage`. This implementation has known
flaws and omissions, but is simple enough to validate the new tools and
tests.

The existing `-Zinstrument-coverage` option currently enables
function-level coverage only, which at least appears to generate
accurate coverage reports at that level.

Experimental coverage is not accurate at this time. When branch coverage
works as intended, the `-Zexperimental-coverage` option should be
removed.

This PR replaces the bulk of PR #75828, with the remaining parts of
that PR distributed among other separate and indentpent PRs.

This PR depends on two of those other PRs: #76002, #76003 and #76074

Rust compiler MCP rust-lang/compiler-team#278

Relevant issue: #34701 - Implement support for LLVMs code coverage
instrumentation

![Screen-Recording-2020-08-21-at-2](https://user-images.githubusercontent.com/3827298/90972923-ff417880-e4d1-11ea-92bb-8713c6198f6d.gif)

r? @tmandry
FYI: @wesleywiser

3 years agoEnable the SimplifyArmIdentity MIR optimization at mir-opt-level=1
Wesley Wiser [Fri, 4 Sep 2020 01:15:50 +0000 (21:15 -0400)]
Enable the SimplifyArmIdentity MIR optimization at mir-opt-level=1

3 years agoDisable use of `--eh-frame-hdr` on wasm32.
Dan Gohman [Fri, 4 Sep 2020 00:49:09 +0000 (17:49 -0700)]
Disable use of `--eh-frame-hdr` on wasm32.

3 years agoMove various ui const tests to `library`
Christiaan Dirkx [Fri, 4 Sep 2020 00:35:27 +0000 (02:35 +0200)]
Move various ui const tests to `library`

Move:
 - `src\test\ui\consts\const-nonzero.rs` to `library\core`
 - `src\test\ui\consts\ascii.rs` to `library\core`
 - `src\test\ui\consts\cow-is-borrowed` to `library\alloc`

Part of #76268

3 years agoinliner: Add mir-opt tests for codegen attributes compatibility
Tomasz Miąsko [Fri, 4 Sep 2020 00:00:00 +0000 (00:00 +0000)]
inliner: Add mir-opt tests for codegen attributes compatibility

3 years agoinliner: Check for no_sanitize attribute compatibility
Tomasz Miąsko [Thu, 3 Sep 2020 00:00:00 +0000 (00:00 +0000)]
inliner: Check for no_sanitize attribute compatibility

3 years agoinliner: Check for target features compatibility
Tomasz Miąsko [Thu, 3 Sep 2020 00:00:00 +0000 (00:00 +0000)]
inliner: Check for target features compatibility

3 years agoAuto merge of #73996 - da-x:short-unique-paths, r=petrochenkov
bors [Thu, 3 Sep 2020 23:27:45 +0000 (23:27 +0000)]
Auto merge of #73996 - da-x:short-unique-paths, r=petrochenkov

diagnostics: shorten paths of unique symbols

This is a step towards implementing a fix for #50310, and continuation of the discussion in [Pre-RFC: Nicer Types In Diagnostics - compiler - Rust Internals](https://internals.rust-lang.org/t/pre-rfc-nicer-types-in-diagnostics/11139). Impressed upon me from previous discussion in #21934 that an RFC for this is not needed, and I should just come up with code.

The recent improvements to `use` suggestions that I've contributed have given rise to this implementation. Contrary to previous suggestions, it's rather simple logic, and I believe it only reduces the amount of cognitive load that a developer would need when reading type errors.

-----

If a symbol name can only be imported from one place, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path to the last component.

This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable from anywhere.

3 years agoLink to `#capacity-and-reallocation` when using with_capacity
Joshua Nelson [Thu, 3 Sep 2020 22:08:25 +0000 (18:08 -0400)]
Link to `#capacity-and-reallocation` when using with_capacity

3 years agoAddress review comments on `Peekable::next_if`
Joshua Nelson [Thu, 3 Sep 2020 22:03:33 +0000 (18:03 -0400)]
Address review comments on `Peekable::next_if`

3 years agoOptimize Cursor::look_ahead
Aleksey Kladov [Thu, 3 Sep 2020 21:26:59 +0000 (23:26 +0200)]
Optimize Cursor::look_ahead

Cloning a tt is cheap, but not free (there's Arc inside).

3 years agoAuto merge of #70793 - the8472:in-place-iter-collect, r=Amanieu
bors [Thu, 3 Sep 2020 21:20:21 +0000 (21:20 +0000)]
Auto merge of #70793 - the8472:in-place-iter-collect, r=Amanieu

specialize some collection and iterator operations to run in-place

This is a rebase and update of #66383 which was closed due inactivity.

Recent rustc changes made the compile time regressions disappear, at least for webrender-wrench. Running a stage2 compile and the rustc-perf suite takes hours on the hardware I have at the moment, so I can't do much more than that.

![Screenshot_2020-04-05 rustc performance data](https://user-images.githubusercontent.com/1065730/78462657-5d60f100-76d4-11ea-8a0b-4f3962707c38.png)

In the best case of the `vec::bench_in_place_recycle` synthetic microbenchmark these optimizations can provide a 15x speedup over the regular implementation which allocates a new vec for every benchmark iteration. [Benchmark results](https://gist.github.com/the8472/6d999b2d08a2bedf3b93f12112f96e2f). In real code the speedups are tiny, but it also depends on the allocator used, a system allocator that uses a process-wide mutex will benefit more than one with thread-local pools.

## What was changed

* `SpecExtend` which covered `from_iter` and `extend` specializations was split into separate traits
* `extend` and `from_iter` now reuse the `append_elements` if passed iterators are from slices.
* A preexisting `vec.into_iter().collect::<Vec<_>>()` optimization that passed through the original vec has been generalized further to also cover cases where the original has been partially drained.
* A chain of *Vec<T> / BinaryHeap<T> / Box<[T]>* `IntoIter`s  through various iterator adapters collected into *Vec<U>* and *BinaryHeap<U>* will be performed in place as long as `T` and `U` have the same alignment and size and aren't ZSTs.
* To enable above specialization the unsafe, unstable `SourceIter` and `InPlaceIterable` traits have been added. The first allows reaching through the iterator pipeline to grab a pointer to the source memory. The latter is a marker that promises that the read pointer will advance as fast or faster than the write pointer and thus in-place operation is possible in the first place.
* `vec::IntoIter` implements `TrustedRandomAccess` for `T: Copy` to allow in-place collection when there is a `Zip` adapter in the iterator. TRA had to be made an unstable public trait to support this.

## In-place collectible adapters

* `Map`
* `MapWhile`
* `Filter`
* `FilterMap`
* `Fuse`
* `Skip`
* `SkipWhile`
* `Take`
* `TakeWhile`
* `Enumerate`
* `Zip` (left hand side only, `Copy` types only)
* `Peek`
* `Scan`
* `Inspect`

## Concerns

`vec.into_iter().filter(|_| false).collect()` will no longer return a vec with 0 capacity, instead it will return its original allocation. This avoids the cost of doing any allocation or deallocation but could lead to large allocations living longer than expected.
If that's not acceptable some resizing policy at the end of the attempted in-place collect would be necessary, which in the worst case could result in one more memcopy than the non-specialized case.

## Possible followup work

* split liballoc/vec.rs to remove `ignore-tidy-filelength`
* try to get trivial chains such as `vec.into_iter().skip(1).collect::<Vec<)>>()` to compile to a `memmove` (currently compiles to a pile of SIMD, see #69187 )
* improve up the traits so they can be reused by other crates, e.g. itertools. I think currently they're only good enough for internal use
* allow iterators sourced from a `HashSet` to be in-place collected into a `Vec`

3 years agoMake `Ipv4Addr` and `Ipv6Addr` const tests unit tests under `library`
Christiaan Dirkx [Thu, 3 Sep 2020 21:17:21 +0000 (23:17 +0200)]
Make `Ipv4Addr` and `Ipv6Addr` const tests unit tests under `library`

These tests are about the standard library, not the compiler itself, thus should live in `library`, see #76268.

3 years agofix debug assertion
The8472 [Thu, 3 Sep 2020 20:15:47 +0000 (22:15 +0200)]
fix debug assertion

The InPlaceIterable debug assert checks that the write pointer
did not advance beyond the read pointer. But TrustedRandomAccess
never advances the read pointer, thus triggering the assert.
Skip the assert if the source pointer did not change during iteration.

3 years agoAdd test for doc alias on associated const in trait impls
Guillaume Gomez [Mon, 24 Aug 2020 18:20:31 +0000 (20:20 +0200)]
Add test for doc alias on associated const in trait impls

3 years agoAdd check for doc alias on associated const in trait impls
Guillaume Gomez [Mon, 24 Aug 2020 18:20:03 +0000 (20:20 +0200)]
Add check for doc alias on associated const in trait impls

3 years agoRemove vec-to_str.rs, merge the remaining test in with vec
Rune Tynan [Thu, 3 Sep 2020 19:43:07 +0000 (15:43 -0400)]
Remove vec-to_str.rs, merge the remaining test in with vec

3 years agoCheck test/example/benchmark on x.py check
Mark Rousskov [Wed, 2 Sep 2020 20:41:36 +0000 (16:41 -0400)]
Check test/example/benchmark on x.py check

Often when modifying compiler code you'll miss that you've changed an API used
by unit tests, since x.py check didn't previously catch that.

It's also useful to have this for editing with rust-analyzer and similar tooling
where editing tests previously didn't notify you of errors in test files.

3 years agoAuto merge of #73819 - euclio:rustdoc-summaries, r=jyn514,GuillaumeGomez
bors [Thu, 3 Sep 2020 19:07:38 +0000 (19:07 +0000)]
Auto merge of #73819 - euclio:rustdoc-summaries, r=jyn514,GuillaumeGomez

rustdoc: do not use plain summary for trait impls

Fixes #38386.
Fixes #48332.
Fixes #49430.
Fixes #62741.
Fixes #73474.

Unfortunately this is not quite ready to go because the newly-working links trigger a bunch of linkcheck failures. The failures are tough to fix because the links are resolved relative to the implementor, which could be anywhere in the module hierarchy.

(In the current docs, these links end up rendering as uninterpreted markdown syntax, so I don't think these failures are any worse than the status quo. It might be acceptable to just add them to the linkchecker whitelist.)

Ideally this could be fixed with intra-doc links ~~but it isn't working for me: I am currently investigating if it's possible to solve it this way.~~ Opened #73829.

EDIT: This is now ready!

3 years agoimprove comments and naming
The8472 [Wed, 2 Sep 2020 19:40:19 +0000 (21:40 +0200)]
improve comments and naming

3 years agoadd explanation to specialization marker
The8472 [Sun, 30 Aug 2020 00:15:45 +0000 (02:15 +0200)]
add explanation to specialization marker

3 years agoremove separate no-drop code path since it resulted in more LLVM IR
The8472 [Wed, 26 Aug 2020 21:32:09 +0000 (23:32 +0200)]
remove separate no-drop code path since it resulted in more LLVM IR

3 years agoremove empty Vec extend optimization
The8472 [Wed, 26 Aug 2020 21:24:34 +0000 (23:24 +0200)]
remove empty Vec extend optimization

The optimization meant that every extend code path had to emit llvm
IR for from_iter and extend spec_extend, which likely impacts
compile times while only improving a few edge-cases

3 years agoplease tidy
The8472 [Fri, 21 Aug 2020 21:56:23 +0000 (23:56 +0200)]
please tidy

3 years agoget things to work under min_specialization by leaning more heavily on #[rustc_unsafe...
The8472 [Fri, 21 Aug 2020 21:53:13 +0000 (23:53 +0200)]
get things to work under min_specialization by leaning more heavily on #[rustc_unsafe_specialization_marker]

3 years agoavoid applying in-place collect specialization in type-length test
The8472 [Sun, 24 May 2020 01:23:15 +0000 (03:23 +0200)]
avoid applying in-place collect specialization in type-length test

the test was sized to match external iteration only, since
vec's in-place collect now uses internal iteration we collect into
a different type now.
Note that any other try-fold based operation such as count() would also
have exceeded the type length limit for that iterator.

3 years agofix benchmark compile errors
The8472 [Wed, 20 May 2020 23:34:05 +0000 (01:34 +0200)]
fix benchmark compile errors

3 years agoapply required min_specialization attributes
The8472 [Mon, 18 May 2020 22:44:16 +0000 (00:44 +0200)]
apply required min_specialization attributes

3 years agosupport in-place collect for MapWhile adapters
The8472 [Sat, 4 Apr 2020 16:34:18 +0000 (18:34 +0200)]
support in-place collect for MapWhile adapters

3 years agopacify tidy
The8472 [Sun, 2 Feb 2020 19:24:40 +0000 (20:24 +0100)]
pacify tidy

3 years agogeneralize in-place collect to types of same size and alignment
The8472 [Tue, 28 Jan 2020 14:14:55 +0000 (15:14 +0100)]
generalize in-place collect to types of same size and alignment

3 years agoincrease comment verbosity
The8472 [Sun, 26 Jan 2020 19:52:59 +0000 (20:52 +0100)]
increase comment verbosity

3 years agowork around compiler overhead around lambdas in generics by extracting them into...
The8472 [Sun, 26 Jan 2020 19:51:57 +0000 (20:51 +0100)]
work around compiler overhead around lambdas in generics by extracting them into free functions

3 years agoextract IntoIter drop/forget used by specialization into separate methods
The8472 [Sun, 26 Jan 2020 19:50:05 +0000 (20:50 +0100)]
extract IntoIter drop/forget used by specialization into separate methods

3 years agoadd benchmark to cover in-place extend
The8472 [Sat, 25 Jan 2020 19:08:46 +0000 (20:08 +0100)]
add benchmark to cover in-place extend

3 years agoremove redundant cast
The8472 [Sat, 25 Jan 2020 16:58:34 +0000 (17:58 +0100)]
remove redundant cast

3 years agotest drops during in-place iteration
The8472 [Sat, 25 Jan 2020 16:55:47 +0000 (17:55 +0100)]
test drops during in-place iteration

3 years agomove unsafety into method, not relevant to caller
The8472 [Sat, 25 Jan 2020 14:02:13 +0000 (15:02 +0100)]
move unsafety into method, not relevant to caller

3 years agoreplace unsafe ptr::write with deref-write, benchmarks show no difference
The8472 [Sat, 25 Jan 2020 14:01:39 +0000 (15:01 +0100)]
replace unsafe ptr::write with deref-write, benchmarks show no difference

3 years agopacify tidy
The8472 [Wed, 15 Jul 2020 18:53:03 +0000 (20:53 +0200)]
pacify tidy

3 years agoreplace drop flag with ManuallyDrop
The8472 [Sat, 18 Jan 2020 15:13:28 +0000 (16:13 +0100)]
replace drop flag with ManuallyDrop

3 years agomark as_inner as unsafe and update comments
The8472 [Sat, 18 Jan 2020 15:03:58 +0000 (16:03 +0100)]
mark as_inner as unsafe and update comments

3 years agoavoid exposing that binary heap's IntoIter is backed by vec::IntoIter, use a private...
The8472 [Fri, 20 Dec 2019 19:28:10 +0000 (20:28 +0100)]
avoid exposing that binary heap's IntoIter is backed by vec::IntoIter, use a private trait instead

3 years agofix: bench didn't black_box its results
The8472 [Sat, 30 Nov 2019 18:40:28 +0000 (19:40 +0100)]
fix: bench didn't black_box its results

3 years agofix build issue due to stabilized feature
The8472 [Sat, 30 Nov 2019 14:35:18 +0000 (15:35 +0100)]
fix build issue due to stabilized feature

3 years agoimpl TrustedRandomAccess for vec::IntoIter
The8472 [Fri, 29 Nov 2019 00:11:14 +0000 (01:11 +0100)]
impl TrustedRandomAccess for vec::IntoIter

3 years agobench larger allocations
The8472 [Wed, 27 Nov 2019 21:19:15 +0000 (22:19 +0100)]
bench larger allocations

3 years agoinclude in-place .zip() in test
The8472 [Wed, 27 Nov 2019 21:19:06 +0000 (22:19 +0100)]
include in-place .zip() in test

3 years agoremove unecessary feature flag
The8472 [Mon, 24 Aug 2020 20:09:44 +0000 (22:09 +0200)]
remove unecessary feature flag

# Conflicts:
# library/alloc/src/lib.rs

3 years agomake tidy happy
The8472 [Sat, 23 Nov 2019 18:34:26 +0000 (19:34 +0100)]
make tidy happy

3 years agosupport in-place iteration for most adapters
The8472 [Sat, 23 Nov 2019 17:59:18 +0000 (18:59 +0100)]
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

3 years agomove free-standing method into trait impl
The8472 [Sat, 23 Nov 2019 17:30:32 +0000 (18:30 +0100)]
move free-standing method into trait impl

3 years agoadd in-place iteration for Zip
The8472 [Sat, 23 Nov 2019 17:29:47 +0000 (18:29 +0100)]
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

3 years agobench in-place zip
The8472 [Sat, 23 Nov 2019 17:26:52 +0000 (18:26 +0100)]
bench in-place zip

3 years agoadditional specializations tests
The8472 [Sat, 23 Nov 2019 13:34:58 +0000 (14:34 +0100)]
additional specializations tests

3 years agofix some in-place-collect edge-cases
The8472 [Sat, 23 Nov 2019 13:32:20 +0000 (14:32 +0100)]
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

3 years agoremove redundant code
The8472 [Sat, 23 Nov 2019 13:30:10 +0000 (14:30 +0100)]
remove redundant code

3 years agoimprove comments
The8472 [Thu, 21 Nov 2019 12:44:28 +0000 (13:44 +0100)]
improve comments

3 years agospecialize creating a Vec from a slice iterator where T: Copy
The8472 [Thu, 21 Nov 2019 12:43:53 +0000 (13:43 +0100)]
specialize creating a Vec from a slice iterator where T: Copy

this was already implemented for Extend but not for FromIterator

3 years agorestore SpecFrom<T, TrustedLen<Item=T>> specialization by nesting
The8472 [Thu, 21 Nov 2019 12:40:49 +0000 (13:40 +0100)]
restore SpecFrom<T, TrustedLen<Item=T>> specialization by nesting
specializations

3 years agouse From specializations on extend if extended Vec is empty
The8472 [Thu, 21 Nov 2019 12:24:48 +0000 (13:24 +0100)]
use From specializations on extend if extended Vec is empty

this enables in-place iteration and allocation reuse in additional cases

3 years agoexercise more of the in-place pipeline in the bench
The8472 [Thu, 21 Nov 2019 00:01:35 +0000 (01:01 +0100)]
exercise more of the in-place pipeline in the bench

3 years agobench in-place collect of droppables
The8472 [Wed, 20 Nov 2019 23:06:31 +0000 (00:06 +0100)]
bench in-place collect of droppables

3 years agocyclic in-place reuse bench
The8472 [Wed, 20 Nov 2019 22:37:50 +0000 (23:37 +0100)]
cyclic in-place reuse bench

3 years agoreturn the things under test so they get black_box()'ed
The8472 [Wed, 20 Nov 2019 02:09:30 +0000 (03:09 +0100)]
return the things under test so they get black_box()'ed

3 years agoadd benches from bluss' gists
The8472 [Tue, 19 Nov 2019 22:10:43 +0000 (23:10 +0100)]
add benches from bluss' gists

3 years agouse memmove instead of generic in-place iteration for IntoIter source
The8472 [Sun, 17 Nov 2019 13:50:48 +0000 (14:50 +0100)]
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

3 years agorestore Vec::extend specialization for vec::IntoIter sources that
The8472 [Sun, 17 Nov 2019 11:49:18 +0000 (12:49 +0100)]
restore Vec::extend specialization for vec::IntoIter sources that
was lost during refactoring

3 years agohide binary_heap::IntoIter internals behind impl Trait
The8472 [Sun, 17 Nov 2019 11:04:12 +0000 (12:04 +0100)]
hide binary_heap::IntoIter internals behind impl Trait

3 years agoremove example that relied on non-public trait
The8472 [Sun, 17 Nov 2019 00:32:36 +0000 (01:32 +0100)]
remove example that relied on non-public trait

3 years agorecover vectorization
The8472 [Sat, 16 Nov 2019 21:31:23 +0000 (22:31 +0100)]
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

3 years agoupdate benches
The8472 [Sat, 16 Nov 2019 16:27:39 +0000 (17:27 +0100)]
update benches

3 years agosimplify pointer arithmetic
The8472 [Fri, 15 Nov 2019 20:02:54 +0000 (21:02 +0100)]
simplify pointer arithmetic

3 years agofix doc link
The8472 [Fri, 15 Nov 2019 20:01:13 +0000 (21:01 +0100)]
fix doc link

3 years agouse add instead of offset
The8472 [Fri, 15 Nov 2019 02:54:44 +0000 (03:54 +0100)]
use add instead of offset

3 years agoimplement drop handling
The8472 [Fri, 15 Nov 2019 01:37:55 +0000 (02:37 +0100)]
implement drop handling

3 years agoassert that SourceIter requirements have not been violated by the pipeline
The8472 [Fri, 15 Nov 2019 00:27:41 +0000 (01:27 +0100)]
assert that SourceIter requirements have not been violated by the pipeline