Commit Graph

1934 Commits

Author SHA1 Message Date
bors
76bcd9946a Auto merge of #15169 - lowr:patch/impl-header-anon-lifetime, r=HKalbasi
Use anonymous lifetime where possible

Because anonymous lifetimes are *super* cool.

More seriously, I believe anonymous lifetimes, especially those in impl headers, reduce cognitive load to a certain extent because they usually signify that they are not relevant in the signature of the methods within (or that we can apply the usual lifetime elision rules even if they are relevant).
2023-06-30 16:57:20 +00:00
Ali Bektas
cfbeb66a63 Purge of unwrap version 2 2023-06-30 16:31:20 +02:00
Ali Bektas
72aeaef5f3 Purge of unwraps 2023-06-30 15:47:17 +02:00
Lukas Wirth
7e7f401a81
Fix panic in handle_code_action 2023-06-30 08:42:46 +02:00
Lukas Wirth
60d046f567
Fix panic in handle_code_action 2023-06-30 08:38:44 +02:00
Ryo Yoshida
4e793e7859
Use anonymous lifetime where possible 2023-06-29 23:27:28 +09:00
bors
ae89ca3fbb Auto merge of #15161 - lowr:patch/fixture-metadata-library, r=Veykril
internal: add `library` fixture meta

Currently, there is no way to specify `CrateOrigin` of a file fixture ([this] might be a bug?). This PR adds `library` meta to explicitly specify the fixture to be `CrateOrigin::Library` and also makes sure crates that belong to a library source root are set `CrateOrigin::Library`.

