Commit Graph

28417 Commits

Author SHA1 Message Date
bors
98d768bf75 Auto merge of #17239 - Veykril:metrics-caching, r=Veykril
internal: Key ignoring the job-id in metrics cache
2024-05-15 11:32:48 +00:00
Lukas Wirth
b5fbde7f1c Key ignoring the job-id in metrics cache 2024-05-15 13:31:11 +02:00
bors
38640806cc Auto merge of #17238 - Veykril:metrics-caching, r=Veykril
Fix metrics workflow not actually updating the toolchain

The install won't persist across jobs
2024-05-15 10:57:26 +00:00
Lukas Wirth
9db0b656e8 Fix metrics workflow not actually updating the toolchain 2024-05-15 12:54:24 +02:00
bors
d5878844a8 Auto merge of #17235 - Veykril:metrics-caching, r=Veykril
internal: Use Swatinem/rust-cache for metrics CI

Current metrics caching uses a base cache action, whereas I think the one we use for general ci works here as well. Saw this while noticing that our metrics CI is broken as it for some reason uses an outdated rust stable? (unsure why that is)
2024-05-15 09:36:33 +00:00
Lukas Wirth
2e0f2a23a4 Bump Swatinem/rust-cache 2024-05-15 09:50:34 +02:00
Lukas Wirth
4b2998d4c5 Use Swatinem/rust-cache for metrics CI 2024-05-15 09:49:42 +02:00
bors
f915c94f38 Auto merge of #17232 - Veykril:build-scripts-keep-going, r=Veykril
fix: Don't emit --keep-going for custom build script commands

Might be the cause for https://github.com/rust-lang/rust-analyzer/issues/17231
2024-05-14 19:28:22 +00:00
Lukas Wirth
dd0ea024d4 fix: Don't emit --keep-going for custom build script commands 2024-05-14 21:26:37 +02:00
bors
652426ce65 Auto merge of #17216 - Young-Flash:mod_with_path, r=Veykril
fix: extract mod to file should respect path attribute

close https://github.com/rust-lang/rust-analyzer/issues/17181
2024-05-14 14:29:00 +00:00
bors
473b262b6c Auto merge of #17227 - Veykril:build-deps-changed-hashes, r=Veykril
fix: Hash file contents to verify whether file actually changed

Fixes https://github.com/rust-lang/rust-analyzer/issues/16580
2024-05-14 10:48:18 +00:00
bors
d580944f7e Auto merge of #17228 - Veykril:stable-runnables-order, r=Veykril
internal: Sort computed runnables

Fixes https://github.com/rust-lang/rust-analyzer/issues/17223
2024-05-14 10:35:10 +00:00
Lukas Wirth
e32a0a6acc internal: Sort computed runnables 2024-05-14 12:32:48 +02:00
Lukas Wirth
32827d21d8 Hash file contents to verify whether file actually changed 2024-05-14 11:55:12 +02:00
bors
24cd4439ce Auto merge of #17225 - Veykril:expand-macro-interlocked, r=Veykril
Expand macro recursively expands both fp-like and attribute macros when intertwined
2024-05-14 09:22:04 +00:00
Lukas Wirth
13770a2fb0 Track hashes for file contents 2024-05-14 11:21:04 +02:00
bors
b0ecc29a54 Auto merge of #17224 - Veykril:lock-bump, r=Veykril
Bump Cargo.lock
2024-05-14 08:59:34 +00:00
Lukas Wirth
5fa2b06819 Expand macro recursively expands both fp-like and attribute macros intertwined 2024-05-14 10:58:18 +02:00
Lukas Wirth
fc71d49bc1 Bump Cargo.lock 2024-05-14 10:57:02 +02:00
bors
d891ec697a Auto merge of #17221 - Veykril:lazier-validation, r=Veykril
internal: Lazier macro parse tree validation
2024-05-13 15:16:46 +00:00
Lukas Wirth
f1aa040ef6 parse_macro_expansion_error almost never contains values so Option it 2024-05-13 17:02:08 +02:00
Lukas Wirth
490994f9fb Push macro-parsing error calculation out of fundamental queries 2024-05-13 16:56:26 +02:00
bors
6e0c33d1ba Auto merge of #17220 - Veykril:hov-lit, r=Veykril
fix: Improve confusing literal hovers
2024-05-13 10:58:29 +00:00
Lukas Wirth
3e510eb147 Don't render multi-line literal values 2024-05-13 12:56:02 +02:00
Lukas Wirth
60ed071ecc Render literal escaping errors in hovers 2024-05-13 12:51:57 +02:00
bors
197856dca5 Auto merge of #17203 - kilpkonn:collapse_terms, r=Veykril
Fix OOM caused by term search

