Commit Graph

220677 Commits

Author SHA1 Message Date
bors
96bd50dd47 Auto merge of #109581 - matthiaskrgr:rollup-e8fi2vi, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #109355 (Fix bad suggestion for clone/is_some in field init shorthand)
 - #109484 (Bugfix: avoid panic on invalid json output from libtest)
 - #109539 (Refactor `find_*_stability` functions)
 - #109542 (rustdoc: clean up `storage.js`)
 - #109545 (Deeply check well-formedness of return-position `impl Trait` in trait)
 - #109568 (miri: fix raw pointer dyn receivers)
 - #109570 (Add GUI test for "Auto-hide item methods' documentation" setting)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-25 14:34:13 +00:00
bors
b72e896268 Auto merge of #109100 - Zoxc:merge-query-try, r=cjgillot
Refactor `try_execute_query`

This merges `JobOwner::try_start` into `try_execute_query`, removing `TryGetJob` in the processes. 3 new functions are extracted from `try_execute_query`: `execute_job`, `cycle_error` and `wait_for_query`. This makes the control flow a bit clearer and improves performance.

Based on https://github.com/rust-lang/rust/pull/109046.

<table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check</td><td align="right">1.7134s</td><td align="right">1.7061s</td><td align="right"> -0.43%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2519s</td><td align="right">0.2510s</td><td align="right"> -0.35%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">0.9517s</td><td align="right">0.9481s</td><td align="right"> -0.38%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.5389s</td><td align="right">1.5338s</td><td align="right"> -0.33%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">5.9488s</td><td align="right">5.9258s</td><td align="right"> -0.39%</td></tr><tr><td>Total</td><td align="right">10.4048s</td><td align="right">10.3647s</td><td align="right"> -0.38%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9962s</td><td align="right"> -0.38%</td></tr></table>

r? `@cjgillot`
2023-03-25 12:04:46 +00:00
bors
e10eab5956 Auto merge of #109371 - Zoxc:verify-hash-opt, r=cjgillot
Optimize `incremental_verify_ich`

This optimizes `incremental_verify_ich` by operating on `SerializedDepNodeIndex`, saving 2 hashmap lookups. The panic paths are also changed to get a `TyCtxt` reference using TLS.
2023-03-25 09:22:15 +00:00
bors
9fa6b3c157 Auto merge of #99929 - the8472:default-iters, r=scottmcm
Implement Default for some alloc/core iterators

Add `Default` impls to the following collection iterators:

* slice::{Iter, IterMut}
* binary_heap::IntoIter
* btree::map::{Iter, IterMut, Keys, Values, Range, IntoIter, IntoKeys, IntoValues}
* btree::set::{Iter, IntoIter, Range}
* linked_list::IntoIter
* vec::IntoIter

and these adapters:

* adapters::{Chain, Cloned, Copied, Rev, Enumerate, Flatten, Fuse, Rev}

For iterators which are generic over allocators it only implements it for the global allocator because we can't conjure an allocator from nothing or would have to turn the allocator field into an `Option` just for this change.

These changes will be insta-stable.

ACP: https://github.com/rust-lang/libs-team/issues/77
2023-03-25 06:29:46 +00:00
bors
24a69af213 Auto merge of #109546 - saethlin:inline-into, r=scottmcm
Add #[inline] to the Into for From impl

I was skimming through the standard library MIR and I noticed a handful of very suspicious `Into::into` calls in `alloc`. ~Since this is a trivial wrapper function, `#[inline(always)]` seems appropriate.;~ `#[inline]` works too and is a lot less spooky.

r? `@thomcc`
2023-03-25 03:09:09 +00:00
Matthias Krüger
beac95a4ab
Rollup merge of #109570 - GuillaumeGomez:add-gui-test, r=notriddle
Add GUI test for "Auto-hide item methods' documentation" setting

Part of https://github.com/rust-lang/rust/issues/66181.

r? `@notriddle`
2023-03-25 03:37:13 +01:00
Matthias Krüger
31df7f1ecd
Rollup merge of #109568 - RalfJung:miri-raw-ptr-dyn, r=oli-obk
miri: fix raw pointer dyn receivers

