Commit graph

32693 commits

Author SHA1 Message Date
Lukas Wirth
68acbb2019
Merge pull request #18741 from Veykril/push-nuqmzsrrltux
fix: Delay initial flycheck until after build scripts
2024-12-22 13:32:48 +00:00
Lukas Wirth
4a86434cf5 fix: Fix flycheck workspace when requested but package was found 2024-12-22 14:28:17 +01:00
bors
0906bfd2bb Auto merge of #134326 - scottmcm:slice-drop-shim-ptrmetadata, r=saethlin
Use `PtrMetadata` instead of `Len` in slice drop shims

I tried to do a bigger change in #134297 which didn't work, so here's the part I really wanted: Removing another use of `Len`, in favour of `PtrMetadata`.

Split into two commits where the first just adds a test, so you can look at the second commit to see how the drop shim for an array changes with this PR.

Reusing the same reviewer from the last one:
r? BoxyUwU
2024-12-22 13:28:12 +00:00
Lukas Wirth
2e5998a9bf fix: Delay initial flycheck until after build scripts 2024-12-22 14:18:53 +01:00
Lukas Wirth
066284addd
Merge pull request #18738 from Veykril/push-vqxqutskzvvu
fix: Properly check if workspace flychecking is allowed
2024-12-22 12:11:00 +00:00
Lukas Wirth
d67b900edd
Merge pull request #18740 from Veykril/push-tntsvtmtlotw
fix: Fix empty check diagnostics not marking files as changed
2024-12-22 11:52:59 +00:00
Lukas Wirth
8da08e7100 fix: Fix empty check diagnostics not marking files as changed 2024-12-22 12:38:38 +01:00
Lukas Wirth
2f33e85f56
Merge pull request #18739 from Veykril/push-ntpvvqnnovtn
fix: Don't trigger paren wrapping typing handler after idents
2024-12-22 11:22:56 +00:00
Lukas Wirth
1962cae609 fix: Properly check if workspace flychecking is allowed 2024-12-22 12:10:48 +01:00
Lukas Wirth
a7f3265028 fix: Don't trigger paren wrapping typing handler after idents 2024-12-22 12:08:27 +01:00
Lukas Wirth
ca17481170
Merge pull request #18737 from Veykril/push-rslstwynmzpx
minor: Tell the server to stop prior to restarting it
2024-12-22 10:44:27 +00:00
Lukas Wirth
eb32c9f447 minor: Tell the server to stop prior to restarting it 2024-12-22 11:30:18 +01:00
Lukas Wirth
31938dbfdc
Merge pull request #18735 from Veykril/push-rpuxqrzrzvsw
fix: Set `result_id` for `RelatedFullDocumentDiagnosticReport` everywhere
2024-12-22 10:03:25 +00:00
Lukas Wirth
6b5615df46 fix: Set result_id for RelatedFullDocumentDiagnosticReport everywhere 2024-12-22 10:48:57 +01:00
bors
dcf294e3bd Auto merge of #130733 - okaneco:is_ascii, r=scottmcm
Optimize `is_ascii` for `str` and `[u8]` further

Replace the existing optimized function with one that enables auto-vectorization.

This is especially beneficial on x86-64 as `pmovmskb` can be emitted with careful structuring of the code. The instruction can detect non-ASCII characters one vector register width at a time instead of the current `usize` at a time check.

The resulting implementation is completely safe.

