Commit Graph

233857 Commits

Author SHA1 Message Date
Zalathar
fbbb543ced coverage: Reserve capacity for all of a function's mapping regions
We already know in advance how many entries will be pushed onto this vector.
2023-09-11 14:29:10 +10:00
Zalathar
4f88aa0fbd coverage: Use a stable sort when grouping mapped regions by file
If two or more mappings cover exactly the same region, their relative order
will now be preserved from `get_expressions_and_counter_regions`, rather than
being disturbed by implementation details of an unstable sort.

The current order is: counter mappings, expression mappings, zero mappings.

(LLVM will also perform its own stable sort on these mappings, but that sort
only compares file ID, start location, and `RegionKind`.)
2023-09-11 14:29:09 +10:00
Zalathar
525ac15b66 coverage: Convert CoverageMapGenerator to GlobalFileTable
This struct was only being used to hold the global file table, and one of its
methods didn't even use the table. Changing its methods to ordinary functions
makes it easier to see where the table is mutated.
2023-09-11 14:29:09 +10:00
bors
9a099d2fa3 Auto merge of #115504 - bvanjoi:error-struct, r=cjgillot
resolve: derive diag for undetermined macro resolution

simply for neatness.
2023-09-11 03:28:52 +00:00
Nicholas Nethercote
64ea8eb1a9 Disentangle Debug and Display for Ty.
The `Debug` impl for `Ty` just calls the `Display` impl for `Ty`. This
is surprising and annoying. In particular, it means `Debug` doesn't show
as much information as `Debug` for `TyKind` does. And `Debug` is used in
some user-facing error messages, which seems bad.

This commit changes the `Debug` impl for `Ty` to call the `Debug` impl
for `TyKind`. It also does a number of follow-up changes to preserve
existing output, many of which involve inserting
`with_no_trimmed_paths!` calls. It also adds `Display` impls for
`UserType` and `Canonical`.

Some tests have changes to expected output:
- Those that use the `rustc_abi(debug)` attribute.
- Those that use the `EMIT_MIR` annotation.

