Commit graph

32606 commits

Author SHA1 Message Date
Lukas Wirth
e0c11f631e
Merge pull request #18726 from Veykril/push-vyzotyqqtpqs
fix: Reduce applicability of unnecessary_async assist
2024-12-20 07:56:23 +00:00
Lukas Wirth
0be03285f9 fix: Reduce applicability of unnecessary_async assist 2024-12-20 08:41:46 +01:00
bors
6c8cb99c2b Auto merge of #134438 - lqd:const-qualif-bitsets, r=compiler-errors
Use `MixedBitSet`s in const qualif

These analyses' domains should be very homogeneous, having compressed bitmaps on huge cfgs should make a difference (and doesn’t have an impact on the smaller / regular cfgs in our benchmarks).

This is a >40% walltime reduction on [this stress test](https://github.com/Manishearth/icu4x_compile_sample) extracted from a real world ICU case, and a 10x or so max-rss reduction.

cc `@oli-obk` `@RalfJung`

Should help with (or fix) issue #134404.
2024-12-20 04:48:19 +00:00
bors
5a36a75ab8 Auto merge of #134433 - MarcoIeni:ubuntu-22-large-runners, r=Kobzol
ci: use ubuntu-22 for large runners
2024-12-20 01:37:43 +00:00
bors
0c119ade56 Auto merge of #133793 - nnethercote:speed-up-expected_tokens, r=spastorino
Speed up `Parser::expected_tokens`

The constant pushing/clearing of `Parser::expected_tokens` during parsing is slow. This PR speeds it up greatly.

r? `@estebank`
2024-12-19 19:58:57 +00:00
bors
55c1dedde3 Auto merge of #134486 - compiler-errors:drop-for-lint, r=nikomatsakis
Make sure we handle `backwards_incompatible_lint` drops appropriately in drop elaboration

In #131326, a new kind of scheduled drop (`drop_kind: DropKind::Value` + `backwards_incompatible_lint: true`) was added so that we could insert a new kind of no-op MIR statement (`backward incompatible drop`) for linting purposes.

These drops were intended to have *no side-effects*, but drop elaboration code forgot to handle these drops specially and they were handled otherwise as normal drops in most of the code. This ends up being **unsound** since we insert more than one drop call for some values, which means that `Drop::drop` could be called more than once.

This PR fixes this by splitting out the `DropKind::ForLint` and adjusting the code. I'm not totally certain if all of the places I've adjusted are either reachable or correct, but I'm pretty certain that it's *more* correct than it was previously.

cc `@dingxiangfei2009`
r? nikomatsakis

Fixes #134482
2024-12-19 15:58:08 +00:00
Lukas Wirth
fe027d79d2
Merge pull request #18717 from Veykril/push-pomxnvxotwlr
internal: Set `result_id` for pull diagnostics
2024-12-19 15:38:32 +00:00
Lukas Wirth
c1a2955b50 internal: Set result_id for pull diagnostics 2024-12-19 16:24:18 +01:00
bors
6bddae206a Auto merge of #134499 - jieyouxu:rollup-zmaveur, r=jieyouxu
Rollup of 7 pull requests

Successful merges:

 - #133702 (Variants::Single: do not use invalid VariantIdx for uninhabited enums)
 - #134427 (ci: remove duplicate task definition)
 - #134432 (Fix intra doc links not generated inside footnote definitions)
 - #134437 (reduce compiler `Assemble` complexity)
 - #134474 (Forbid overwriting types in typeck)
 - #134477 (move lint_unused_mut into sub-fn)
 - #134491 (Some destructor/drop related tweaks)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-19 11:25:43 +00:00
许杰友 Jieyou Xu (Joe)
b60f0674fd
Rollup merge of #134491 - compiler-errors:dtor-tweaks, r=lqd
Some destructor/drop related tweaks

Two random tweaks I got from investigating some stuff around drops in edition 2024:
1. Use the `TypingEnv` of the mir builder, rather than making it over again.
2. Rename the `id` field from `Scope` to `local_id`, to reflect that it's a local id, and remove the `item_local_id()` accessor which just returned the id field.
2024-12-19 16:48:11 +08:00
许杰友 Jieyou Xu (Joe)
ea28453726
Rollup merge of #134477 - lcnr:move-lint-into-subfn, r=lqd
move lint_unused_mut into sub-fn

also, stop `mem::take`-ing stuff we only use by reference 🤷
2024-12-19 16:48:11 +08:00
许杰友 Jieyou Xu (Joe)
505ab3885b
Rollup merge of #134474 - oli-obk:push-yomnkntvzlxw, r=compiler-errors
Forbid overwriting types in typeck

While trying to figure out some type setting logic in https://github.com/rust-lang/rust/pull/134248 I realized that we sometimes set a type twice. While hopefully that would have been the same type, we didn't ensure that at all and just silently accepted it. So now we reject setting it twice, unless errors are happening, then we don't care.

Best reviewed commit by commit.

No behaviour change is intended.
2024-12-19 16:48:10 +08:00
许杰友 Jieyou Xu (Joe)
5305b0255b
Rollup merge of #134437 - onur-ozkan:improve-compiler-build, r=jieyouxu
reduce compiler `Assemble` complexity

`compile::Assemble` is already complicated by its nature (as it handles core internals like recursive building logic, etc.) and also handles half of `LldWrapper` tool logic for no good reason since it should be done in the build step directly.

This change moves it there to reduce complexity of `compile::Assemble` logic.
2024-12-19 16:48:09 +08:00
许杰友 Jieyou Xu (Joe)
4f1eabf1b1
Rollup merge of #134432 - GuillaumeGomez:intra-doc-in-footnotes, r=notriddle
Fix intra doc links not generated inside footnote definitions

Fixes #132208.

The problem was that we were running the `Footnote` "pass" before the `LinkReplacer` one. Sadly, the change is bigger than it should because we can't specialize the `Iterator` trait implementation, forcing me to add a new type to handle the other `Iterator` kind (the one which still has the `Range`).

r? ``@notriddle``
2024-12-19 16:48:09 +08:00
许杰友 Jieyou Xu (Joe)
d40e2a59a1
Rollup merge of #134427 - MarcoIeni:ci-remove-code-duplication, r=Kobzol
ci: remove duplicate task definition

try-job: x86_64-gnu-llvm-19-1
try-job: x86_64-gnu-llvm-19-2
try-job: x86_64-gnu-llvm-19-3
try-job: x86_64-gnu-llvm-18-1
try-job: x86_64-gnu-llvm-18-2
try-job: x86_64-gnu-llvm-18-3
try-job: i686-gnu-1
try-job: i686-gnu-2
try-job: i686-gnu-nopt-1
try-job: i686-gnu-nopt-2
2024-12-19 16:48:08 +08:00
许杰友 Jieyou Xu (Joe)
e95b48b6d9
Rollup merge of #133702 - RalfJung:single-variant, r=oli-obk
Variants::Single: do not use invalid VariantIdx for uninhabited enums

~~Stacked on top of https://github.com/rust-lang/rust/pull/133681, only the last commit is new.~~

Currently, `Variants::Single` for an empty enum contains a `VariantIdx` of 0; looking that up in the enum variant list will ICE. That's quite confusing. So let's fix that by adding a new `Variants::Empty` case for types that have 0 variants.

try-job: i686-msvc
2024-12-19 16:48:07 +08:00
bors
c6e1649b42 Auto merge of #133328 - nnethercote:simplify-SwitchInt-handling, r=tmiasko
Simplify `SwitchInt` handling

Dataflow handling of `SwitchInt` is currently complicated. This PR simplifies it.

r? `@cjgillot`
2024-12-18 22:57:23 +00:00
Lukas Wirth
27fac08c82
Merge pull request #18715 from aibaars/ungram-asm-option
Fix AsmOption rule in rust.ungram
2024-12-18 14:22:05 +00:00
Lukas Wirth
a229bc8e79
Merge pull request #18716 from Veykril/push-lyxuzrnkmklp
fix: Consider both completion detail fields in to_proto
2024-12-18 14:14:39 +00:00
Lukas Wirth
e89d72056b fix: Consider both completion detail fields in to_proto 2024-12-18 15:00:09 +01:00
Arthur Baars
cb2829eaa7 Fix AsmOption rule in rust.ungram 2024-12-18 14:56:00 +01:00
bors
33a0d73dd2 Auto merge of #134428 - nikic:llvm-19.1.6, r=cuviper
Update to LLVM 19.1.6

Fixes the wasm64 build failure reported at https://github.com/rust-lang/llvm-project/pull/180.
2024-12-18 13:28:28 +00:00
Lukas Wirth
e1b7d77ead
Merge pull request #18714 from Veykril/push-krxvsqwrokwp
fix: Do not ask the client to resolve for non existing label details
2024-12-18 13:24:53 +00:00
Lukas Wirth
683150f4da fix: Do not ask the client ro resolve for non existing label details 2024-12-18 14:03:50 +01:00
Lukas Wirth
d7fa33e2d0
Merge pull request #18713 from Veykril/push-zmmkzspnwxsn
internal: Cleanup label structure of `CompletionItem`
2024-12-18 12:53:07 +00:00
Lukas Wirth
540ada516a internal: Cleanup label structure of CompletionItem 2024-12-18 13:37:21 +01:00
Lukas Wirth
c70b07b3c9
Merge pull request #18711 from Veykril/push-kwurwxttmqwo
Taking a raw ref of a deref is always safe
2024-12-18 10:47:07 +00:00
Lukas Wirth
dfa46292b6 Taking a raw ref of a deref is always safe 2024-12-18 11:32:29 +01:00
Ralf Jung
c858ce132f make no-variant types a dedicated Variants variant 2024-12-18 11:01:54 +01:00
Ralf Jung
d7d08ae95c Variants::Single: do not use invalid VariantIdx for uninhabited enums 2024-12-18 11:00:21 +01:00
Lukas Wirth
cbf3443d8a
Merge pull request #18710 from Veykril/push-oywuruktpozm
Remove salsa from proc-macro server dep tree
2024-12-18 09:38:49 +00:00
Lukas Wirth
3d63140758 Remove salsa from proc-macro server dep tree 2024-12-18 10:24:26 +01:00
bors
c61ffa0706 Auto merge of #134425 - clubby789:cargo-update, r=jieyouxu
Pin `cc` and run `cargo update`

`cc` tends to cause issues with automatic bumps so locking it to be bumped individually when necessary
<details>
<summary>compiler and tools dependencies</summary>

```
    Updating allocator-api2 v0.2.20 -> v0.2.21
    Updating annotate-snippets v0.11.4 -> v0.11.5
    Updating anyhow v1.0.93 -> v1.0.94
    Updating bstr v1.11.0 -> v1.11.1
    Updating chrono v0.4.38 -> v0.4.39
    Updating clap v4.5.21 -> v4.5.23
    Updating clap_builder v4.5.21 -> v4.5.23
    Updating clap_complete v4.5.38 -> v4.5.39
    Updating clap_lex v0.7.3 -> v0.7.4
    Updating colored v2.1.0 -> v2.2.0
    Updating console v0.15.8 -> v0.15.10
    Updating crossbeam-channel v0.5.13 -> v0.5.14
    Updating crossbeam-deque v0.8.5 -> v0.8.6
    Updating crossbeam-utils v0.8.20 -> v0.8.21
    Updating encode_unicode v0.3.6 -> v1.0.0
    Updating fastrand v2.2.0 -> v2.3.0
    Updating home v0.5.9 -> v0.5.11
    Updating js-sys v0.3.74 -> v0.3.76
    Updating libc v0.2.167 -> v0.2.168
    Updating miniz_oxide v0.8.0 -> v0.8.1
    Updating pest v2.7.14 -> v2.7.15
    Updating pest_derive v2.7.14 -> v2.7.15
    Updating pest_generator v2.7.14 -> v2.7.15
    Updating pest_meta v2.7.14 -> v2.7.15
    Updating redox_syscall v0.5.7 -> v0.5.8
    Updating rustc-stable-hash v0.1.0 -> v0.1.1
    Updating rustix v0.38.41 -> v0.38.42
    Updating self_cell v1.0.4 -> v1.1.0
    Updating semver v1.0.23 -> v1.0.24
    Updating serde v1.0.215 -> v1.0.216
    Updating serde_derive v1.0.215 -> v1.0.216
      Adding thiserror v2.0.7
      Adding thiserror-impl v2.0.7
    Updating time v0.3.36 -> v0.3.37
    Updating time-macros v0.2.18 -> v0.2.19
    Updating tokio v1.41.1 -> v1.42.0
    Updating wasm-bindgen v0.2.97 -> v0.2.99
    Updating wasm-bindgen-backend v0.2.97 -> v0.2.99
    Updating wasm-bindgen-macro v0.2.97 -> v0.2.99
    Updating wasm-bindgen-macro-support v0.2.97 -> v0.2.99
    Updating wasm-bindgen-shared v0.2.97 -> v0.2.99
    Updating wasm-encoder v0.221.0 -> v0.221.2
    Updating wasmparser v0.221.0 -> v0.221.2
    Updating wast v221.0.0 -> v221.0.2
    Updating wat v1.221.0 -> v1.221.2
```

</details>

<details>
<summary>library dependencies</summary>

```
    Updating allocator-api2 v0.2.20 -> v0.2.21
    Updating libc v0.2.167 -> v0.2.168
```

</details>

<details>
<summary>rustbook dependencies</summary>

```
    Updating anyhow v1.0.93 -> v1.0.94
    Updating bstr v1.11.0 -> v1.11.1
    Updating chrono v0.4.38 -> v0.4.39
    Updating clap v4.5.21 -> v4.5.23
    Updating clap_builder v4.5.21 -> v4.5.23
    Updating clap_complete v4.5.38 -> v4.5.39
    Updating clap_lex v0.7.3 -> v0.7.4
    Updating fastrand v2.2.0 -> v2.3.0
    Updating js-sys v0.3.74 -> v0.3.76
    Updating libc v0.2.167 -> v0.2.168
    Updating miniz_oxide v0.8.0 -> v0.8.1
    Updating pest v2.7.14 -> v2.7.15
    Updating pest_derive v2.7.14 -> v2.7.15
    Updating pest_generator v2.7.14 -> v2.7.15
    Updating pest_meta v2.7.14 -> v2.7.15
    Updating pulldown-cmark-to-cmark v19.0.0 -> v19.0.1
    Updating redox_syscall v0.5.7 -> v0.5.8
    Updating rustix v0.38.41 -> v0.38.42
    Updating semver v1.0.23 -> v1.0.24
    Updating serde v1.0.215 -> v1.0.216
    Updating serde_derive v1.0.215 -> v1.0.216
      Adding thiserror v2.0.7
      Adding thiserror-impl v2.0.7
    Updating wasm-bindgen v0.2.97 -> v0.2.99
    Updating wasm-bindgen-backend v0.2.97 -> v0.2.99
    Updating wasm-bindgen-macro v0.2.97 -> v0.2.99
    Updating wasm-bindgen-macro-support v0.2.97 -> v0.2.99
    Updating wasm-bindgen-shared v0.2.97 -> v0.2.99
    Removing windows-sys v0.52.0
```

</details>
2024-12-18 09:23:22 +00:00
Lukas Wirth
2780dfd80c
Merge pull request #18708 from ChayimFriedman2/fix-tiny
fix: Fix pretty-printing of `@` patterns
2024-12-18 07:41:09 +00:00
Chayim Refael Friedman
8c8e738636 Fix pretty-printing of @ patterns
It didn't print the `@`.
2024-12-18 01:24:12 +02:00
bors
9321f7efa9 Auto merge of #134376 - jdonszelmann:fix-rustdoc-perf, r=jieyouxu
Try to fix perf regression in rustdoc after hir attributes

Slight performance regression introduced in #131808

r? `@jieyouxu`
2024-12-17 21:34:13 +00:00
bors
e301414581 Auto merge of #134381 - jdonszelmann:move-attribute-types, r=oli-obk
Split up attribute parsing code and move data types to `rustc_attr_data_structures`

This change renames `rustc_attr` to `rustc_attr_parsing`, and splits up the parsing code. At the same time, all the data types used move to `rustc_attr_data_structures`. This is in preparation of also having a third crate: `rustc_attr_validation`

I initially envisioned this as two separate PRs, but I think doing it in one go reduces the number of ways others would have to rebase their changes on this. However, I can still split them.

r? `@oli-obk` (we already discussed how this is a first step in a larger plan)

For a more detailed plan on how attributes are going to change, see https://github.com/rust-lang/rust/issues/131229

Edit: this looks like a giant PR, but the changes are actually rather trivial. Each commit is reviewable on its own, and mostly moves code around. No new logic is added.
2024-12-17 18:50:50 +00:00
bors
a9740c92b9 Auto merge of #130766 - clarfonthey:stable-coverage-attribute, r=wesleywiser
Stabilize #[coverage] attribute

Closes #84605, which passed FCP.

Stabilisation report here: https://github.com/rust-lang/rust/issues/84605#issuecomment-2166514660

Also added to reference here: rust-lang/reference#1628

---

try-job: aarch64-apple
try-job: x86_64-gnu
try-job: x86_64-msvc
2024-12-17 15:56:58 +00:00
bors
8a1d610714 Auto merge of #134302 - bjorn3:remove_driver_queries, r=oli-obk,jieyouxu
Remove queries from the driver interface

All uses of driver queries in the public api of rustc_driver have been removed in https://github.com/rust-lang/rust/pull/134130 already. This removes driver queries from rustc_interface and does a couple of cleanups around TyCtxt construction and entering enabled by this removal.

Finishes the removal of driver queries started with https://github.com/rust-lang/rust/pull/126834.
2024-12-17 04:57:40 +00:00
ltdk
c180e41198 Stabilize #[coverage] attribute 2024-12-16 21:07:06 -05:00
bors
30533cfafb Auto merge of #134132 - MarcoIeni:linux-4c-to-ubuntu-22, r=Kobzol
CI: update linux 4c from ubuntu 20 to ubuntu 22
2024-12-17 01:49:31 +00:00
bors
3fb7f64534 Auto merge of #134095 - Kobzol:datadog-lockfile, r=MarcoIeni
[CI] Use a lockfile for installing the `datadog` package

Without a lockfile, it could fail to compile when the dependencies have changed. Reported [here](https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/CI.20failure.20in.20DataDog.20upload).

r? `@jdno`

try-job: x86_64-msvc-ext2
2024-12-16 23:07:24 +00:00
Lukas Wirth
0a706f7d2a
Merge pull request #18700 from ChayimFriedman2/dyn-send
fix: Fix a panic with a diagnostics fix when a keyword is used as a field
2024-12-16 21:54:28 +00:00
Chayim Refael Friedman
79214583f6 Use a record struct instead of a tuple for each namespace in PerNs
The reason I did this is because I plan to add another field to this struct (indicating whether the item was cfg'ed out), but it seems worthy even separately and removes a bunch of one-letter variable names and tuple-indexing. It is also easy to separate from future changes, so it will be easier to review this way.
2024-12-16 22:39:50 +02:00
Chayim Refael Friedman
8277c0336e Fix a panic with a diagnostics fix when a keyword is used as a field
I found it easiest to fix in the quickfix code, and not deeper (e.g. body lowering).
2024-12-16 19:58:29 +02:00
bors
056cb60f90 Auto merge of #134377 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2024-12-16 13:07:24 +00:00
Lukas Wirth
dc6af80ed0
Merge pull request #18699 from Veykril/push-ltqwwusvtlot
fix: Fix path qualified auto-importing completions not working with re-exports
2024-12-16 12:34:59 +00:00
Lukas Wirth
ada5f2059c fix: Fix path qualified auto-importing completions not working with re-exports
Prior to this commit we used to generate import paths, then zipped them with the existing qualifier to check if they agree on the path to import.
This is brittle when re-exports come into play causing items to have multiple applicable paths that refer to them.
This commit instead rewrites this logic by generating the import path for the qualifier, verifying that the rest of the qualifier resolves and then doing a final lookup on that resolution result for the final segment instead.
2024-12-16 13:20:55 +01:00
Lukas Wirth
65c8d1242b
Merge pull request #18698 from Veykril/push-vpqwrwxptsql
internal: Don't serialize empty fields in completions and resolve payloads
2024-12-16 10:39:19 +00:00
Lukas Wirth
61c222e1af
Merge pull request #18690 from Giga-Bowser/extract-variable-string
feat: Use string literal contents as a name when extracting into variable
2024-12-16 10:29:05 +00:00