`case00_libcore` is the current implementation, `case04_while_loop` is this PR.
```
benchmarks:
    ascii::is_ascii_slice::long::case00_libcore                             22.25/iter  +/- 1.09
    ascii::is_ascii_slice::long::case04_while_loop                           6.78/iter  +/- 0.92
    ascii::is_ascii_slice::medium::case00_libcore                            2.81/iter  +/- 0.39
    ascii::is_ascii_slice::medium::case04_while_loop                         1.56/iter  +/- 0.78
    ascii::is_ascii_slice::short::case00_libcore                             5.55/iter  +/- 0.85
    ascii::is_ascii_slice::short::case04_while_loop                          3.75/iter  +/- 0.22
    ascii::is_ascii_slice::unaligned_both_long::case00_libcore              26.59/iter  +/- 0.66
    ascii::is_ascii_slice::unaligned_both_long::case04_while_loop            5.78/iter  +/- 0.16
    ascii::is_ascii_slice::unaligned_both_medium::case00_libcore             2.97/iter  +/- 0.32
    ascii::is_ascii_slice::unaligned_both_medium::case04_while_loop          2.41/iter  +/- 0.10
    ascii::is_ascii_slice::unaligned_head_long::case00_libcore              23.71/iter  +/- 0.79
    ascii::is_ascii_slice::unaligned_head_long::case04_while_loop            7.83/iter  +/- 1.31
    ascii::is_ascii_slice::unaligned_head_medium::case00_libcore             3.69/iter  +/- 0.54
    ascii::is_ascii_slice::unaligned_head_medium::case04_while_loop          7.05/iter  +/- 0.32
    ascii::is_ascii_slice::unaligned_tail_long::case00_libcore              24.44/iter  +/- 1.41
    ascii::is_ascii_slice::unaligned_tail_long::case04_while_loop            5.12/iter  +/- 0.18
    ascii::is_ascii_slice::unaligned_tail_medium::case00_libcore             3.24/iter  +/- 0.40
    ascii::is_ascii_slice::unaligned_tail_medium::case04_while_loop          2.86/iter  +/- 0.14

```

`unaligned_head_medium` is the main regression in the benchmarks. It is a 32 byte string being sliced `bytes[1..]`.

The first commit can be used to run the benchmarks against the current core implementation.

Previous implementation was done in #74066

---

Two potential drawbacks of this implementation are that it increases instruction count and may regress other platforms/architectures. The benches here may also be too artificial to glean much insight from.
https://rust.godbolt.org/z/G9znGfY36
2024-12-22 02:44:13 +00:00
bors
87cbe7c75a Auto merge of #134268 - lqd:polonius-next, r=jackh726
Foundations of location-sensitive polonius

I'd like to land the prototype I'm describing in the [polonius project goal](https://github.com/rust-lang/rust-project-goals/issues/118). It still is incomplete and naive and terrible but it's working "well enough" to consider landing.

I'd also like to make review easier by not opening a huge PR, but have a couple small-ish ones (the +/- line change summary of this PR looks big, but >80% is moving datalog to a single place).

This PR starts laying the foundation for that work:
- it refactors and collects 99% of the old datalog fact gen, which was spread around everywhere, into a single dedicated module. It's still present at 3 small places (one of which we should revert anyways) that are kinda deep within localized components and are not as easily extractable into the rest of fact gen, so it's fine for now.
- starts introducing the localized constraints, the building blocks of the naive way of implementing the location-sensitive analysis in-tree, which is roughly sketched out in https://smallcultfollowing.com/babysteps/blog/2023/09/22/polonius-part-1/ and https://smallcultfollowing.com/babysteps/blog/2023/09/29/polonius-part-2/ but with a different vibe than per-point environments described in these posts, just `r1@p: r2@q` constraints.
- sets up the skeleton of generating these localized constraints: converting NLL typeck constraints, and creating liveness constraints
- introduces the polonius dual to NLL MIR to help development and debugging. It doesn't do much currently but is a way to see these localized constraints: it's an NLL MIR dump + a dumb listing of the constraints, that can be dumped with `-Zdump-mir=polonius -Zpolonius=next`. Its current state is not intended to be a long-term thing, just for testing purposes -- I will replace its contents in the future with a different approach (an HTML+js file where we can more easily explore/filter/trace these constraints and loan reachability, have mermaid graphs of the usual graphviz dumps, etc).

I've started documenting the approach in this PR, I'll add more in the future. It's quite simple, and should be very clear when more constraints are introduced anyways.

r? `@matthewjasper`

Best reviewed per commit so that the datalog move is less bothersome to read, but if you'd prefer we separate that into a different PR, I can do that (and michael has offered to review these more mechanical changes if it'd help).
2024-12-21 21:15:31 +00:00
bors
518c77c15c Auto merge of #134505 - jieyouxu:boop-compiler-cc, r=clubby789,jieyouxu
Bump compiler `cc` to 1.2.5