r? `@oli-obk`
Fixes https://github.com/rust-lang/miri/issues/2786
2023-03-25 03:37:12 +01:00
Matthias Krüger
3b49ad3814
Rollup merge of #109545 - compiler-errors:rpitit-wf, r=eholk
Deeply check well-formedness of return-position `impl Trait` in trait

Walk the bounds of RPITITs to see if we find any more RPITITs 😸
2023-03-25 03:37:12 +01:00
Matthias Krüger
8c8305843b
Rollup merge of #109542 - notriddle:notriddle/storage-js, r=GuillaumeGomez
rustdoc: clean up `storage.js`
2023-03-25 03:37:11 +01:00
Matthias Krüger
15ea2276ff
Rollup merge of #109539 - cjgillot:find-stability, r=b-naber
Refactor `find_*_stability` functions

The idea is to split the monolithic function into the 3 cases: stability, const stability, and body stability.
2023-03-25 03:37:11 +01:00
Matthias Krüger
65220b5ba9
Rollup merge of #109484 - fortanix:raoul/bugfix_libtest_json_output, r=pietroalbini
Bugfix: avoid panic on invalid json output from libtest

#108659 introduces a custom test display implementation. It does so by using libtest to output json. The stdout is read and parsed; The code trims the line read and checks whether it starts with a `{` and ends with a `}`. If so, it concludes that it must be a json encoded `Message`. Unfortunately, this does not work in all cases:

