Commit graph

32606 commits

Author SHA1 Message Date
Lukas Wirth
029261f9cc Cleanup target fetching for cargo metadata 2024-12-24 17:49:07 +01:00
Lukas Wirth
633a10cb58
Merge pull request #18718 from Giga-Bowser/fix-syntaxfactory-intoiterator
internal: Standardize how we take iterator parameters in `SyntaxFactory`
2024-12-24 14:12:52 +00:00
Lukas Wirth
4c0569b244
Merge pull request #18722 from markmurphydev/status_bar_settings
Rename `rust-analyzer.statusBar.documentSelector` to `showStatusBar`, add "always" and "never" options.
2024-12-24 14:12:32 +00:00
Lukas Wirth
c67964884a
Merge pull request #18750 from Veykril/push-tyvtqpwrwvsr
Back out "internal: Disable rustc test metrics"
2024-12-24 09:52:37 +00:00
Lukas Wirth
20d4638774 Back out "internal: Disable rustc test metrics"
This backs out commit d9a08624aa.
2024-12-24 10:37:24 +01:00
Lukas Wirth
9997374b0c Remove dangling outdated test module 2024-12-24 10:37:24 +01:00
Lukas Wirth
2c500e2939
Merge pull request #18749 from PrototypeNM1/windows-debugger-wait
minor: Break out of waiting for debugger on Windows using native debugger check API.
2024-12-24 08:40:56 +00:00
Nicholas Rishel
f8f7d37b8b minor: Break out of waiting for debugger on Windows using native debugger check API.
For Windows, this removes the need to add a breakpoint and modify a value to exit the debugger wait loop.

As a ridealong, this adds a 100ms sleep for all platforms such that waiting for the debugger doesn't hog the CPU thread.
2024-12-23 14:33:26 -08:00
Laurențiu Nicola
80c97cab43
Merge pull request #18746 from lnicola/sync-from-rust
minor: Sync from downstream
2024-12-23 10:12:23 +00:00
Laurențiu Nicola
31ff42d1cb Bump rustc crates 2024-12-23 11:33:26 +02:00
Laurențiu Nicola
a2a5b72c47 Merge from rust-lang/rust 2024-12-23 11:27:07 +02:00
Laurențiu Nicola
b3563be880 Preparing for merge from rust-lang/rust 2024-12-23 11:26:54 +02:00
bors
6fd6f09ab0 Auto merge of #134465 - lcnr:type-verifier, r=compiler-errors
cleanup `TypeVerifier`

We should merge it with the `TypeChecker` as we no longer bail in cases where it encounters an error since #111863.

It's quite inconsistent whether a check lives in the verifier or the `TypeChecker`, so this feels like a quite impactful cleanup. I expect that for this we may want to change the `TypeChecker` to also be a MIR visitor 🤔 this is non-trivial so I didn't fully do it in this PR.

Best reviewed commit by commit.

r? `@compiler-errors` feel free to reassign however
2024-12-23 04:15:41 +00:00
bors
4bb8b8a7bc Auto merge of #131193 - EFanZh:asserts-vec-len, r=the8472
Asserts the maximum value that can be returned from `Vec::len`

Currently, casting `Vec<i32>` to `Vec<u32>` takes O(1) time:

```rust
// See <https://godbolt.org/z/hxq3hnYKG> for assembly output.
pub fn cast(vec: Vec<i32>) -> Vec<u32> {
    vec.into_iter().map(|e| e as _).collect()
}
```

But the generated assembly is not the same as the identity function, which prevents us from casting `Vec<Vec<i32>>` to `Vec<Vec<u32>>` within O(1) time:

```rust
// See <https://godbolt.org/z/7n48bxd9f> for assembly output.
pub fn cast(vec: Vec<Vec<i32>>) -> Vec<Vec<u32>> {
    vec.into_iter()
        .map(|e| e.into_iter().map(|e| e as _).collect())
        .collect()
}
```

This change tries to fix the problem. You can see the comparison here: <https://godbolt.org/z/jdManrKvx>.
2024-12-22 16:09:16 +00:00
Lukas Wirth
fa4a40bbe8
Merge pull request #18742 from Veykril/push-yswvkzmsvqql
fix: Fix flycheck workspace when requested but package was found
2024-12-22 13:42:39 +00:00
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
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