The issue came from multi Cartesian product for exprs with many (25+) arguments, each having multiple options.
The solution is two fold:
### Avoid blowing up in Cartesian product
**Before the logic was:**
    1. Find expressions for each argument/param - there may be many
    2. Take the Cartesian product (which blows up in some cases)
    4. If there are more than 2 options throw them away by squashing them to `Many`
**Now the logic is:**
    1. Find expressions for each argument/param and squash them to `Many` if there are more than 2 as otherwise we are guaranteed to also have more than 2 after taking the product which means squashing them anyway.
    2. Take the Cartesian product on iterator
    3. Start consuming it one by one
    4. If there are more than 2 options throw them away by squashing them to `Many`  (same as before)

This is also why I had to update some tests as the expressions get squashed to many more eagerly.

### Use fuel to avoid long search times and high memory usage
Now all the tactics use `should_continue:  Fn() -> bool` to chech if they should keep iterating _(Similarly to chalk)_.
This reduces the search times by a magnitude, for example from ~139ms/hole to ~14ms/hole for `ripgrep` crate.
There are slightly less expressions found, but I think speed gain worth it for usability.
Also note that syntactic hits decreases more because of squashing so you simple need to run search multiple times to get full terms.
Also the worst case time (For example `nalgebra` crate cus it has tons of generics) has search times mostly under 200ms.