- This assumes that tests running with `--nocapture` will never start and end lines with `{` and `}` characters
- Output is generated by issuing multiple `write_message` [statements](https://github.com/rust-lang/rust/blob/master/library/test/src/formatters/json.rs#L33-L60). Where only the last one issues a `\n`. This likely results in a race condition as we see multiple json outputs on the same line when running tests for the `x86_64-fortanix-unknown-sgx` target:
```
10:21:04      Running tests/run-time-detect.rs (build/x86_64-unknown-linux-gnu/stage1-std/x86_64-fortanix-unknown-sgx/release/deps/run_time_detect-8c66026bd4b1871a)
10:21:04
10:21:04 running 1 tests
10:21:04 test x86_all ... ok
10:21:04      Running tests/thread.rs (build/x86_64-unknown-linux-gnu/stage1-std/x86_64-fortanix-unknown-sgx/release/deps/thread-ed5456a7d80a6193)
10:21:04 thread 'main' panicked at 'failed to parse libtest json output; error: trailing characters at line 1 column 135, line: "{ \"type\": \"suite\", \"event\": \"ok\", \"passed\": 1, \"failed\": 0, \"ignored\": 0, \"measured\": 0, \"filtered_out\": 0, \"exec_time\": 0.000725911 }{ \"type\": \"suite\", \"event\": \"started\", \"test_count\": 1 }\n"', render_tests.rs:108:25
```

This PR implements a partial fix by being much more conservative of what it asserts is a valid json encoded `Message`. This prevents panics, but still does not resolve the race condition. A discussion is needed where this race condition comes from exactly and how it best can be avoided.

cc: `@jethrogb,` `@pietroalbini`
2023-03-25 03:37:10 +01:00
Matthias Krüger
f3d3f350cc
Rollup merge of #109355 - chenyukang:yukang/fix-108470, r=compiler-errors
Fix bad suggestion for clone/is_some in field init shorthand

Fixes #108470
2023-03-25 03:37:10 +01:00
John Kåre Alsaker
820e3a8d6a Pass tcx directly 2023-03-25 03:13:05 +01:00
John Kåre Alsaker
afe4c16b29 Split the if to release the lock earlier 2023-03-25 03:12:41 +01:00
John Kåre Alsaker
dfae9c993d Remove DebugArg 2023-03-25 02:59:54 +01:00
John Kåre Alsaker
8f294066b3 Optimize incremental_verify_ich 2023-03-25 02:59:53 +01:00
bors
d012d2f96e Auto merge of #109399 - petrochenkov:rendersort, r=GuillaumeGomez
rustdoc: Optimize impl sorting during rendering

This should fix the perf regression on [bitmaps-3.1.0](https://github.com/rust-lang/rustc-perf/tree/master/collector/compile-benchmarks/bitmaps-3.1.0) from https://github.com/rust-lang/rust/pull/107765.

The bitmaps crate has a lot of impls:
```rust
impl Bits for BitsImpl<1> { ... }
impl Bits for BitsImpl<2> { ... }
// ...
impl Bits for BitsImpl<1023> { ... }
impl Bits for BitsImpl<1024> { ... }
```
and the logic in `fn print_item` sorts them in natural order.

Before https://github.com/rust-lang/rust/pull/107765 the impls came in source order, which happened to be already sorted in the necessary way.
So the comparison function was called fewer times.

After https://github.com/rust-lang/rust/pull/107765 the impls came in "stable" order (based on def path hash).
So the comparison function was called more times to sort them.

The comparison function was terribly inefficient, so it caused a large perf regression.
This PR attempts to make it more efficient by using cached keys during sorting.
2023-03-24 23:41:53 +00:00
bors
8be3c2bda6 Auto merge of #107932 - petrochenkov:onlyexport, r=jyn514
rustdoc: Skip doc link resolution for non-exported items
2023-03-24 21:10:51 +00:00
Ben Kimock
badfb17d2f Add #[inline] to the Into for From impl 2023-03-24 15:06:31 -04:00
Camille GILLOT
3e9ea5da63 Adjust documentation. 2023-03-24 18:53:36 +00:00
bors
80a933042e Auto merge of #109566 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`

One day late, sorry 😐
2023-03-24 18:40:19 +00:00
Guillaume Gomez
9cb7d4ca39 Add GUI test for "Auto-hide item methods' documentation" setting 2023-03-24 16:57:55 +01:00
Ralf Jung
c2fddfd8e2 miri: fix raw pointer dyn receivers 2023-03-24 16:53:18 +01:00
bors
31d74fb24b Auto merge of #109220 - nikic:poison, r=cuviper
Use poison instead of undef

In cases where it is legal, we should prefer poison values over undef values.

This replaces undef with poison for aggregate construction and for uninhabited types. There are more places where we can likely use poison, but I wanted to stay conservative to start with.

In particular the aggregate case is important for newer LLVM versions, which are not able to handle an undef base value during early optimization due to poison-propagation concerns.

r? `@cuviper`
2023-03-24 15:39:40 +00:00
Philipp Krones
50475e8648
Merge commit 'd5e2a7aca55ed49fc943b7a07a8eba05ab5a0079' into clippyup 2023-03-24 14:26:19 +01:00
bors
d5e2a7aca5 Auto merge of #10539 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`
changelog: none
2023-03-24 12:40:28 +00:00
Philipp Krones
8134414e03
Bump nightly version -> 2023-03-24 2023-03-24 13:36:15 +01:00
Philipp Krones
62cba5d971
Merge remote-tracking branch 'upstream/master' into rustup 2023-03-24 13:36:09 +01:00
yukang
64f6e4f21c Fix bad suggestion for clone/is_some in field init shorthand 2023-03-24 19:52:34 +08:00
bors
f421586eed Auto merge of #109216 - martingms:unicode-case-lut-shrink, r=Mark-Simulacrum
Shrink unicode case-mapping LUTs by 24k

I was looking into the binary bloat of a small program using `str::to_lowercase` and `str::to_uppercase`, and noticed that the lookup tables used for case mapping had a lot of zero-bytes in them. The reason for this is that since some characters map to up to three other characters when lower or uppercased, the LUTs store a `[char; 3]` for each character. However, the vast majority of cases only map to a single new character, in other words most of the entries are e.g. `(lowerc, [upperc, '\0', '\0'])`.
This PR introduces a new encoding scheme for these tables.

The changes reduces the size of my test binary by about 24K.

I've also done some `#[bench]`marks on unicode-heavy test data, and found that the performance of both `str::to_lowercase` and `str::to_uppercase` improves by up to 20%. These measurements are obviously very dependent on the character distribution of the data.

Someone else will have to decide whether this more complex scheme is worth it or not, I was just goofing around a bit and here's what came out of it 🤷‍♂️ No hard feelings if this isn't wanted!
2023-03-24 10:33:42 +00:00
bors
c763eceae3 Auto merge of #109552 - matthiaskrgr:rollup-03xwois, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #109406 (Remove outdated comments)
 - #109433 (Return equal for two identical projections)
 - #109495 (Implement non-const `Destruct` trait in new solver)
 - #109519 (Link against libc++ on AIX)
 - #109550 (Make helper functions private in fn_ctxt/adjust_fulfillment_errors)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-24 06:16:24 +00:00
Matthias Krüger
2cfcca629f
Rollup merge of #109550 - Nathan-Fenner:nathanf/fixme-adjust-funcs, r=compiler-errors
Make helper functions private in fn_ctxt/adjust_fulfillment_errors

Two helper functions in `rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs` were previously made `pub` impl members, because they were also used in `rustc_hir_typeck/src/fn_ctxt/check.rs` (see #107746).

However, that's no longer the case, so the FIXME suggesting they be made private can now be implemented.
2023-03-24 07:13:06 +01:00
Matthias Krüger
4378369b6a
Rollup merge of #109519 - bzEq:aix-llvm-c++, r=cuviper
Link against libc++ on AIX

LLVM on AIX currently is utilizing runtimes in llvm-project, such as libc++, libc++abi and libunwind.
2023-03-24 07:13:05 +01:00
Matthias Krüger
2270bde01f
Rollup merge of #109495 - compiler-errors:new-solver-destruct, r=eholk,lcnr
Implement non-const `Destruct` trait in new solver

Makes it so that we can call stdlib methods like `Option::map` in **non-const** environments, since *many* stdlib methods have `Destruct` bounds 😅

This doesn't bother to implement `const Destruct` yet, but it shouldn't be too hard to do so. Just didn't bother since we already don't have much support for const traits in the new solver anyways. I'd be happy to add skeleton support for `const Destruct`, though, if the reviewer desires.
2023-03-24 07:13:05 +01:00
Matthias Krüger
98254c5cc7
Rollup merge of #109433 - chenyukang:yukang/fix-109188-ice, r=lcnr
Return equal for two identical projections

Fixes #109188
2023-03-24 07:13:04 +01:00
Matthias Krüger
936377a0aa
Rollup merge of #109406 - WaffleLapkin:🥛, r=cuviper
Remove outdated comments

What the title said
2023-03-24 07:13:04 +01:00
Nathan Fenner
d4d1cc4db6 Make helper functions private 2023-03-23 20:24:37 -07:00
bors
4c0f5008ce Auto merge of #109547 - matthiaskrgr:rollup-zczqgdk, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #108629 (rustdoc: add support for type filters in arguments and generics)
 - #108924 (panic_immediate_abort requires abort as a panic strategy)
 - #108961 (Refine error spans for const args in hir typeck)
 - #108986 (sync LVI tests)
 - #109142 (Add block-based mutex unlocking example)
 - #109368 (fix typo in the creation of OpenOption for RustyHermit)
 - #109493 (Return nested obligations from canonical response var unification)
 - #109515 (Add AixLinker to support linking on AIX)
 - #109536 (resolve: Rename some cstore methods to match queries and add comments)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-03-24 02:29:48 +00:00
Matthias Krüger
4d21d302a1
Rollup merge of #109536 - petrochenkov:qcstore3, r=cjgillot
resolve: Rename some cstore methods to match queries and add comments

about costs associated with replacing them with query calls.

Supersedes https://github.com/rust-lang/rust/pull/108346.
r? `@cjgillot`
2023-03-24 01:22:07 +01:00
Matthias Krüger
686bd46d8a
Rollup merge of #109515 - bzEq:aix-linker, r=petrochenkov
Add AixLinker to support linking on AIX

AIX linker has a different cli style from other existing linkers.
It is documented in https://www.ibm.com/docs/en/aix/7.1?topic=l-ld-command.
2023-03-24 01:22:07 +01:00
Matthias Krüger
1c7ef3b483
Rollup merge of #109493 - compiler-errors:new-solver-vars-obligations, r=lcnr
Return nested obligations from canonical response var unification

Handle alias-eq obligations being emitted from `instantiate_and_apply_query_response` in:
* `EvalCtxt` - by processing the nested obligations in the next loop by `new_goals`
* `FulfillCtxt` - by adding the nested obligations to the fulfillment's pending obligations
* `InferCtxt::evaluate_obligation` - ~~by returning `EvaluationResult::EvaluatedToAmbig` (boo 👎, see the FIXME)~~ same behavior as above, since we use fulfillment and `select_where_possible`

The only one that's truly sketchy is `evaluate_obligation`, but it's not hard to modify this behavior moving forward.

From #109037, I think a smaller repro could be crafted if I were smarter, but I am not, so I just took this from #105878.

r? `@lcnr` cc `@BoxyUwU`
2023-03-24 01:22:06 +01:00
Matthias Krüger
cca2630bc9
Rollup merge of #109368 - hermitcore:typo, r=cuviper
fix typo in the creation of OpenOption for RustyHermit

Due to this typo we have to build a workaround for issue hermitcore/libhermit-rs#191.

RustyHermit is a tier 3 platform and backward compatibility does not have to be guaranteed.
2023-03-24 01:22:06 +01:00
Matthias Krüger
605a4fc7ab
Rollup merge of #109142 - the8472:mutex-block-docs, r=cuviper
Add block-based mutex unlocking example

This modifies the existing example in the Mutex docs to show both `drop()` and block based early unlocking.

Alternative to #81872, which is getting closed.
2023-03-24 01:22:05 +01:00
Matthias Krüger
cfd8105f3f
Rollup merge of #108986 - fortanix:raoul/sync_lvi_patches, r=cuviper
sync LVI tests

The LVI tests for the `x86_64-fortanix-unknown-sgx` target have gotten out of sync. LVI is still mitigated correctly, but the LVI tests need minor modifications. Other (non LVI-related) tests fail when the target applies LVI mitigations as they assume the generated code contains forbidden instructions such as `retq`. These tests are ignored for the sgx environment.

cc: `@jethrogb`
2023-03-24 01:22:05 +01:00
Matthias Krüger
eb82a5a0c8
Rollup merge of #108961 - compiler-errors:refine-ct-errors, r=BoxyUwU
Refine error spans for const args in hir typeck

Improve just a couple of error messages having to do with mismatched consts.

r? `@ghost` i'll put this up when the dependent commits are merged
2023-03-24 01:22:04 +01:00
Matthias Krüger
d9c05b853d
Rollup merge of #108924 - tmiasko:panic-immediate-abort, r=thomcc
panic_immediate_abort requires abort as a panic strategy

Guide `panic_immediate_abort` users away from `-Cpanic=unwind` and towards `-Cpanic=abort` to avoid an accidental use of the feature with the unwind strategy, e.g., on a targets where unwind is the default.

The `-Cpanic=unwind` combination doesn't offer the same benefits, since the code would still be generated under the assumption that functions implemented in Rust can unwind.
2023-03-24 01:22:04 +01:00
Matthias Krüger
eb46afb216
Rollup merge of #108629 - notriddle:notriddle/item-type-advanced, r=GuillaumeGomez
rustdoc: add support for type filters in arguments and generics

This makes sense, since the search index has the information in it, and it's more useful for function signature searches since a function signature search's item type is, by definition, some type of function (there's more than one, but not very many).
2023-03-24 01:22:03 +01:00
bors
c72c914d21 Auto merge of #10489 - samueltardieu:issue-10476, r=giraffate
New lint: detect unnecessary struct building

Fixes #10476.

Running this lint on the top 500 crates produced one hit (in `rust-lang/rust-bindgen`) and [a PR has been submitted there](https://github.com/rust-lang/rust-bindgen/pull/2440).

changelog: [`unnecessary_struct_initialization`]: new lint
2023-03-24 00:12:02 +00:00
bors
cf073ec2cb Auto merge of #109202 - compiler-errors:new-solver-fast-reject-faster-2, r=lcnr
Don't pass `TreatProjections` separately to `fast_reject`

Don't pass `TreatProjections` separately to `fast_reject`, and instead use the original approach of switching on two variants of `TreatParams` (undoes this: https://github.com/rust-lang/rust/pull/108830#pullrequestreview-1330371417).

Fixes the regression introduced in https://github.com/rust-lang/rust/pull/108830#issuecomment-1468116419
2023-03-23 23:53:56 +00:00
Michael Goulet
b605d0740f Deeply check WF for RPITITs 2023-03-23 23:37:22 +00:00