Commit Graph

233634 Commits

Author SHA1 Message Date
Matthias Krüger
b99af95713
Rollup merge of #115335 - reez12g:issue-114912, r=davidtwco
fix overflow in array length computation

addressing https://github.com/rust-lang/rust/issues/114912
2023-09-11 17:03:29 +02:00
bors
3ebb5629d1 Auto merge of #115595 - surechen:114896, r=davidtwco
Fix incorrect mutable suggestion information for binding in ref pattern like:  `let &b = a;`

fixes #114896

I find we have to get pat_span but not local_decl.source_info.span for suggestion. In `let &b = a;`  pat_span is &b. I think check `let &b = a` in hir to make sure it is hir::Node::Local(hir::Local {pat: hir::Pat{kind: hir::PatKind::Ref(.......   can distinguish it from other situation, but I'm not sure.

If my processing method is not accurate, please guide me to modify it, thank you.

r? `@davidtwco`
2023-09-11 15:02:59 +00:00
DianQK
b99ace4179
Add a test for #108030
Closes #108030.
This issue has been resolved in LLVM 17.
2023-09-11 22:01:55 +08:00
Deadbeef
9654d5ceaf add is_host_effect to GenericParamDefKind::Const and address review 2023-09-11 13:18:36 +00:00
bors
68c2f5ba0f Auto merge of #115308 - chenyukang:yukang-fix-62387-iter-mut, r=davidtwco
suggest iter_mut() where trying to modify elements from .iter()

Fixes https://github.com/rust-lang/rust/issues/115259
Fixes https://github.com/rust-lang/rust/issues/62387
2023-09-11 12:41:30 +00:00
Guillaume Gomez
c523701c2d Add missing ID into the ID map 2023-09-11 14:20:15 +02:00
Guillaume Gomez
755835ef3d Add test for the presence of "Aliased type" title in the sidebar 2023-09-11 14:17:39 +02:00
Guillaume Gomez
7468af8d66 Add missing "Aliased type" title in the sidebar 2023-09-11 14:17:20 +02:00
bors
55e5c9d705 Auto merge of #115656 - cjgillot:default-relative-spans, r=davidtwco
Enable incremental-relative-spans by default.

This was enabled on nightly in https://github.com/rust-lang/rust/pull/84762.

It has been a while, without obvious bugs. It's time to enable it by default for incremental runs.
2023-09-11 10:46:55 +00:00
bors
5d62ab8981 Auto merge of #115387 - weihanglo:merge-check-and-lint, r=oli-obk
Make unknown/renamed/removed lints passed via command line respect lint levels
2023-09-11 08:56:29 +00:00
Ralf Jung
e68e9d4a14 explain why DispatchFromDyn does the check it does 2023-09-11 10:24:53 +02:00
Oli Scherer
c2e790044c Allow loading the SMIR for constants and statics 2023-09-11 08:14:56 +00:00
bors
7d1e416d32 Auto merge of #115661 - nnethercote:disentangle-Debug-Display, r=compiler-errors
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 `rustc_layout(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 attributes) 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 07:05:18 +00:00
bors
e39976ff89 Auto merge of #115530 - onur-ozkan:update-config-info-comment, r=Mark-Simulacrum
update `build.extended` comments in `config.example.toml`

Fixes #115502
2023-09-11 05:15:43 +00:00
Zalathar
6e968b1e45 coverage: Simplify grouping of mappings by file
This removes an ad-hoc implementation of `group_by`.
2023-09-11 14:29:10 +10:00
Zalathar
1f56fa9657 coverage: Push down the call to get_expressions_and_counter_regions
These expressions and counter regions are only needed by the function that
encodes a function's coverage mappings payload.
2023-09-11 14:29:10 +10:00
Zalathar
99da8a83c2 coverage: Push down creation of the mappings payload buffer
Instead of writing coverage mappings into a supplied `&RustString`, this
function can just create the buffer itself and return the resulting vector of
bytes.
2023-09-11 14:29:10 +10:00
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
bjorn3
238d8e3ec7 Allow testing cg_clif using ./x.py test 2023-09-10 15:56:56 +00: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
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