Scott McMurray
eb846dbaca
Override Iterator::advance(_back)_by
for array::IntoIter
...
Because I happened to notice that `nth` is currently getting codegen'd as a loop even for `Copy` types: <https://rust.godbolt.org/z/fPqv7Gvs7 >
2021-12-03 21:36:51 -08:00
bors
d47a6cc3f2
Auto merge of #91286 - scottmcm:residual-trait, r=joshtriplett
...
Make `array::{try_from_fn, try_map}` and `Iterator::try_find` generic over `Try`
Fixes #85115
This only updates unstable functions.
`array::try_map` didn't actually exist before; this adds it under the still-open tracking issue #79711 from the old PR #79713 .
Tracking issue for the new trait: #91285
This would also solve the return type question in for the proposed `Iterator::try_reduce` in #87054
2021-12-03 10:15:11 +00:00
bors
3e21768a0a
Auto merge of #91486 - matthiaskrgr:rollup-699fo18, r=matthiaskrgr
...
Rollup of 10 pull requests
Successful merges:
- #88906 (Implement write() method for Box<MaybeUninit<T>>)
- #90269 (Make `Option::expect` unstably const)
- #90854 (Type can be unsized and uninhabited)
- #91170 (rustdoc: preload fonts)
- #91273 (Fix ICE #91268 by checking that the snippet ends with a `)`)
- #91381 (Android: -ldl must appear after -lgcc when linking)
- #91453 (Document Windows TLS drop behaviour)
- #91462 (Use try_normalize_erasing_regions in needs_drop)
- #91474 (suppress warning about set_errno being unused on DragonFly)
- #91483 (Sync rustfmt subtree)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2021-12-03 07:12:36 +00:00
Matthias Krüger
aa6f2d9a79
Rollup merge of #91474 - rtzoeller:dfly_set_errno, r=cuviper
...
suppress warning about set_errno being unused on DragonFly
Other targets allow this function to be unused, DragonFly just misses out due to providing a specialization.
This fixes a build error for DragonFly.
2021-12-03 06:24:18 +01:00
Matthias Krüger
25474ed731
Rollup merge of #91453 - ChrisDenton:doc-win-tls-dtors, r=dtolnay
...
Document Windows TLS drop behaviour
The way Windows TLS destructors are run has some "interesting" properties. They should be documented.
Fixes #74875
2021-12-03 06:24:16 +01:00
Matthias Krüger
63da52af4a
Rollup merge of #91381 - Amanieu:android_libdl, r=petrochenkov
...
Android: -ldl must appear after -lgcc when linking
#90846 accidentally broke Android builds because it causes the standard library to no longer use `dlsym` on Android. This results in `libdl` being ignored by the linker since no symbols are needed from it. However, we later import `libgcc` for unwinding which *does* depend on `libdl` for `dl_iterate_phdr`. Since linkers don't revisit previous libraries when resolving symbols, this causes a linker error due to an undefined reference to `dl_iterate_phdr`.
This is resolved by adding a second `-ldl` after `-lgcc` in the linker command-line.
2021-12-03 06:24:15 +01:00
Matthias Krüger
94cd0259f2
Rollup merge of #90269 - woppopo:const_option_expect, r=yaahc
...
Make `Option::expect` unstably const
Tracking issue: #67441
2021-12-03 06:24:11 +01:00
Matthias Krüger
31003a3089
Rollup merge of #88906 - Kixunil:box-maybe-uninit-write, r=dtolnay
...
Implement write() method for Box<MaybeUninit<T>>
This adds method similar to `MaybeUninit::write` main difference being
it returns owned `Box`. This can be used to elide copy from stack
safely, however it's not currently tested that the optimization actually
occurs.
Analogous methods are not provided for `Rc` and `Arc` as those need to
handle the possibility of sharing. Some version of them may be added in
the future.
This was discussed in #63291 which this change extends.
2021-12-03 06:24:11 +01:00
bors
190367ba2e
Auto merge of #91339 - cbarrete:vecdeque-remove-grow-check, r=Mark-Simulacrum
...
Remove unnecessary check in VecDeque::grow
All callers already check that the buffer is full before calling
`grow()`. This is where it makes the most sense, since `grow()` is
`inline(never)` and we don't want to pay for a function call just for
that check.
It could also be argued that it would be correct to call `grow()` even
if the buffer wasn't full yet.
This change breaks no code since `grow()` is not `pub`.
2021-12-03 04:14:07 +00:00
Ryan Zoeller
0fdb109795
suppress warning about set_errno being unused on DragonFly
...
Other targets allow this function to be unused, DragonFly just
misses out due to providing a specialization.
2021-12-02 16:16:27 -06:00
Matthias Krüger
6e5f4c2f1b
Rollup merge of #91464 - ChrisDenton:doc-path-case-sensitivity, r=joshtriplett
...
Document file path case sensitivity
This describes the current behaviour of the standard library's pure path methods.
Fixes #66260 .
2021-12-02 22:16:18 +01:00
Matthias Krüger
2ec0f841b4
Rollup merge of #91460 - ChrisDenton:doc-last-os-error, r=joshtriplett
...
Document how `last_os_error` should be used
It should be made clear that the state of the last OS error could change if another function call is made before the call to `Error::last_os_error()`.
Fixes : #53155
2021-12-02 22:16:16 +01:00
Matthias Krüger
fbfa003016
Rollup merge of #91444 - RalfJung:miri-tests, r=dtolnay
...
disable tests in Miri that take too long
Comparing slices of length `usize::MAX` diverges in Miri. In fact these tests even diverge in rustc unless `-O` is passed. I tried this code to check that:
```rust
#![feature(slice_take)]
const EMPTY_MAX: &'static [()] = &[(); usize::MAX];
fn main() {
let mut slice: &[_] = &[(); usize::MAX];
println!("1");
assert_eq!(Some(&[] as _), slice.take(usize::MAX..));
println!("2");
let remaining: &[_] = EMPTY_MAX;
println!("3");
assert_eq!(remaining, slice);
println!("4");
}
```
So, disable these tests in Miri for now.
2021-12-02 22:16:14 +01:00
Chris Denton
d8832425fc
Document file path case sensitivity
2021-12-02 19:48:10 +00:00
Scott McMurray
b96b9b4093
Make array::{try_from_fn, try_map} and Iterator::try_find generic over Try
...
Fixes 85115
This only updates unstable functions.
`array::try_map` didn't actually exist before, despite the tracking issue 79711 still being open from the old PR 79713.
2021-12-02 11:23:50 -08:00
Chris Denton
6df44a389c
Document how last_os_error
should be used
2021-12-02 17:53:57 +00:00
Martin Habovstiak
41e21aa1c2
Implement write() method for Box<MaybeUninit<T>>
...
This adds method similar to `MaybeUninit::write` main difference being
it returns owned `Box`. This can be used to elide copy from stack
safely, however it's not currently tested that the optimization actually
occurs.
Analogous methods are not provided for `Rc` and `Arc` as those need to
handle the possibility of sharing. Some version of them may be added in
the future.
This was discussed in #63291 which this change extends.
2021-12-02 17:18:34 +01:00
Matthias Krüger
d96ce3ea8e
Rollup merge of #91394 - Mark-Simulacrum:bump-stage0, r=pietroalbini
...
Bump stage0 compiler
r? `@pietroalbini` (or anyone else)
2021-12-02 15:52:03 +01:00
Chris Denton
7a145250c6
Document Windows TLS drop behaviour
2021-12-02 14:17:58 +00:00
Ralf Jung
b11d88006c
disable tests in Miri that take too long
2021-12-01 22:48:59 -05:00
Matthias Krüger
9f1f42897d
Rollup merge of #88502 - ibraheemdev:slice-take, r=dtolnay
...
Add slice take methods
Revival of #62282
This PR adds the following slice methods:
- `take`
- `take_mut`
- `take_first`
- `take_first_mut`
- `take_last`
- `take_last_mut`
r? `@LukasKalbertodt`
2021-12-01 20:57:42 +01:00
Matthias Krüger
ce197e2bce
Rollup merge of #91346 - ibraheemdev:result-inspect, r=dtolnay
...
Add `Option::inspect` and `Result::{inspect, inspect_err}`
```rust
// core::result
impl Result<T, E> {
pub fn inspect<F: FnOnce(&T)>(self, f: F) -> Self;
pub fn inspect_err<F: FnOnce(&E)>(self, f: F) -> Self;
}
// core::option
impl Option<T> {
pub fn inspect<F: FnOnce(&T)>(self, f: F) -> Self;
}
```
2021-12-01 10:50:22 +01:00
Matthias Krüger
bc929f9404
Rollup merge of #91340 - cr1901:no-atomic, r=Mark-Simulacrum
...
Bump compiler_builtins to 0.1.55 to bring in fixes for targets lackin…
…g atomic support.
This fixes a "Cannot select" LLVM error when compiling `compiler_builtins` for targets lacking atomics, like MSP430. Se https://github.com/rust-lang/compiler-builtins/issues/441 for more info. This PR is a more general version of #91248 .
2021-11-30 23:43:31 +01:00
Mark Rousskov
b221c877e8
Apply cfg-bootstrap switch
2021-11-30 10:51:42 -05:00
bors
207c80f105
Auto merge of #91352 - nnethercote:RawVec-reserve_for_push, r=dtolnay
...
Introduce `RawVec::reserve_for_push`.
If `Vec::push`'s capacity check fails it calls `RawVec::reserve`, which
then also does a capacity check.
This commit introduces `reserve_for_push` which skips the redundant
capacity check, for some slight compile time speed-ups.
I tried lots of minor variations on this, e.g. different inlining
attributes. This was the best one I could find.
r? `@ghost`
2021-11-30 13:52:38 +00:00
Yuki Okushi
28176a4a33
Rollup merge of #91383 - ScriptDevil:drop-while-doc-alias, r=joshtriplett
...
Add `drop_while` as doc alias to `Iterator::skip_while`
`skip_while` is commonly referred to as `drop_while` in other languages (clojure/c++/haskell). This recently came up in [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/.E2.9C.94.20DropWhile/near/262203352 ) as well.
This pull request adds 'drop_while' as a doc-alias for 'skip_while'.
r? `@joshtriplett`
2021-11-30 17:29:13 +09:00
Yuki Okushi
a940c68035
Rollup merge of #91323 - RalfJung:assert-type, r=oli-obk
...
CTFE: support assert_zero_valid and assert_uninit_valid
This ensures the implementation of all three type-based assert_ intrinsics remains consistent in Miri.
`assert_inhabited` recently got stabilized in https://github.com/rust-lang/rust/pull/90896 (meaning stable `const fn` can call it), so do the same with these other intrinsics.
Cc ```@rust-lang/wg-const-eval```
2021-11-30 17:29:09 +09:00
Ashok Gautham Jadatharan
dea3494b31
Add drop_while
as doc alias to Iterator::skip_while
2021-11-30 10:27:16 +05:30
Amanieu d'Antras
41e2a53c00
Android: -ldl must appear after -lgcc when linking
2021-11-30 02:42:35 +00:00
Cédric Barreteau
29f5c98a17
Remove unnecessary check in VecDeque::grow
...
All callers already check that the buffer is full before calling
`grow()`. This is where it makes the most sense, since `grow()` is
`inline(never)` and we don't want to pay for a function call just for
that check.
It could also be argued that it would be correct to call `grow()` even
if the buffer wasn't full yet.
This change breaks no code since `grow()` is not `pub`.
2021-11-29 21:14:20 -05:00
bors
94bec90702
Auto merge of #91244 - dtolnay:lossy, r=Mark-Simulacrum
...
Eliminate bunch of copies of error codepath from Utf8LossyChunksIter
Using a macro to stamp out 7 identical copies of the nontrivial slicing logic to exit this loop didn't seem like a necessary use of a macro. The early return case can be handled by `break` without practically any changes to the logic inside the loop.
All this code is from early 2014 (#12062—nearly 8 years ago; pre-1.0) so it's possible there were compiler limitations that forced the macro way at the time.
Confirmed that `x.py bench library/alloc --stage 0 --test-args from_utf8_lossy` is unaffected on my machine.
2021-11-30 01:08:56 +00:00
Nicholas Nethercote
6a83352aa3
Introduce RawVec::reserve_for_push
.
...
If `Vec::push`'s capacity check fails it calls `RawVec::reserve`, which
then also does a capacity check.
This commit introduces `reserve_for_push` which skips the redundant
capacity check, for some slight compile time speed-ups.
I tried lots of minor variations on this, e.g. different inlining
attributes. This was the best one I could find.
2021-11-30 08:10:47 +11:00
Ralf Jung
6c3c3e0952
CTFE: support assert_zero_valid and assert_uninit_valid
2021-11-29 11:49:31 -05:00
Matthias Krüger
80277dcc4f
Rollup merge of #91049 - dimo414:patch-1, r=kennytm
...
Add a caveat to std::os::windows::fs::symlink_file
This is similar to the note on [Python's `os.symlink()`](https://docs.python.org/3/library/os.html#os.symlink ). Some additional notes in https://github.com/dimo414/bkt/issues/3 .
2021-11-29 10:41:33 +01:00
Ibraheem Ahmed
2e8358e1ab
add Option::inspect
and Result::{inspect, inspect_err}
2021-11-28 23:31:45 -05:00
William D. Jones
e500eb6950
Bump compiler_builtins to 0.1.55 to bring in fixes for targets lacking atomic support.
2021-11-28 23:01:03 -05:00
bors
350158dd6d
Auto merge of #90681 - workingjubilee:update-libc, r=JohnTitor
...
Update libc to 0.2.108
Changelog:
https://github.com/rust-lang/libc/releases/tag/0.2.107
https://github.com/rust-lang/libc/releases/tag/0.2.108
Primarily intended to pull in rust-lang/libc@fd331f65f2
This should help with https://github.com/rust-lang/rust/pull/90044
2021-11-28 22:29:57 +00:00
Matthias Krüger
af0cf34787
Rollup merge of #90896 - jhpratt:stabilize_const_maybe_uninit, r=oli-obk
...
Stabilize some `MaybeUninit` behavior as const
This stabilizes the `MaybeUninit::as_ptr`, `MaybeUninit::assume_init`, and `MaybeUninit::assume_init_ref` as `const fn`. `MaybeUninit::as_mut_ptr` has been moved to a new flag: `const_maybe_uninit_as_mut_ptr`, which is blocked on #57349 . `MaybeUninit::slice_assume_init_ref` can be `const fn` when the method is stabilized in general.
The relevant intrinsic has been stabilized as `const` as well, though this isn't user-visible. Due to the seemingly unrelated feature name I performed `rg const_assert_type` and found no other instances of it being used.
r? `@oli-obk`
`@rustbot` label: +A-const-fn +S-waiting-on-review +T-libs-api
2021-11-28 10:42:38 +01:00
Jacob Pratt
44b5b838d2
Add test for const MaybeUninit
2021-11-28 01:31:25 -05:00
Jacob Pratt
ad8e6bf5cc
Stabilize some MaybeUninit
behavior as const
2021-11-28 01:01:47 -05:00
bors
27d5935df1
Auto merge of #91301 - scottmcm:stabilize-nonzero-ipot, r=nagisa
...
Stabilize nonzero_is_power_of_two
Closes #81106
FCP has finished in the tracking issue
2021-11-28 05:55:09 +00:00
Jubilee Young
9a04ae4997
Update libc to 0.2.108
...
Changelog:
https://github.com/rust-lang/libc/releases/tag/0.2.107
https://github.com/rust-lang/libc/releases/tag/0.2.108
Primarily intended to pull in fd331f65f214ea75b6210b415b5fd8650be15c73
This should help with https://github.com/rust-lang/rust/pull/90044
2021-11-27 16:13:04 -08:00
bors
4919988fe1
Auto merge of #91241 - dtolnay:firstchunk, r=oli-obk
...
Eliminate an unreachable codepath from String::from_utf8_lossy
`Utf8Lossy`'s `Iterator` implementation ensures that only the **final** chunk has an empty slice for `broken`:
dd549dcab4/library/core/src/str/lossy.rs (L46-L47)
Thus the only way the **first** chunk could have an empty `broken` is if it is the **final** chunk, i.e. there is only one chunk total. And the only way that there could be one chunk total with an empty `broken` is if the whole input is valid utf8 and non-empty.
That condition has already been handled by an early return, so at the point that the first `REPLACEMENT` is being pushed, it's impossible for `first_broken` to be empty.
2021-11-27 22:53:21 +00:00
Scott McMurray
23045eb622
Stabilize nonzero_is_power_of_two
...
Fixes 81106
FCP has finished in the tracking issue
2021-11-27 13:13:04 -08:00
bors
686e313a9a
Auto merge of #91288 - matthiaskrgr:rollup-yp5h41r, r=matthiaskrgr
...
Rollup of 6 pull requests
Successful merges:
- #83791 (Weaken guarantee around advancing underlying iterators in zip)
- #90995 (Document non-guarantees for Hash)
- #91057 (Expand `available_parallelism` docs in anticipation of cgroup quota support)
- #91062 (rustdoc: Consolidate static-file replacement mechanism)
- #91208 (Account for incorrect `where T::Assoc = Ty` bound)
- #91266 (Use non-generic inner function for pointer formatting)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2021-11-27 14:29:12 +00:00
bors
5fd3a5c7c1
Auto merge of #89916 - the8472:advance_by-avoid-err-0, r=dtolnay
...
Fix Iterator::advance_by contract inconsistency
The `advance_by(n)` docs state that in the error case `Err(k)` that k is always less than n.
It also states that `advance_by(0)` may return `Err(0)` to indicate an exhausted iterator.
These statements are inconsistent.
Since only one implementation (Skip) actually made use of that I changed it to return Ok(()) in that case too.
While adding some tests I also found a bug in `Take::advance_back_by`.
2021-11-27 11:31:26 +00:00
Matthias Krüger
073b1208f0
Rollup merge of #91266 - jam1garner:fmt-ptr-fix, r=dtolnay
...
Use non-generic inner function for pointer formatting
Previously, despite the implementation being type-unaware, `fmt::Pointer`'s implementation for `*const T` in monomorphized. This affects:
* `fmt::Debug` for `*const T`
* `fmt::Debug` for `*mut T`
* `fmt::Pointer` for `*const T`
* `fmt::Pointer` for `*mut T`
And since the implementation is non-trivial, this results in a large amount of LLVM bitcode being generated. For example, with a large bindgen project with Debug implementations enabled, it will generate a lot of calls to `fmt::Debug for *const T`, which in turn will perform codegen for a copy of this function for every type.
For example, in a real-world bindgen'd header I've been testing with (4,189,245 lines of bindgen Rust with layout tests disabled) the difference between a slightly old nightly (`rustc 1.58.0-nightly (e249ce6b2
2021-10-30)`) and this PR:
<details>
<summary>Nightly (Click to Expand)</summary>
```
Lines Copies Function name
----- ------ -------------
7256000 (100%) 216544 (100%) (TOTAL)
1815449 (25.0%) 24206 (11.2%) <*const T as core::fmt::Pointer>::fmt
300248 (4.1%) 29579 (13.7%) <&T as core::fmt::Debug>::fmt
290328 (4.0%) 24194 (11.2%) <*mut T as core::fmt::Pointer>::fmt
217746 (3.0%) 24194 (11.2%) <*mut T as core::fmt::Debug>::fmt
123329 (1.7%) 1486 (0.7%) core::fmt::builders::DebugList::entries
72790 (1.0%) 1486 (0.7%) core::slice::iter::Iter<T>::post_inc_start
71313 (1.0%) 1486 (0.7%) core::slice::iter::Iter<T>::new
68329 (0.9%) 1486 (0.7%) <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::next
38636 (0.5%) 1486 (0.7%) <[T] as core::fmt::Debug>::fmt
26874 (0.4%) 1493 (0.7%) core::array::<impl core::fmt::Debug for [T; N]>::fmt
22290 (0.3%) 1486 (0.7%) core::slice::index::<impl core::ops::index::Index<I> for [T]>::index
19407 (0.3%) 1493 (0.7%) core::array::<impl core::ops::index::Index<I> for [T; N]>::index
19318 (0.3%) 1486 (0.7%) core::slice::<impl [T]>::iter
17832 (0.2%) 1486 (0.7%) core::ptr::const_ptr::<impl *const T>::offset
17832 (0.2%) 1486 (0.7%) core::ptr::mut_ptr::<impl *mut T>::offset
16346 (0.2%) 1486 (0.7%) <core::ops::range::RangeFull as core::slice::index::SliceIndex<[T]>>::index
13374 (0.2%) 1486 (0.7%) <I as core::iter::traits::collect::IntoIterator>::into_iter
13374 (0.2%) 1486 (0.7%) core::ptr::const_ptr::<impl *const T>::add
13371 (0.2%) 1486 (0.7%) core::ptr::const_ptr::<impl *const T>::is_null
13371 (0.2%) 1486 (0.7%) core::ptr::mut_ptr::<impl *mut T>::is_null
11888 (0.2%) 1486 (0.7%) core::slice::<impl [T]>::as_ptr
11879 (0.2%) 1486 (0.7%) core::ptr::non_null::NonNull<T>::new_unchecked
7421 (0.1%) 1486 (0.7%) core::ptr::non_null::NonNull<T>::as_ptr
```
</details>
<details>
<summary>This PR (Click to Expand)</summary>
```
Lines Copies Function name
----- ------ -------------
5684504 (100%) 216542 (100%) (TOTAL)
300248 (5.3%) 29579 (13.7%) <&T as core::fmt::Debug>::fmt
290328 (5.1%) 24194 (11.2%) <*mut T as core::fmt::Pointer>::fmt
266265 (4.7%) 24206 (11.2%) <*const T as core::fmt::Pointer>::fmt
217746 (3.8%) 24194 (11.2%) <*mut T as core::fmt::Debug>::fmt
101039 (1.8%) 1486 (0.7%) core::fmt::builders::DebugList::entries
72790 (1.3%) 1486 (0.7%) core::slice::iter::Iter<T>::post_inc_start
71313 (1.3%) 1486 (0.7%) core::slice::iter::Iter<T>::new
68329 (1.2%) 1486 (0.7%) <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::next
38636 (0.7%) 1486 (0.7%) <[T] as core::fmt::Debug>::fmt
26874 (0.5%) 1493 (0.7%) core::array::<impl core::fmt::Debug for [T; N]>::fmt
22290 (0.4%) 1486 (0.7%) core::slice::index::<impl core::ops::index::Index<I> for [T]>::index
19407 (0.3%) 1493 (0.7%) core::array::<impl core::ops::index::Index<I> for [T; N]>::index
19318 (0.3%) 1486 (0.7%) core::slice::<impl [T]>::iter
17832 (0.3%) 1486 (0.7%) core::ptr::const_ptr::<impl *const T>::offset
17832 (0.3%) 1486 (0.7%) core::ptr::mut_ptr::<impl *mut T>::offset
16346 (0.3%) 1486 (0.7%) <core::ops::range::RangeFull as core::slice::index::SliceIndex<[T]>>::index
13374 (0.2%) 1486 (0.7%) <I as core::iter::traits::collect::IntoIterator>::into_iter
13374 (0.2%) 1486 (0.7%) core::ptr::const_ptr::<impl *const T>::add
13371 (0.2%) 1486 (0.7%) core::ptr::const_ptr::<impl *const T>::is_null
13371 (0.2%) 1486 (0.7%) core::ptr::mut_ptr::<impl *mut T>::is_null
11888 (0.2%) 1486 (0.7%) core::slice::<impl [T]>::as_ptr
11879 (0.2%) 1486 (0.7%) core::ptr::non_null::NonNull<T>::new_unchecked
7421 (0.1%) 1486 (0.7%) core::ptr::non_null::NonNull<T>::as_ptr
```
</details>
Output generated using `cargo llvm-lines` version 0.4.12.
Summary of differences:
| rustc Version | Total LLVM line count | `*const T as fmt::Pointer` LLVM lines | Compilation Time |
|-|-|-|-|
| `nightly` | 7256000 | 1815449 (25.0% of binary) | 537.014 |
| PR | 5684504 (-21.65%) | 266265 (4.7% of binary) (-85.3% from nightly) | 502.990 |
This results in a pretty noticeable as the majority of rustc's time is spent in either codegen or LLVM, in this case, and is significantly improved by disabling derives for `fmt::Debug`, as it prevents generating all this LLVM IR to be handled.
Here's a run time comparison with nightly on the same codebase (commit 454cc5fb
built from source vs 37c8f25
from my PR built from source):
<details>
<summary>nightly (Click to Expand)</summary>
```
time: 2.370; rss: 56MB -> 1118MB (+1062MB) parse_crate
time: 0.000; rss: 1118MB -> 1118MB ( +0MB) attributes_injection
time: 0.000; rss: 1118MB -> 1118MB ( +0MB) incr_comp_prepare_session_directory
time: 0.000; rss: 1118MB -> 1118MB ( +0MB) incr_comp_garbage_collect_session_directories
time: 0.000; rss: 1120MB -> 1120MB ( +0MB) plugin_loading
time: 0.000; rss: 1120MB -> 1120MB ( +0MB) plugin_registration
time: 0.000; rss: 1120MB -> 1120MB ( +0MB) crate_injection
time: 13.897; rss: 1120MB -> 3147MB (+2027MB) expand_crate
time: 0.002; rss: 3147MB -> 3147MB ( +0MB) check_unused_macros
time: 13.900; rss: 1120MB -> 3147MB (+2027MB) macro_expand_crate
time: 0.002; rss: 3147MB -> 3147MB ( +0MB) maybe_building_test_harness
time: 0.503; rss: 3147MB -> 3147MB ( +0MB) AST_validation
time: 0.000; rss: 3147MB -> 3147MB ( +0MB) maybe_create_a_macro_crate
time: 0.002; rss: 3147MB -> 3147MB ( +0MB) finalize_imports
time: 0.502; rss: 3147MB -> 3153MB ( +6MB) finalize_macro_resolutions
time: 4.478; rss: 3153MB -> 3574MB ( +420MB) late_resolve_crate
time: 0.000; rss: 3574MB -> 3574MB ( +0MB) resolve_main
time: 0.332; rss: 3574MB -> 3574MB ( +0MB) resolve_check_unused
time: 0.000; rss: 3574MB -> 3574MB ( +0MB) resolve_report_errors
time: 0.279; rss: 3574MB -> 3574MB ( +0MB) resolve_postprocess
time: 5.595; rss: 3147MB -> 3574MB ( +427MB) resolve_crate
time: 0.382; rss: 3574MB -> 3574MB ( +0MB) complete_gated_feature_checking
time: 20.526; rss: 1120MB -> 3574MB (+2454MB) configure_and_expand
time: 0.000; rss: 3574MB -> 3574MB ( +0MB) prepare_outputs
time: 0.000; rss: 3574MB -> 3574MB ( +0MB) blocked_on_dep_graph_loading
time: 65.992; rss: 3574MB -> 6317MB (+2743MB) hir_lowering
time: 1.117; rss: 6317MB -> 6323MB ( +6MB) early_lint_checks
time: 1.447; rss: 6323MB -> 6271MB ( -52MB) drop_ast
time: 0.002; rss: 5838MB -> 5838MB ( +0MB) setup_global_ctxt
time: 0.000; rss: 5843MB -> 5843MB ( +0MB) looking_for_entry_point
time: 0.313; rss: 5843MB -> 5844MB ( +1MB) looking_for_derive_registrar
time: 9.652; rss: 5843MB -> 6065MB ( +222MB) misc_checking_1
time: 9.713; rss: 6065MB -> 6769MB ( +704MB) type_collecting
time: 0.665; rss: 6769MB -> 6769MB ( +0MB) impl_wf_inference
time: 0.064; rss: 6769MB -> 6769MB ( +0MB) unsafety_checking
time: 3.095; rss: 6769MB -> 6792MB ( +23MB) coherence_checking
time: 21.282; rss: 6792MB -> 7546MB ( +754MB) wf_checking
time: 5.404; rss: 7546MB -> 7681MB ( +135MB) item_types_checking
time: 79.665; rss: 7681MB -> 8075MB ( +394MB) item_bodies_checking
time: 120.166; rss: 6065MB -> 8081MB (+2016MB) type_check_crate
time: 2.038; rss: 8081MB -> 8085MB ( +4MB) match_checking
time: 1.300; rss: 8085MB -> 8113MB ( +28MB) liveness_and_intrinsic_checking
time: 3.338; rss: 8081MB -> 8113MB ( +32MB) misc_checking_2
time: 68.612; rss: 8113MB -> 9285MB (+1172MB) MIR_borrow_checking
time: 0.622; rss: 9285MB -> 9301MB ( +17MB) MIR_effect_checking
time: 0.000; rss: 9301MB -> 9301MB ( +0MB) layout_testing
time: 4.331; rss: 9383MB -> 9510MB ( +127MB) death_checking
time: 0.032; rss: 9510MB -> 9510MB ( +0MB) unused_lib_feature_checking
time: 4.444; rss: 9510MB -> 9568MB ( +58MB) crate_lints
time: 59.563; rss: 9568MB -> 9576MB ( +8MB) module_lints
time: 64.006; rss: 9510MB -> 9576MB ( +66MB) lint_checking
time: 4.127; rss: 9576MB -> 9639MB ( +62MB) privacy_checking_modules
time: 77.984; rss: 9301MB -> 9639MB ( +337MB) misc_checking_3
time: 0.311; rss: 10357MB -> 10357MB ( +0MB) monomorphization_collector_root_collections
time: 14.051; rss: 10357MB -> 10573MB ( +217MB) monomorphization_collector_graph_walk
time: 1.759; rss: 10573MB -> 10652MB ( +79MB) partition_and_assert_distinct_symbols
time: 28.518; rss: 9639MB -> 10711MB (+1072MB) generate_crate_metadata
time: 0.000; rss: 10711MB -> 10711MB ( +0MB) find_cgu_reuse
time: 63.408; rss: 10711MB -> 12272MB (+1560MB) codegen_to_LLVM_IR
time: 64.916; rss: 10711MB -> 12267MB (+1556MB) codegen_crate
time: 0.000; rss: 12261MB -> 12261MB ( +0MB) assert_dep_graph
time: 0.000; rss: 12261MB -> 12261MB ( +0MB) check_dirty_clean
time: 0.664; rss: 12230MB -> 12210MB ( -20MB) encode_query_results_for(rustc_query_impl::queries::type_of)
time: 2.111; rss: 12210MB -> 12043MB ( -167MB) encode_query_results_for(rustc_query_impl::queries::generics_of)
time: 0.108; rss: 12043MB -> 12057MB ( +14MB) encode_query_results_for(rustc_query_impl::queries::predicates_of)
time: 0.004; rss: 12057MB -> 12059MB ( +2MB) encode_query_results_for(rustc_query_impl::queries::mir_const_qualif)
time: 0.665; rss: 12059MB -> 12121MB ( +62MB) encode_query_results_for(rustc_query_impl::queries::mir_for_ctfe)
time: 16.149; rss: 12121MB -> 12148MB ( +28MB) encode_query_results_for(rustc_query_impl::queries::optimized_mir)
time: 0.000; rss: 12148MB -> 12148MB ( +0MB) encode_query_results_for(rustc_query_impl::queries::covered_file_name)
time: 0.000; rss: 12148MB -> 12148MB ( +0MB) encode_query_results_for(rustc_query_impl::queries::covered_code_regions)
time: 0.010; rss: 12148MB -> 12150MB ( +2MB) encode_query_results_for(rustc_query_impl::queries::promoted_mir)
time: 0.052; rss: 12150MB -> 12155MB ( +4MB) encode_query_results_for(rustc_query_impl::queries::unsafety_check_result)
time: 0.003; rss: 12155MB -> 12156MB ( +1MB) encode_query_results_for(rustc_query_impl::queries::thir_check_unsafety)
time: 11.428; rss: 12156MB -> 11748MB ( -408MB) encode_query_results_for(rustc_query_impl::queries::typeck)
time: 0.000; rss: 11748MB -> 11748MB ( +0MB) encode_query_results_for(rustc_query_impl::queries::diagnostic_only_typeck)
time: 0.094; rss: 11748MB -> 11756MB ( +8MB) encode_query_results_for(rustc_query_impl::queries::used_trait_imports)
time: 0.272; rss: 11756MB -> 11778MB ( +22MB) encode_query_results_for(rustc_query_impl::queries::mir_borrowck)
time: 0.054; rss: 11778MB -> 11778MB ( +0MB) encode_query_results_for(rustc_query_impl::queries::eval_to_allocation_raw)
time: 0.005; rss: 11778MB -> 11779MB ( +1MB) encode_query_results_for(rustc_query_impl::queries::eval_to_const_value_raw)
time: 0.021; rss: 11779MB -> 11784MB ( +5MB) encode_query_results_for(rustc_query_impl::queries::check_match)
time: 0.041; rss: 11784MB -> 11786MB ( +2MB) encode_query_results_for(rustc_query_impl::queries::symbol_name)
time: 0.743; rss: 11786MB -> 11815MB ( +29MB) encode_query_results_for(rustc_query_impl::queries::codegen_fn_attrs)
time: 0.043; rss: 11815MB -> 11816MB ( +1MB) encode_query_results_for(rustc_query_impl::queries::codegen_fulfill_obligation)
time: 0.674; rss: 11816MB -> 11840MB ( +25MB) encode_query_results_for(rustc_query_impl::queries::specialization_graph_of)
time: 0.000; rss: 11840MB -> 11840MB ( +0MB) encode_query_results_for(rustc_query_impl::queries::adt_drop_tys)
time: 0.000; rss: 11840MB -> 11840MB ( +0MB) encode_query_results_for(rustc_query_impl::queries::adt_significant_drop_tys)
time: 0.005; rss: 11840MB -> 11841MB ( +1MB) encode_query_results_for(rustc_query_impl::queries::unused_generic_params)
time: 33.153; rss: 12232MB -> 11841MB ( -390MB) encode_query_results
time: 88.943; rss: 11955MB -> 11783MB ( -173MB) LLVM_passes(crate)
time: 38.854; rss: 12259MB -> 10095MB (-2164MB) incr_comp_serialize_result_cache
time: 39.030; rss: 12261MB -> 10095MB (-2166MB) incr_comp_persist_result_cache
time: 0.000; rss: 10095MB -> 10095MB ( +0MB) incr_comp_persist_dep_graph
time: 39.064; rss: 12257MB -> 10095MB (-2162MB) serialize_dep_graph
time: 19.047; rss: 10095MB -> 10307MB ( +212MB) free_global_ctxt
time: 0.000; rss: 10307MB -> 10307MB ( +0MB) join_worker_thread
time: 0.519; rss: 10307MB -> 10307MB ( +0MB) copy_all_cgu_workproducts_to_incr_comp_cache_dir
time: 0.522; rss: 10307MB -> 10307MB ( +0MB) finish_ongoing_codegen
time: 0.000; rss: 10307MB -> 10307MB ( +0MB) llvm_dump_timing_file
time: 0.002; rss: 10307MB -> 10307MB ( +0MB) serialize_work_products
time: 0.001; rss: 9542MB -> 9542MB ( +0MB) incr_comp_finalize_session_directory
time: 0.000; rss: 9542MB -> 9542MB ( +0MB) link_binary_check_files_are_writeable
time: 7.835; rss: 9542MB -> 9544MB ( +2MB) link_rlib
time: 0.000; rss: 9544MB -> 9544MB ( +0MB) link_binary_remove_temps
time: 7.872; rss: 9542MB -> 9544MB ( +2MB) link_binary
time: 7.944; rss: 9542MB -> 9201MB ( -341MB) link_crate
time: 8.495; rss: 10307MB -> 9201MB (-1106MB) link
time: 537.014; rss: 33MB -> 3715MB (+3682MB) total
```
</details>
<details>
<summary>This PR (Click to Expand)</summary>
```
time: 2.379; rss: 51MB -> 1116MB (+1064MB) parse_crate
time: 0.003; rss: 1116MB -> 1116MB ( +0MB) attributes_injection
time: 0.002; rss: 1116MB -> 1116MB ( +0MB) incr_comp_prepare_session_directory
time: 0.000; rss: 1116MB -> 1116MB ( +0MB) incr_comp_garbage_collect_session_directories
time: 0.000; rss: 1116MB -> 1116MB ( +0MB) plugin_loading
time: 0.000; rss: 1116MB -> 1116MB ( +0MB) plugin_registration
time: 0.003; rss: 1118MB -> 1118MB ( +0MB) crate_injection
time: 13.376; rss: 1118MB -> 3143MB (+2025MB) expand_crate
time: 0.002; rss: 3143MB -> 3143MB ( +0MB) check_unused_macros
time: 13.379; rss: 1118MB -> 3143MB (+2025MB) macro_expand_crate
time: 0.002; rss: 3143MB -> 3143MB ( +0MB) maybe_building_test_harness
time: 0.479; rss: 3143MB -> 3143MB ( +0MB) AST_validation
time: 0.002; rss: 3143MB -> 3143MB ( +0MB) maybe_create_a_macro_crate
time: 0.005; rss: 3143MB -> 3143MB ( +0MB) finalize_imports
time: 0.520; rss: 3143MB -> 3125MB ( -18MB) finalize_macro_resolutions
time: 4.446; rss: 3125MB -> 3577MB ( +453MB) late_resolve_crate
time: 0.000; rss: 3577MB -> 3577MB ( +0MB) resolve_main
time: 0.336; rss: 3577MB -> 3577MB ( +0MB) resolve_check_unused
time: 0.000; rss: 3577MB -> 3577MB ( +0MB) resolve_report_errors
time: 0.295; rss: 3577MB -> 3578MB ( +0MB) resolve_postprocess
time: 5.602; rss: 3143MB -> 3578MB ( +435MB) resolve_crate
time: 0.388; rss: 3578MB -> 3578MB ( +0MB) complete_gated_feature_checking
time: 20.014; rss: 1116MB -> 3578MB (+2462MB) configure_and_expand
time: 0.000; rss: 3578MB -> 3578MB ( +0MB) prepare_outputs
time: 0.000; rss: 3578MB -> 3578MB ( +0MB) blocked_on_dep_graph_loading
time: 64.219; rss: 3578MB -> 6313MB (+2736MB) hir_lowering
time: 1.102; rss: 6313MB -> 6319MB ( +6MB) early_lint_checks
time: 1.426; rss: 6319MB -> 6268MB ( -52MB) drop_ast
time: 0.005; rss: 5834MB -> 5836MB ( +2MB) setup_global_ctxt
time: 0.000; rss: 5838MB -> 5838MB ( +0MB) looking_for_entry_point
time: 0.292; rss: 5838MB -> 5840MB ( +1MB) looking_for_derive_registrar
time: 9.553; rss: 5838MB -> 6060MB ( +222MB) misc_checking_1
time: 9.949; rss: 6060MB -> 6764MB ( +704MB) type_collecting
time: 0.630; rss: 6764MB -> 6764MB ( +0MB) impl_wf_inference
time: 0.060; rss: 6764MB -> 6764MB ( +0MB) unsafety_checking
time: 3.054; rss: 6764MB -> 6787MB ( +23MB) coherence_checking
time: 20.702; rss: 6787MB -> 7533MB ( +746MB) wf_checking
time: 5.194; rss: 7533MB -> 7668MB ( +135MB) item_types_checking
time: 74.677; rss: 7668MB -> 8062MB ( +394MB) item_bodies_checking
time: 114.497; rss: 6060MB -> 8068MB (+2008MB) type_check_crate
time: 1.891; rss: 8068MB -> 8072MB ( +4MB) match_checking
time: 1.292; rss: 8072MB -> 8100MB ( +28MB) liveness_and_intrinsic_checking
time: 3.183; rss: 8068MB -> 8100MB ( +32MB) misc_checking_2
time: 68.845; rss: 8100MB -> 9279MB (+1179MB) MIR_borrow_checking
time: 0.587; rss: 9279MB -> 9295MB ( +17MB) MIR_effect_checking
time: 0.000; rss: 9295MB -> 9295MB ( +0MB) layout_testing
time: 4.443; rss: 9377MB -> 9504MB ( +127MB) death_checking
time: 0.034; rss: 9504MB -> 9504MB ( +0MB) unused_lib_feature_checking
time: 4.409; rss: 9504MB -> 9562MB ( +58MB) crate_lints
time: 56.490; rss: 9562MB -> 9571MB ( +8MB) module_lints
time: 60.900; rss: 9504MB -> 9571MB ( +66MB) lint_checking
time: 4.147; rss: 9571MB -> 9633MB ( +62MB) privacy_checking_modules
time: 75.094; rss: 9295MB -> 9633MB ( +337MB) misc_checking_3
time: 0.315; rss: 10357MB -> 10357MB ( +0MB) monomorphization_collector_root_collections
time: 14.501; rss: 10357MB -> 10571MB ( +215MB) monomorphization_collector_graph_walk
time: 1.763; rss: 10571MB -> 10661MB ( +89MB) partition_and_assert_distinct_symbols
time: 29.035; rss: 9633MB -> 10706MB (+1073MB) generate_crate_metadata
time: 0.000; rss: 10706MB -> 10706MB ( +0MB) find_cgu_reuse
time: 30.913; rss: 10706MB -> 12150MB (+1444MB) codegen_to_LLVM_IR
time: 31.108; rss: 10706MB -> 12150MB (+1444MB) codegen_crate
time: 0.000; rss: 12150MB -> 12150MB ( +0MB) assert_dep_graph
time: 0.000; rss: 12150MB -> 12150MB ( +0MB) check_dirty_clean
time: 0.416; rss: 12152MB -> 12199MB ( +46MB) encode_query_results_for(rustc_query_impl::queries::type_of)
time: 1.259; rss: 12199MB -> 12211MB ( +12MB) encode_query_results_for(rustc_query_impl::queries::generics_of)
time: 0.095; rss: 12211MB -> 12193MB ( -18MB) encode_query_results_for(rustc_query_impl::queries::predicates_of)
time: 0.005; rss: 12193MB -> 12195MB ( +2MB) encode_query_results_for(rustc_query_impl::queries::mir_const_qualif)
time: 0.828; rss: 12195MB -> 12208MB ( +14MB) encode_query_results_for(rustc_query_impl::queries::mir_for_ctfe)
time: 17.880; rss: 12208MB -> 11987MB ( -222MB) encode_query_results_for(rustc_query_impl::queries::optimized_mir)
time: 0.000; rss: 11987MB -> 11987MB ( +0MB) encode_query_results_for(rustc_query_impl::queries::covered_file_name)
time: 0.000; rss: 11987MB -> 11987MB ( +0MB) encode_query_results_for(rustc_query_impl::queries::covered_code_regions)
time: 0.007; rss: 11987MB -> 11988MB ( +1MB) encode_query_results_for(rustc_query_impl::queries::promoted_mir)
time: 0.049; rss: 11988MB -> 11992MB ( +4MB) encode_query_results_for(rustc_query_impl::queries::unsafety_check_result)
time: 0.002; rss: 11992MB -> 11994MB ( +1MB) encode_query_results_for(rustc_query_impl::queries::thir_check_unsafety)
time: 38.049; rss: 11994MB -> 12093MB ( +99MB) encode_query_results_for(rustc_query_impl::queries::typeck)
time: 0.000; rss: 12093MB -> 12093MB ( +0MB) encode_query_results_for(rustc_query_impl::queries::diagnostic_only_typeck)
time: 0.024; rss: 12093MB -> 12095MB ( +2MB) encode_query_results_for(rustc_query_impl::queries::used_trait_imports)
time: 0.372; rss: 12095MB -> 12053MB ( -42MB) encode_query_results_for(rustc_query_impl::queries::mir_borrowck)
time: 0.015; rss: 12053MB -> 12053MB ( +0MB) encode_query_results_for(rustc_query_impl::queries::eval_to_allocation_raw)
time: 0.005; rss: 12053MB -> 12054MB ( +1MB) encode_query_results_for(rustc_query_impl::queries::eval_to_const_value_raw)
time: 0.003; rss: 12054MB -> 12056MB ( +2MB) encode_query_results_for(rustc_query_impl::queries::check_match)
time: 0.037; rss: 12056MB -> 11899MB ( -157MB) encode_query_results_for(rustc_query_impl::queries::symbol_name)
time: 0.667; rss: 11899MB -> 11708MB ( -191MB) encode_query_results_for(rustc_query_impl::queries::codegen_fn_attrs)
time: 0.045; rss: 11708MB -> 11709MB ( +1MB) encode_query_results_for(rustc_query_impl::queries::codegen_fulfill_obligation)
time: 0.295; rss: 11709MB -> 11734MB ( +25MB) encode_query_results_for(rustc_query_impl::queries::specialization_graph_of)
time: 0.000; rss: 11734MB -> 11734MB ( +0MB) encode_query_results_for(rustc_query_impl::queries::adt_drop_tys)
time: 0.000; rss: 11734MB -> 11734MB ( +0MB) encode_query_results_for(rustc_query_impl::queries::adt_significant_drop_tys)
time: 0.005; rss: 11734MB -> 11734MB ( +1MB) encode_query_results_for(rustc_query_impl::queries::unused_generic_params)
time: 60.063; rss: 12152MB -> 11734MB ( -418MB) encode_query_results
time: 76.745; rss: 12007MB -> 11699MB ( -308MB) LLVM_passes(crate)
time: 61.634; rss: 12150MB -> 10557MB (-1593MB) incr_comp_serialize_result_cache
time: 61.637; rss: 12150MB -> 10557MB (-1593MB) incr_comp_persist_result_cache
time: 0.001; rss: 10557MB -> 10557MB ( +0MB) incr_comp_persist_dep_graph
time: 61.641; rss: 12150MB -> 10557MB (-1593MB) serialize_dep_graph
time: 15.601; rss: 10557MB -> 10242MB ( -315MB) free_global_ctxt
time: 0.000; rss: 10242MB -> 10242MB ( +0MB) join_worker_thread
time: 0.368; rss: 10242MB -> 10242MB ( +0MB) copy_all_cgu_workproducts_to_incr_comp_cache_dir
time: 0.375; rss: 10242MB -> 10242MB ( +0MB) finish_ongoing_codegen
time: 0.000; rss: 10242MB -> 10242MB ( +0MB) llvm_dump_timing_file
time: 0.002; rss: 10242MB -> 10242MB ( +0MB) serialize_work_products
time: 0.001; rss: 9668MB -> 9668MB ( +0MB) incr_comp_finalize_session_directory
time: 0.000; rss: 9668MB -> 9668MB ( +0MB) link_binary_check_files_are_writeable
time: 1.469; rss: 9668MB -> 9671MB ( +3MB) link_rlib
time: 0.000; rss: 9671MB -> 9671MB ( +0MB) link_binary_remove_temps
time: 1.506; rss: 9668MB -> 9671MB ( +3MB) link_binary
time: 1.622; rss: 9668MB -> 9329MB ( -339MB) link_crate
time: 2.037; rss: 10242MB -> 9329MB ( -913MB) link
time: 502.990; rss: 32MB -> 5888MB (+5855MB) total
```
</details>
(6.34% decrease in runtime, results are consistent across multiple runs)
2021-11-27 11:46:45 +01:00
Matthias Krüger
8fb58e5ece
Rollup merge of #91057 - the8472:clarify-parallelism-steady-state, r=dtolnay
...
Expand `available_parallelism` docs in anticipation of cgroup quota support
The "fixed" in "fixed steady state limits" means to exclude load-dependent resource prioritization
that would calculate to 100% of capacity on an idle system and less capacity on a loaded system.
Additionally I also exclude "system load" since it would be silly to try to identify
other, perhaps higher priority, processes hogging some CPU cores that aren't explicitly excluded
by masks/quotas/whatever.
2021-11-27 11:46:42 +01:00
Matthias Krüger
43279b2749
Rollup merge of #90995 - the8472:hash-portability, r=dtolnay
...
Document non-guarantees for Hash
Dependence on endianness and type sizes was reported for enum discriminants in #74215 but it is a more general
issue since for example the default implementation of `Hasher::write_usize` uses native endianness.
Additionally the implementations of library types are occasionally changed as their internal fields
change or hashing gets optimized.
## Question
Should this go on the module level documentation instead since it also concerns `Hasher` to some extent and not just `Hash`?
resolves #74215
2021-11-27 11:46:42 +01:00
Matthias Krüger
14ef447d12
Rollup merge of #83791 - the8472:relax-zip-side-effect-guarantee, r=dtolnay
...
Weaken guarantee around advancing underlying iterators in zip
The current guarantee (introduced in #52279 ) is too strong as it prevents adapters from exploiting knowledge about the iterator length and using counted loops for example because they would stop calling `next()` before it ever returned `None`. Additionally several nested zip iterators already fail to uphold this.
This does not yet remove any of the specialization code that tries (and sometimes fails) to uphold the guarantee for `next()`
because removing it would also affect `next_back()` in more surprising ways.
The intent is to be able to remove for example this branch
36bcf40697/library/core/src/iter/adapters/zip.rs (L234-L243)
or this test
36bcf40697/library/core/tests/iter/adapters/zip.rs (L177-L188)
Solves #82303 by declaring it a non-issue.
2021-11-27 11:46:40 +01:00