In each case the output is slightly uglier than before. This isn't
ideal, but it's pretty weird (particularly for the attribute) that the
output is using `Debug` in the first place. They're fairly obscure
attributes (I hadn't heard of them) so I'm not worried by this.

For `async-is-unwindsafe.stderr`, there is one line that now lacks a
full path. This is a consistency improvement, because all the other
mentions of `Context` in this test lack a path.
2023-09-11 12:51:07 +10:00
reez12g
8bf075f2d0 make compiler/rustc_hir_typeck/src/generator_interior/mod.rs fmted 2023-09-11 11:35:43 +09:00
bors
9b72cc9abf Auto merge of #115388 - Zoxc:sharded-lock, r=SparrowLii
Add optimized lock methods for `Sharded` and refactor `Lock`

This adds methods to `Sharded` which pick a shard and also locks it. These branch on parallelism just once instead of twice, improving performance.

Benchmark for `cfg(parallel_compiler)` and 1 thread:
<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.6461s</td><td align="right">1.6345s</td><td align="right"> -0.70%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2414s</td><td align="right">0.2394s</td><td align="right"> -0.83%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">0.9205s</td><td align="right">0.9143s</td><td align="right"> -0.67%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.4981s</td><td align="right">1.4869s</td><td align="right"> -0.75%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">5.7629s</td><td align="right">5.7256s</td><td align="right"> -0.65%</td></tr><tr><td>Total</td><td align="right">10.0690s</td><td align="right">10.0008s</td><td align="right"> -0.68%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9928s</td><td align="right"> -0.72%</td></tr></table>

cc `@SparrowLii`
2023-09-11 01:43:29 +00:00
bors
9d311f9e2d Auto merge of #114967 - japaric:ja-gh114966, r=Mark-Simulacrum
QNX: pass a truncated thread name to the OS

The maximum length the thread name can have is `_NTO_THREAD_NAME_MAX`

fixes #114966
2023-09-10 23:55:38 +00:00
bors
030e4d382f Auto merge of #115682 - notriddle:notriddle/impl-sidebar, r=GuillaumeGomez
rustdoc: add impl items from aliased type into sidebar

Follow-up of https://github.com/rust-lang/rust/pull/115201.
2023-09-10 22:07:10 +00:00
Michael Goulet
30e6cea0ae Point out if a local trait has no implementations 2023-09-10 21:20:36 +00:00
León Orell Valerian Liehr
daf3c45531
Do not suggest generic const items unless enabled 2023-09-10 23:07:48 +02:00
León Orell Valerian Liehr
9b36252477
Make E0401 translatable 2023-09-10 23:07:24 +02:00
León Orell Valerian Liehr
b00e408e61
Generalize E0401 2023-09-10 23:06:14 +02:00
onur-ozkan
685b5c250f update build.extended comments in config.example.toml
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-09-10 23:58:05 +03:00
bors
c0583a0221 Auto merge of #112701 - bjorn3:test_cg_clif_in_ci2, r=Mark-Simulacrum
Run part of cg_clif's tests in CI

While currently cg_clif is already built in CI ensuring that it always compiles, sometimes there is a bug in the changes that were made causing tests to fail. This PR is one step towards preventing this.

Part of the test suite is still skipped until vendoring for the projects that are being tested is implemented. I will implement that in a future PR.

Fixes part of https://github.com/bjorn3/rustc_codegen_cranelift/issues/1290
Fixes part of https://github.com/rust-lang/rust/issues/95518
Required for https://github.com/rust-lang/rust/pull/81746
2023-09-10 20:18:01 +00:00
Alex Macleod
ce3b044298 Call LateLintPass::check_attribute from with_lint_attrs 2023-09-10 18:56:39 +00:00
bors
7418413a7f Auto merge of #115306 - tmiasko:encode-reachable-mir, r=cjgillot
Encode only MIR reachable from other crates

Only reachable items might participate in the code generation in the
downstream crates. Omit redundant optimized MIR of unreachable items
from a crate metadata.

Additionally, include reachable closures in reachable set, so that
unreachable closures can be omitted on the same basis.
2023-09-10 16:31:11 +00:00
Michael Howell
c79b960747
rustdoc: filter before storing in vec 2023-09-10 09:17:24 -07:00
Samuel Tardieu
c548d11041 Auto deref does not apply on union field 2023-09-10 18:15:18 +02:00
bjorn3
238d8e3ec7 Allow testing cg_clif using ./x.py test 2023-09-10 15:56:56 +00:00
bjorn3
4deb072e79 Fix tests 2023-09-10 15:50:48 +00:00
John Kåre Alsaker
f742d88326 Remove verbose_generic_activity_with_arg 2023-09-10 17:47:16 +02:00
bors
8e37c509fd Auto merge of #115731 - GuillaumeGomez:migrate-gui-test-color-40, r=notriddle
Migrate GUI colors test to original CSS color format

Follow-up of https://github.com/rust-lang/rust/pull/111459.

r? `@notriddle`
2023-09-10 14:43:54 +00:00
bjorn3
af97f86677 Fix test 2023-09-10 14:43:11 +00:00
bjorn3
7b30550cfe Support listing all items in -Zls 2023-09-10 14:32:58 +00:00
bjorn3
ff00763dd1 Show lib features in -Zls and allow configuring which things are shown 2023-09-10 13:24:20 +00:00
bjorn3
369a8ac52b List all defined and required lang items in -Zls 2023-09-10 13:01:37 +00:00
bjorn3
7279cc0abd List more crate metadata in -Zls 2023-09-10 12:42:48 +00:00
Guillaume Gomez
344ac25cbd Migrate GUI colors test to original CSS color format 2023-09-10 14:10:10 +02:00
Tomasz Miąsko
d99333e444 Encode only MIR that can be used by other crates
Only reachable items might participate in the code generation in the
downstream crates. Omit redundant optimized MIR of unreachable items
from a crate metadata.

Additionally, include reachable closures in reachable set, so that
unreachable closures can be omitted on the same basis.
2023-09-10 13:55:33 +02:00
bors
6645a93cef Auto merge of #115711 - Zoxc:freeze-cstore, r=oli-obk
Use `FreezeLock` for `CStore`

This uses `FreezeLock` to protect the `CStore`. `FreezeReadGuard` and `FreezeWriteGuard` are changed to support a `map` operation.

r? `@oli-obk`
2023-09-10 11:07:51 +00:00
bjorn3
2eca717a24 Remove EarlyErrorHandler argument from after_analysis callback
It is only used by miri which can create a new one using the Session.
2023-09-10 09:44:03 +00:00
bjorn3
90e9053189 Deprecate the pre_configure query
Only deprecating it rather than making it private to just in case
someone has a use case for it.
2023-09-10 09:41:03 +00:00
bjorn3
0ed291453d Rename after_parsing callback to after_crate_root_parsing
To avoid confusion if it is called after all parsing is done or not.
2023-09-10 09:31:10 +00:00
bors
01ce2d0ea1 Auto merge of #115725 - PhilVoel:patch-1, r=notriddle
Fixed typo in re-exports.md

own't -> won't
2023-09-10 09:21:06 +00:00
Deadbeef
84a490712a Implement fallback for effect param 2023-09-10 07:48:47 +00:00
Ralf Jung
254e13d9f9 fix homogeneous_aggregate not ignoring some 1-ZST 2023-09-10 07:38:03 +02:00
bors
dda95c14e1 Auto merge of #115713 - chenyukang:yukang-fix-115680-rustdoc-arg-check, r=compiler-errors
Abort if check nightly options failed on stable

Fixes #115680
Also, if there are multiple unstable options passing on stable compiler, printing multiple same `note` and `help` seems noisy.
2023-09-10 05:08:59 +00:00
bors
ffe131f841 Auto merge of #115668 - Zoxc:deadlock-msg, r=jackh726
Make the deadlock panic clearly refer to a deadlock
2023-09-10 03:23:02 +00:00
yukang
12888d246b Abort if check nightly options failed on stable 2023-09-10 10:02:35 +08:00
bors
0d0ad42e27 Auto merge of #115712 - RalfJung:wf, r=compiler-errors
rustc_layout, rustc_abi: make sure the types are well-formed

Fixes https://github.com/rust-lang/rust/issues/115676
2023-09-10 01:36:15 +00:00
Michael Howell
c3e5ad448b rustdoc: factor all-impls-for-item out into its own method 2023-09-09 18:29:00 -07:00
PhilVoel
59ed84a5b8
Fixed typo in re-exports.md
own't -> won't
2023-09-10 02:54:37 +02:00
bors
8c48b936cc Auto merge of #11459 - y21:issue11435, r=blyxyas
[`implied_bounds_in_impls`]: include (previously omitted) associated types in suggestion

Fixes #11435

It now includes associated types from the implied bound that were omitted in the second bound. Example:
```rs
fn f() -> impl Iterator<Item = u8> + ExactSizeIterator> {..}
```
Suggestion before this change:
```diff
- pub fn my_iter() -> impl Iterator<Item = u32> + ExactSizeIterator {
+ pub fn my_iter() -> impl ExactSizeIterator {
```
It didn't include `<Item = u32>` on `ExactSizeIterator`. Now, with this change, it does.
```diff
- pub fn my_iter() -> impl Iterator<Item = u32> + ExactSizeIterator {
+ pub fn my_iter() -> impl ExactSizeIterator<Item = u32> {
```

We also now extend the span to include not just possible `+` ahead of it, but also behind it (an example for this is in the linked issue as well).
**Note:** The overall diff is a bit noisy, because building up the suggestion involves quite a bit more logic now and I decided to extract that into its own function. For that reason, I split this PR up into two commits. The first commit contains the actual "logic" changes. Second commit just moves code around.

changelog: [`implied_bounds_in_impls`]: include (previously omitted) associated types in suggestion
changelog: [`implied_bounds_in_impls`]: include the `+` behind bound if it's the last bound
2023-09-09 22:51:42 +00:00
bors
8ed4537d7c Auto merge of #115703 - ouz-a:smir_span, r=oli-obk
Add function that returns span of an item in smir

Addressees https://github.com/rust-lang/project-stable-mir/issues/31

Maybe we should change `Span = Opaque` into something else, and then return `String` with newly added function, I don't think it matters that much though, since we are not storing `Span` anywhere.

r? `@oli-obk`
2023-09-09 21:45:47 +00:00
bors
559421e8e3 Auto merge of #114590 - ijackson:stdio-stdio-2, r=dtolnay
Allow redirecting subprocess stdout to our stderr etc. (redux)

This is the code from #88561, tidied up, including review suggestions, and with the for-testing-only CI commit removed.  FCP for the API completed in #88561.

I have made a new MR to facilitate review.  The discussion there is very cluttered and the branch is full of changes (in many cases as a result of changes to other Rust stdlib APIs since then).  Assuming this MR is approvedl we should close that one.

### Reviewer doing a de novo review

Just code review these four commits..  FCP discussion starts here: https://github.com/rust-lang/rust/pull/88561#issuecomment-1640527595

Portability tests: you can see that this branch works on Windows too by looking at the CI results in #88561, which has the same code changes as this branch but with an additional "DO NOT MERGE" commit to make the Windows tests run.

### Reviewer doing an incremental review from some version of #88561

Review the new commits since your last review.  I haven't force pushed the branch there.

git diff the two branches (eg `git diff 176886197d6..0842b69c219`).  You'll see that the only difference is in gitlab CI files.  You can also see that *this* MR doesn't touch those files.
2023-09-09 19:56:51 +00:00
bors
37eec5c80a Auto merge of #115698 - gurry:115143-ice-normalization-error, r=compiler-errors
Fix ICE in improper_ctypes_definitions lint

Fix #115143
2023-09-09 18:08:17 +00:00
bors
58b4ebcdd6 Auto merge of #115700 - GuillaumeGomez:migrate-gui-test-color-39, r=notriddle
Migrate GUI colors test to original CSS color format

Follow-up of https://github.com/rust-lang/rust/pull/111459.

r? `@notriddle`
2023-09-09 16:20:44 +00:00
Ralf Jung
3bd8bcb8bb better spans for WF errors 2023-09-09 18:00:13 +02:00
Ralf Jung
c2a7e684cd use hir_crate_items(()).definitions() instead of hir().items() 2023-09-09 17:39:53 +02:00