(`library` isn't really the best name. It essentially means that the crate is outside workspace but `non_workspace_member` feels a bit too long. Suggestions for the better name would be appreciated)

Additionally:
- documents the fixture meta syntax as thoroughly as possible
- refactors relevant code

[this]: 4b06d3c595/crates/base-db/src/fixture.rs (L450)
2023-06-28 15:23:32 +00:00
Ryo Yoshida
d51536c242
Add library fixture meta
Additionally documents the syntax for fixture meta.
2023-06-28 22:34:14 +09:00
bors
891331c74f Auto merge of #15101 - alibektas:14780, r=Veykril
Check Workspace Edit ResourceOps

PR fixes #14780
2023-06-28 09:57:54 +00:00
Lukas Wirth
f8518a6cfa
Update crates/rust-analyzer/src/handlers/request.rs 2023-06-28 11:57:36 +02:00
Ali Bektas
b96796ce5e Minor changes. Add resolve_resource_op() 2023-06-23 19:22:59 +02:00
Ali Bektas
96cebca116 Version 2 2023-06-22 20:29:11 +02:00
hkalbasi
674cd5ab57 Add run-tests command 2023-06-22 19:33:37 +03:30
Ali Bektas
1de842a7ba Check Workspace Edit ResourceOps
Fixes #14780 . This commit introduces guards for checking if the client supports ResourceOperations for operations to use them.
2023-06-21 18:20:22 +02:00
bors
bc26e81cd5 Auto merge of #15070 - Veykril:analysis-stat-stuff, r=Veykril
internal: Report metric timings for file item trees and crate def map creation
2023-06-21 05:58:13 +00:00
Alex Kladov
6303551cb8 internal: use consistent style for error handling 2023-06-19 13:01:47 +01:00
Alex Kladov
49318bbae7 fix: ensure that ws loading error includes path to ws 2023-06-19 12:32:04 +01:00
bors
00b9d9faf4 Auto merge of #15071 - matklad:no-regex, r=matklad
internal: remove spurious regex dependency

- replace tokio's env-filter with a smaller&simpler targets filter
- reshuffle logging infra a bit to make sure there's only a single place where we read environmental variables
- use anyhow::Result in rust-analyzer binary
2023-06-19 10:51:03 +00:00
Alex Kladov
424ef77809 internal: remove spurious regex dependency
- replace tokio's env-filter with a smaller&simpler targets filter
- reshuffle logging infra a bit to make sure there's only a single place
  where we read environmental variables
- use anyhow::Result in rust-analyzer binary
2023-06-18 13:59:32 +01:00
Lukas Wirth
83d7724629 fix: Add binding definition for for-expr iterator desugared binding 2023-06-18 11:44:01 +02:00
Lukas Wirth
a824b734dd Report metric timings for file item trees and crate def map creation 2023-06-17 11:20:21 +02:00
Lukas Wirth
58ac823864 Less eager parsing for module sources 2023-06-17 10:58:52 +02:00
Lukas Wirth
b5e0452c71 Lazy progress reporting 2023-06-17 10:34:44 +02:00
Lukas Wirth
64a8887a94 Add body lowering step, track time of each step separtely 2023-06-17 09:55:48 +02:00
bors
fdba1b6a5c Auto merge of #15066 - Veykril:analysis-stats, r=Veykril
internal: Analyze all bodies in analysis-stats, not just functions
2023-06-17 07:09:50 +00:00
Lukas Wirth
bd762e62df internal: Add more context to overly long loop turn message 2023-06-16 19:31:07 +02:00
Lukas Wirth
76acf3b992 internal: Analyze all bodies in analysis-stats, not just functions 2023-06-16 19:14:46 +02:00
bors
9c967d3809 Auto merge of #15053 - Veykril:crate-root-module-id, r=Veykril
internal: Add a CrateRootModuleId that encodes a module id that is always a crate root
2023-06-14 14:41:06 +00:00
Lukas Wirth
cf178cba8f internal: Add a CrateRootModuleId that encodes a module id that is always a crate root 2023-06-14 15:41:06 +02:00
Lukas Wirth
b322805918 internal: Record file dependencies in crate graph construction 2023-06-13 12:29:24 +02:00
bors
dcd31550e2 Auto merge of #14932 - HKalbasi:dev, r=HKalbasi
Lower const params with a bad id

cc #7434

This PR adds an `InTypeConstId` which is a `DefWithBodyId` and lower const generic parameters into bodies using it, and evaluate them with the mir interpreter. I think this is the last unimplemented const generic feature relative to rustc stable.

But there is a problem: The id used in the `InTypeConstId` is the raw `FileAstId`, which changes frequently. So these ids and their bodies will be invalidated very frequently, which is bad for incremental analysis.

Due this problem, I disabled lowering for local crates (in library crate the id is stable since files won't be changed). This might be overreacting (const generic expressions are usually small, maybe it would be better enabled with bad performance than disabled) but it makes motivation for doing it in the correct way, and it splits the potential panic and breakages that usually comes with const generic PRs in two steps.

Other than the id, I think (at least I hope) other parts are in the right direction.
2023-06-12 08:49:02 +00:00
Lukas Wirth
179b8d7efc
Formatting
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2023-06-11 20:11:26 +02:00
Lukas Wirth
52bb94d697 internal: Give rustfmt jobs a separate thread 2023-06-11 19:56:24 +02:00
hkalbasi
a481e004b0 Lower const params with a bad id 2023-06-11 00:39:28 +03:30
bors
68bdf609f3 Auto merge of #14974 - max-heller:issue-14958, r=lowr
Properly format documentation for `SignatureHelpRequest`s

Properly formats function documentation instead of returning it raw when responding to `SignatureHelpRequest`s.

I added a test in `crates/rust-analyzer/tests/slow-tests/main.rs` -- not sure if this is the best location given the relevant code is in `crates/rust-analyzer` or if it's possible to test in a less heavyweight manner.

Closes #14958
2023-06-10 14:15:37 +00:00
max-heller
78fab7d5d5 format documentation for SignatureHelpRequests 2023-06-10 09:54:34 -04:00
bors
489eeab978 Auto merge of #14960 - jneem:group-delim-span, r=Veykril
Add span to group.

This appears to fix #14959, but I've never contributed to rust-analyzer before and there were some things that confused me:

- I had to add the `fn byte_range` method to get it to build. This was added to rust in [April](https://github.com/rust-lang/rust/pull/109002), so I don't understand why it wasn't needed until now
- When testing, I ran into the fact that rust recently updated its `METADATA_VERSION`, so I had to test this with nightly-2023-05-20. But then I noticed that rust has its own copy of `rust-analyzer`, and the metadata version bump has already been [handled there](60e95e76d0). So I guess I don't really understand the relationship between the code there and the code here.
2023-06-10 11:15:16 +00:00
Lukas Wirth
ccce893577 Count query entries in memory usage command 2023-06-10 01:49:32 +02:00
beyarkay
dac660dc1d Fix typo in reload.rs 2023-06-07 20:57:27 +02:00
Joe Neeman
ad2a0d1093 Add configurable proc-macro-srv path for diagnostics 2023-06-07 08:48:19 -05:00
Lukas Wirth
f9a9e40c0a Update builtin attribute list 2023-06-04 10:02:11 +02:00
Lukas Wirth
a1af9eb1f8
Revert "Add mandatory panic contexts to all threadpool tasks" 2023-06-04 09:30:21 +02:00
Lukas Wirth
2d0510e226 Add mandatory panic contexts to all threadpool tasks 2023-06-04 09:09:25 +02:00
bors
526507fe22 Auto merge of #14888 - lunacookies:multi-qos, r=Veykril
Prioritize threads affected by user typing

To this end I’ve introduced a new custom thread pool type which can spawn threads using each QoS class. This way we can run latency-sensitive requests under one QoS class and everything else under another QoS class. The implementation is very similar to that of the `threadpool` crate (which is currently used by rust-analyzer) but with unused functionality stripped out.

I’ll have to rebase on master once #14859 is merged but I think everything else is alright :D
2023-05-31 10:23:19 +00:00
Lukas Wirth
3c862507b9 Add render configs for memory layout hovers 2023-05-30 18:36:06 +02:00
bors
76d86502f7 Auto merge of #14912 - Veykril:cargo-alltargets, r=Veykril
Don't add --all-targets to runnables for no-std crates

Fixes https://github.com/rust-lang/rust-analyzer/issues/14155
2023-05-30 12:34:28 +00:00
bors
e8dbb8e2e0 Auto merge of #14911 - Veykril:config-cfg, r=Veykril
Allow setting cfgs

Fixes https://github.com/rust-lang/rust-analyzer/issues/14365
2023-05-30 12:00:14 +00:00
Lukas Wirth
bbd9e41606 Don't add --all-targets to runnables for no-std crates 2023-05-28 14:18:44 +02:00
Luna Razzaghipour
6b46095980
Make formatting a latency-sensitive request 2023-05-28 22:10:24 +10:00
Lukas Wirth
cea84427e0 Allow setting cfgs 2023-05-28 13:43:21 +02:00