- `cc` 1.2.4 contains a fix to address [rustc uses wrong build tools when compiling from MSVC #133794](https://github.com/rust-lang/rust/issues/133794). See <https://github.com/rust-lang/cc-rs/releases/tag/cc-v1.2.4>.
- `cc` 1.2.5 contains a fix to also check linking when testing if certain compiler flags are supported, which fixed an issue that was causing previous compiler `cc` bumps to fail. See <https://github.com/rust-lang/cc-rs/releases/tag/cc-v1.2.5>.

Supersedes #134419.
Fixes #133794.

r? `@clubby789`
2024-12-21 17:58:54 +00:00
bors
20ffb244d6 Auto merge of #134501 - lcnr:member-constraints-yeet, r=oli-obk
handle member constraints directly in the mir type checker

cleaner, faster, easier to change going forward :> fixes #109654

r? `@oli-obk` `@compiler-errors`
2024-12-21 12:37:40 +00:00
Lukas Wirth
fda8b48bd8
Merge pull request #18727 from roife/fix-issue-18704
fix: remove `always!` check for file_id in `runnables`
2024-12-21 07:10:08 +00:00
roife
59e3d6684b fix: only show debug lens with a valid root 2024-12-21 07:03:45 +08:00
roife
693b110e3d fix: remove always! check for file_id in runnables 2024-12-21 07:00:49 +08:00
Mark Murphy
ed0df3094b change config rust-analyzer.statusBar.documentSelector to showStatusBar 2024-12-20 16:41:41 -05:00
Lukas Wirth
a0d9dd861d
Merge pull request #18731 from rust-lang/revert-18670-push-ylomnylswnxm
Revert "internal: Drop proc-macro server support for ~1.66.0 and older toolchains"
2024-12-20 20:06:24 +00:00
Lukas Wirth
c966876f85
Revert "internal: Drop proc-macro server support for ~1.66.0 and older toolchains" 2024-12-20 20:51:09 +01:00
Giga Bowser
2b6e7ce896 internal: Standardize how we take iterator parameters in SyntaxFactory 2024-12-20 12:06:27 -05:00
Chayim Refael Friedman
82896b2cc4 Move ty lowering diagnostic definitions into a separate module
To keep them organized.
2024-12-20 15:34:23 +02:00
Lukas Wirth
f4cafbb678
Merge pull request #18729 from Veykril/push-kyxtnozqzwkn
Clear flycheck diagnostics more granularly
2024-12-20 13:23:31 +00:00
Lukas Wirth
db8660410f Clear all check diagnostics when the workspace changes 2024-12-20 14:09:29 +01:00
Lukas Wirth
4a8eb8c229 Arc the package ids coming from flycheck 2024-12-20 14:09:29 +01:00
Lukas Wirth
7da17fe195 Arc the workspace root flycheck 2024-12-20 14:09:11 +01:00
Lukas Wirth
7aab6a5c12 Clear flycheck diagnostics more granularly 2024-12-20 14:09:11 +01:00
Lukas Wirth
15d2d509d0
Merge pull request #18723 from ChayimFriedman2/tracing-complete
fix: Fix a case where completion was unable to expand a macro
2024-12-20 12:33:25 +00:00
Chayim Refael Friedman
02d47f3a81 Fix a case where completion was unable to expand a macro
Which caused the macros of the popular `tracing` crate to not offer completions.

The reason is rather complicated: it boils down to macro ignoring their input and completion always choosing the first expansion.
2024-12-20 13:14:59 +02:00
Lukas Wirth
f3f8f4c6ad
Merge pull request #18728 from Veykril/push-ozqlrzmqklwt
internal: Split `serde` derive feature into `serde_derive` usage
2024-12-20 11:09:27 +00:00
Lukas Wirth
027daf1686
Merge pull request #18702 from ChayimFriedman2/prep
minor: Use a record struct instead of a tuple for each namespace in `PerNs`
2024-12-20 11:05:49 +00:00
Lukas Wirth
5211972743 internal: Split serde derive feature into serde_derive usage
Ideally we'd not have any dependency pull in the derive feature for faster build times, once that is the case this change would have an actual effect.
See https://github.com/matklad/macro-dep-test/blob/master/README.md for context.
2024-12-20 11:55:02 +01:00
Chayim Refael Friedman
b5486ffc42 Show substitution where hovering over generic things
There are few things to note in the implementation:

First, this is a best-effort implementation. Mainly, type aliases may not be shown (due to their eager nature it's harder) and partial pathes (aka. hovering over `Struct` in `Struct::method`) are not supported at all.

Second, we only need to show substitutions in expression and pattern position, because in type position all generic arguments always have to be written explicitly.
2024-12-20 11:30:19 +02:00
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