Commit graph

170504 commits

Author SHA1 Message Date
bors
2cec6874c0 Auto merge of #98004 - paolobarbolini:vecdeque-extend-trustedlen, r=the8472
Add VecDeque::extend from TrustedLen specialization

Continuation of #95904

Inspired by how [`VecDeque::copy_slice` works](c08b235a5c/library/alloc/src/collections/vec_deque/mod.rs (L437-L454)).

## Benchmarks

Before

```
test vec_deque::bench_extend_chained_bytes      ... bench:       1,026 ns/iter (+/- 17)
test vec_deque::bench_extend_chained_trustedlen ... bench:       1,024 ns/iter (+/- 40)
test vec_deque::bench_extend_trustedlen         ... bench:         637 ns/iter (+/- 693)
```

After

```
test vec_deque::bench_extend_chained_bytes      ... bench:         828 ns/iter (+/- 24)
test vec_deque::bench_extend_chained_trustedlen ... bench:          25 ns/iter (+/- 1)
test vec_deque::bench_extend_trustedlen         ... bench:          21 ns/iter (+/- 0)
```

## Why do it this way

https://rust.godbolt.org/z/15qY1fMYh

The Compiler Explorer example shows how "just" removing the capacity check, like the [`Vec` `TrustedLen` specialization](c08b235a5c/library/alloc/src/vec/spec_extend.rs (L22-L58)) does, wouldn't have been enough for `VecDeque`. `wrap_add` would still have greatly limited what LLVM could do while optimizing.

---

r? `@the8472`
2022-06-18 12:54:01 +00:00
bors
cdcc53b7dc Auto merge of #98153 - nnethercote:fix-MissingDoc-quadratic-behaviour, r=cjgillot
Fix `MissingDoc` quadratic behaviour

Best reviewed one commit at a time.

r? `@cjgillot`
2022-06-18 09:57:00 +00:00
bors
0182fd99af Auto merge of #98186 - mystor:tokenstream_as_vec_tt, r=eddyb
Batch proc_macro RPC for TokenStream iteration and combination operations

This is the first part of #86822, split off as requested in https://github.com/rust-lang/rust/pull/86822#pullrequestreview-1008655452. It reduces the number of RPC calls required for common operations such as iterating over and concatenating TokenStreams.
2022-06-18 07:37:14 +00:00
bors
ff86b27e7b Auto merge of #98178 - RalfJung:btree-alloc, r=thomcc
btree: avoid forcing the allocator to be a reference

The previous code forces the actual allocator used to be some `&A`. This generalizes the code to allow any `A: Copy`. If people truly want to use a reference, they can use `&A` themselves.

Fixes https://github.com/rust-lang/rust/issues/98176
2022-06-18 05:12:40 +00:00
bors
529c4c7179 Auto merge of #98216 - JohnTitor:rollup-jlcmu5d, r=JohnTitor
Rollup of 5 pull requests

Successful merges:

 - #97803 (Impl Termination for Infallible and then make the Result impls of Termination more generic)
 - #97828 (Allow configuring where artifacts are downloaded from)
 - #98150 (Emscripten target: replace -g4 with -g, and -g3 with --profiling-funcs)
 - #98195 (Fix rustdoc json primitive handling)
 - #98205 (Remove a possible unnecessary assignment)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-18 02:31:53 +00:00
Nika Layzell
df925fda9c review fixups 2022-06-17 22:10:07 -04:00
Yuki Okushi
f514aa4c07
Rollup merge of #98205 - JohnTitor:remove-unnecessary-let, r=jyn514
Remove a possible unnecessary assignment

The reference issue has been closed (the feature has been stabilized)
and things work fine without it, it seems.

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-06-18 10:03:26 +09:00
Yuki Okushi
4557ff7bd7
Rollup merge of #98195 - GuillaumeGomez:rustdoc-json-primitive, r=notriddle
Fix rustdoc json primitive handling

Fixes https://github.com/rust-lang/rust/issues/98006.

cc `@matthiaskrgr`
2022-06-18 10:03:25 +09:00
Yuki Okushi
d9559f4514
Rollup merge of #98150 - hoodmane:emscripten-g4, r=sbc100
Emscripten target: replace -g4 with -g, and -g3 with --profiling-funcs

Emscripten prints the following warning:
```
emcc: warning: please replace -g4 with -gsource-map [-Wdeprecated]
```
`@sbc100`
2022-06-18 10:03:24 +09:00
Yuki Okushi
d09a568b94
Rollup merge of #97828 - ferrocene:pa-config-artifacts, r=jyn514
Allow configuring where artifacts are downloaded from