Benchmarks on `ripgrep` crate
Before:
```
Tail Expr syntactic hits: 291/1692 (17%)
Tail Exprs found: 1253/1692 (74%)
Term search avg time: 139ms
````
After:
```
Tail Expr syntactic hits: 239/1692 (14%)
Tail Exprs found: 1226/1692 (72%)
Term search avg time: 14ms
```
2024-05-13 10:30:12 +00:00
Lukas Wirth
a73973934f Fix literal hovers being confusing and wrong for floats 2024-05-13 12:26:45 +02:00
bors
03f935d4c1 Auto merge of #17188 - szabgab:patch-1, r=Veykril
use the repository field to link to the repository
2024-05-13 10:16:45 +00:00
bors
9e20f4bf0e Auto merge of #17187 - roife:fix-issue-17185, r=Veykril
fix: keep parentheses when the precedence of inner expr is lower than the outer one

fix #17185

Additionally, this PR simplifies some code in `apply_demorgan`.
2024-05-13 10:03:40 +00:00
bors
6a3556b779 Auto merge of #17195 - Veykril:unsafe-attr, r=Veykril
Implement unsafe attribute parsing
2024-05-13 09:50:52 +00:00
Young-Flash
de58ddfd0f test: add test case extract_with_specified_path_attr 2024-05-12 11:48:17 +08:00
Young-Flash
fafcc77855 fix: extract mod to file should respect path attribute 2024-05-12 11:48:17 +08:00
bors
48bcef3a32 Auto merge of #17208 - Wilfred:log_error_from_threads, r=Veykril
fix: Report both IO errors and main_loop errors

If rust-analyzer receives a malformed LSP request, the IO thread terminates with a meaningful error, but then closes the channel.

Once the channel has closed, the main_loop also terminates, but it only has RecvError and can't show a meaningful error. As a result, rust-analyzer would incorrectly claim that the client forgot to shutdown.

```
$ buggy_lsp_client | rust-analyzer
Error: client exited without proper shutdown sequence
```

Instead, include both error messages when the server shuts down.
2024-05-09 11:59:04 +00:00
bors
85b17d4e11 Auto merge of #17207 - Wilfred:serde_invalid_data, r=lnicola
fix: Report all LSP protocol errors with invalid_data

Previously we did not use invalid_data for serde errors, making it harder to understand errors when the client sends malformed data to the server.
2024-05-09 09:44:40 +00:00
Wilfred Hughes
a3ed9fe955 fix: Report both IO errors and main_loop errors
If rust-analyzer receives a malformed LSP request, the IO thread
terminates with a meaningful error, but then closes the channel.

Once the channel has closed, the main_loop also terminates, but it
only has RecvError and can't show a meaningful error. As a result,
rust-analyzer would incorrectly claim that the client forgot to
shutdown.

```
$ buggy_lsp_client | rust-analyzer
Error: client exited without proper shutdown sequence
```

Instead, include both error messages when the server shuts down.
2024-05-08 16:53:30 -07:00
Wilfred Hughes
8ca11468fb fix: Report all LSP protocol errors with invalid_data
Previously we did not use invalid_data for serde errors, making it
harder to understand errors when the client sends malformed data to
the server.
2024-05-08 16:08:00 -07:00
Tavo Annus
8ef19e777a Make term search fuel configurable 2024-05-08 19:46:33 +03:00
Tavo Annus
f9f1d3140f Use unit of work as fuel instead of time 2024-05-07 22:13:27 +03:00
bors
24ef42aafc Auto merge of #17192 - roife:fix-issue-17179, r=lnicola
Fix source_range for INT_NUMBER in completion

fix #17179.

Previously r-a use `TextRange::empty(self.position.offset)` as `source_range` for `INT_NUMBER`, so the `text_edit` would always be an insertion, which results in #17179.

This PR changed it by using `text_range` of `original_token` (same as `IDENT`).
2024-05-07 07:24:15 +00:00
Tavo Annus
9785dcc317 Add time based fuel to term search 2024-05-06 22:13:09 +03:00
Tavo Annus
1e2738b723 Collapse term search exprs before Cartesian product to avoid OOM 2024-05-06 20:29:34 +03:00
Lukas Wirth
58d58afa5f Implement unsafe attribute parsing 2024-05-06 12:11:29 +02:00
roife
88a0df9d82 Fix source_range for INT_NUMBER in completion 2024-05-06 11:50:05 +08:00
bors
c50b357efe Auto merge of #17190 - dfireBird:dyn_trait_with_lifetimes_in_rpit, r=Veykril
Fix: Lifetime's Bound Var Debrujin Index in Dyn Traits

Surely fixes #17182

I have tried running the analysis-stats in some of the repos mentioned in #17080. No panic in almost all of them.
2024-05-05 19:20:35 +00:00
dfireBird
4de215ad63
fix lifetime bound var index in dyn trait 2024-05-05 23:40:34 +05:30
roife
723467b264 tests: update test in assist apply_demorgan 2024-05-05 23:44:52 +08:00
Gábor Szabó
26456e6238
use the repository field to link to the repository 2024-05-05 17:59:27 +03:00
roife
85bcced1e9 fix: keep parentheses when the precedence of inner expr is lower than the outer one 2024-05-05 21:39:26 +08:00
bors
fb230553d8 Auto merge of #17180 - lnicola:bump-gh-pages, r=lnicola
minor: bump `peaceiris/actions-gh-pages`
2024-05-03 17:26:34 +00:00
Laurențiu Nicola
1f199fe17c Bump peaceiris/actions-gh-pages 2024-05-03 20:23:50 +03:00