Bootstrap has support for downloading prebuilt LLVM and rustc artifacts to speed up local builds, but that currently works only for users working on `rust-lang/rust`. Forks of the repository (for example Ferrocene) might have different URLs to download artifacts from, or might use a different email address on merge commits, breaking both LLVM and rustc artifact downloads.

This PR refactors bootstrap to load the download URLs and other constants from `src/stage0.json`, allowing downstream forks to tweak those values. It also future-proofs the download code to easily allow forks to add their own custom protocols (like `s3://`).

This PR is best reviewed commit-by-commit.
2022-06-18 10:03:23 +09:00
Yuki Okushi
fc8027f188
Rollup merge of #97803 - Gankra:term, r=dtolnay
Impl Termination for Infallible and then make the Result impls of Termination more generic

This allows things like `Result<ExitCode, E>` to 'just work'
2022-06-18 10:03:22 +09:00
bors
aaf100597c Auto merge of #97652 - RalfJung:cenum_impl_drop_cast, r=nagisa
make cenum_impl_drop_cast deny-by-default

Also make it show up as future breakage diagnostic.

In https://github.com/rust-lang/rust/pull/96862 we are proposing to change behavior of those drops *again*, so this looks like a good opportunity to increase our pressure on getting them out of the ecosystem. Looking at the [tracking issue](https://github.com/rust-lang/rust/issues/73333), so far nobody spoke up in favor of this (accidental) feature.

Cc https://github.com/rust-lang/rust/issues/73333 `@oli-obk`
2022-06-18 00:02:52 +00:00
Ralf Jung
3a1e114120 comments explaining why we have and don't have ManuallyDrop 2022-06-17 16:23:51 -07:00
Paolo Barbolini
ce3b6f505e Expose iter::ByRefSized as unstable feature and use it 2022-06-18 00:03:54 +02:00
Paolo Barbolini
bc3fae4dc1 Add VecDeque::extend from TrustedLen specialization 2022-06-18 00:03:54 +02:00
Paolo Barbolini
ac2c21a623 Add VecDeque::extend TrustedLen benchmark 2022-06-17 23:41:03 +02:00
bors
c3b7d7b496 Auto merge of #98081 - gco:no_static_libcpp, r=jyn514
Do not try to statically link libstdc++ on Solaris

Fixes #97260
2022-06-17 20:11:03 +00:00
Aria Beingessner
0894660d3b bless new test result, it's a regression but seemingly a compiler bug 2022-06-17 13:54:26 -04:00
Aria Beingessner
1502713f99 Impl Termination for Infallible and then make the Result impls of Termination into a blanket
This allows things like `Result<ExitCode, E>` to 'just work'
2022-06-17 13:54:17 -04:00
Hood Chatham
a2ecf5b2f7 Replace -g4 with -gsource-map 2022-06-17 10:52:10 -07:00
bors
0cb9899e78 Auto merge of #97892 - klensy:fix-spaces, r=oli-obk
diagnostics: remove trailing spaces

Remove few occurrences of trailing spaces and drive by fix of needless alloc of const string.
2022-06-17 17:30:16 +00:00
Yuki Okushi
71d7f414a6
Remove a possible unnecessary assignment
The reference issue has been closed (the feature has been stabilized)
and things work fine without fine, it seems.

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-06-18 01:51:38 +09:00
bors
43c47db0b0 Auto merge of #98097 - lqd:const-alloc-hash, r=oli-obk
ctfe: limit hashing of big const allocations when interning

Const allocations are only hashed for interning. However, they can be large, making the hashing expensive especially since it uses `FxHash`: it's better suited to short keys, not potentially big buffers like the actual bytes of allocation and the associated 1/8th sized `InitMask`.

We can partially hash these fields when they're large, hashing the length, and head and tail of these buffers, to
limit possible collisions while avoiding most of the hashing work.

r? `@ghost`
2022-06-17 15:10:04 +00:00
Nika Layzell
af51424008 Move empty final TokenStream handling to server side of bridge 2022-06-17 11:07:42 -04:00
Guillaume Gomez
7cdf126a3a Add regression test for #98006 2022-06-17 15:48:53 +02:00
bors
949a64ab20 Auto merge of #98193 - Dylan-DPC:rollup-5gihjij, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #95392 (std: Stabilize feature try_reserve_2 )
 - #97798 (Hide irrelevant lines in suggestions to allow for suggestions that are far from each other to be shown)
 - #97844 (Windows: No panic if function not (yet) available)
 - #98013 (Subtype FRU fields first in `type_changing_struct_update`)
 - #98191 (Remove the rest of unnecessary `to_string`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-17 12:41:25 +00:00
Guillaume Gomez
87d90b1332 Fix rustdoc handling of primitive documentation 2022-06-17 14:41:07 +02:00
Dylan DPC
847e692b05
Rollup merge of #98191 - TaKO8Ki:remove-rest-of-unnecessary-to-string, r=Dylan-DPC
Remove the rest of unnecessary `to_string`

I removed most of unnecessary `to_string` in #98043. This patch removes the rest of them I missed.
2022-06-17 12:21:50 +02:00
Dylan DPC
4793397f11
Rollup merge of #98013 - compiler-errors:guide-inference-2, r=lcnr
Subtype FRU fields first in `type_changing_struct_update`

So this fixes a subtle bug that `type_changing_struct_update` introduced, where it'll no longer coerce the base expr correctly. I actually think this code is easier to understand now, too.

r? `@lcnr` since you reviewed the last one
2022-06-17 12:21:49 +02:00
Dylan DPC
7eabfb5fa7
Rollup merge of #97844 - ChrisDenton:dont-panic, r=JohnTitor
Windows: No panic if function not (yet) available

In some situations (e.g. #97814) it is possible for required functions to be called before they've had a chance to be loaded. Therefore, we make it possible to recover from this situation simply by looking at error codes.

`@rustbot` label +O-windows
2022-06-17 12:21:48 +02:00
Dylan DPC
74aa55b3fc
Rollup merge of #97798 - WaffleLapkin:allow_for_suggestions_that_are_quite_far_away_from_each_other, r=estebank
Hide irrelevant lines in suggestions to allow for suggestions that are far from each other to be shown

This is an attempt to fix suggestions one part of which is 6 lines or more far from the first. I've noticed "the problem" (of not showing some parts of the suggestion) here: https://github.com/rust-lang/rust/pull/97759#discussion_r889689230.

I'm not sure about the implementation (this big closure is just bad and makes already complicated code even more so), but I want to at least discuss the result.

Here is an example of how this changes the output:

Before:
```text
help: consider enclosing expression in a block
  |
3 ~     'l: { match () { () => break 'l,
4 |
5 |
6 |
7 |
8 |
...
```

After:
```text
help: consider enclosing expression in a block
  |
3 ~     'l: { match () { () => break 'l,
4 |
...
31|
32~ } };
  |
```

r? `@estebank`
`@rustbot` label +A-diagnostics +A-suggestion-diagnostics
2022-06-17 12:21:48 +02:00
Dylan DPC
b516806774
Rollup merge of #95392 - Xuanwo:stablize_try_reserve_2, r=dtolnay
std: Stabilize feature try_reserve_2

This PR intends to stabilize feature `try_reserve_2`, closes https://github.com/rust-lang/rust/issues/91789

This PR will also replace the previous PR: https://github.com/rust-lang/rust/pull/95139
2022-06-17 12:21:46 +02:00
bors
3a8b0144c8 Auto merge of #98106 - cjgillot:split-definitions, r=michaelwoerister
Split up `Definitions` and `ResolverAstLowering`.

Split off https://github.com/rust-lang/rust/pull/95573

r? `@michaelwoerister`
2022-06-17 10:00:11 +00:00
Takayuki Maeda
2135331a33 remove the rest of unnecessary to_string 2022-06-17 18:48:09 +09:00
bors
ecdd374e61 Auto merge of #97863 - JakobDegen:bitset-choice, r=nnethercote
`BitSet` related perf improvements

This commit makes two changes:
 1. Changes `MaybeLiveLocals` to use `ChunkedBitSet`
 2. Overrides the `fold` method for the iterator for `ChunkedBitSet`

I have local benchmarks verifying that each of these changes individually yield significant perf improvements to #96451 . I'm hoping this will be true outside of that context too. If that is not the case, I'll try to gate things on where they help as needed

r? `@nnethercote` who I believe was working on closely related things, cc `@tmiasko` because of the destprop pr
2022-06-17 07:35:22 +00:00
bors
0423e06ca9 Auto merge of #98160 - nnethercote:mv-finish-out-of-Encoder, r=bjorn3
Move `finish` out of the `Encoder` trait.

This simplifies things, but requires making `CacheEncoder` non-generic.

(This was previously merged as commit 4 in #94732 and then was reverted
in #97905 because it caused a perf regression.)

r? `@ghost`
2022-06-17 05:13:07 +00:00
Ralf Jung
901cd3a844 btree: avoid forcing the allocator to be a reference 2022-06-16 22:07:10 -07:00
Nika Layzell
4d45af9e73 Try to reduce codegen complexity of TokenStream's FromIterator and Extend impls
This is an experimental patch to try to reduce the codegen complexity of
TokenStream's FromIterator and Extend implementations for downstream
crates, by moving the core logic into a helper type. This might help
improve build performance of crates which depend on proc_macro as
iterators are used less, and the compiler may take less time to do
things like attempt specializations or other iterator optimizations.

The change intentionally sacrifices some optimization opportunities,
such as using the specializations for collecting iterators derived from
Vec::into_iter() into Vec.

This is one of the simpler potential approaches to reducing the amount
of code generated in crates depending on proc_macro, so it seems worth
trying before other more-involved changes.
2022-06-17 00:42:26 -04:00
Nika Layzell
0a049fd30d proc_macro: reduce the number of messages required to create, extend, and iterate TokenStreams
This significantly reduces the cost of common interactions with TokenStream
when running with the CrossThread execution strategy, by reducing the number of
RPC calls required.
2022-06-17 00:42:26 -04:00
Michael Goulet
784e28e218 Subtype FRU fields first in type_changing_struct_update 2022-06-17 03:21:52 +00:00
Nika Layzell
2b17219468 proc_macro: use macros to simplify aggregate Mark/Unmark definitions 2022-06-16 23:16:30 -04:00
bors
3cf1275ecc Auto merge of #98143 - cuviper:futex-rwlock-inline, r=thomcc
Add `#[inline]` to small fns of futex `RwLock`

The important methods like `read` and `write` were already inlined,
which can propagate all the way to inlining in user code, but these
small state functions were left behind as normal calls. They should
almost always be inlined as well, as they're just a few instructions.
2022-06-17 02:32:14 +00:00
bors
349bda2051 Auto merge of #98181 - JohnTitor:rollup-65ztwnz, r=JohnTitor
Rollup of 5 pull requests

Successful merges:

 - #97377 (Do not suggest adding semicolon/changing delimiters for macros in item position that originates in macros)
 - #97675 (Make `std::mem::needs_drop` accept `?Sized`)
 - #98118 (Test NLL fix of bad lifetime inference for reference captured in closure.)
 - #98166 (Add rustdoc-json regression test for #98009)
 - #98169 (Keyword docs: Link to wikipedia article for dynamic dispatch)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-16 23:50:20 +00:00
Yuki Okushi
6ac93185f4
Rollup merge of #98169 - pierwill:dyn-disp, r=JohnTitor
Keyword docs: Link to wikipedia article for dynamic dispatch
2022-06-17 07:16:58 +09:00
Yuki Okushi
81b00b80f3
Rollup merge of #98166 - GuillaumeGomez:regression-test-98009, r=matthiaskrgr
Add rustdoc-json regression test for #98009

Fixes #98009.

There was apparently nothing to be done...

cc `@matthiaskrgr`
r? `@notriddle`
2022-06-17 07:16:57 +09:00
Yuki Okushi
1f3023ca8a
Rollup merge of #98118 - steffahn:scoped-threads-nll-test, r=m-ou-se
Test NLL fix of bad lifetime inference for reference captured in closure.

This came up as a use-case for `thread::scope` API that only compiles successfully since `feature(nll)` got stabilized recently.

Closes #93203 which had been re-opened for tracking this very test case to be added.
2022-06-17 07:16:56 +09:00
Yuki Okushi
cf68fd7e8d
Rollup merge of #97675 - nvzqz:unsized-needs-drop, r=dtolnay
Make `std::mem::needs_drop` accept `?Sized`

This change attempts to make `needs_drop` work with types like `[u8]` and `str`.

This enables code in types like `Arc<T>` that was not possible before, such as https://github.com/rust-lang/rust/pull/97676.
2022-06-17 07:16:55 +09:00
Yuki Okushi
5cd8679dd2
Rollup merge of #97377 - ChayimFriedman2:issue-91800, r=estebank
Do not suggest adding semicolon/changing delimiters for macros in item position that originates in macros

Fixes #91800.
2022-06-17 07:16:54 +09:00
bors
cacc75c82e Auto merge of #97936 - nnethercote:compile-unicode_normalization-faster, r=oli-obk
Compile `unicode-normalization` faster

Various optimizations and cleanups aimed at improving compilation of `unicode-normalization`, which is notable for having several very large `match`es with many char ranges.

Best reviewed one commit at a time.

r? `@oli-obk`
2022-06-16 21:09:30 +00:00
Rémy Rakic
61dc080375 adjust const alloc interning partial hash comments 2022-06-16 23:07:43 +02:00