Commit graph

17052 commits

Author SHA1 Message Date
bors
b915eb32fa Auto merge of #14427 - davidbarsky:davidbarsky/allow-subsequent-workspaces-to-have-proc-macros, r=Veykril
fix: allow new, subsequent `rust-project.json`-based workspaces to get proc macro expansion

As detailed in https://github.com/rust-lang/rust-analyzer/issues/14417#issuecomment-1485336174, `rust-project.json` workspaces added after the initial `rust-project.json`-based workspace was already indexed by rust-analyzer would not receive procedural macro expansion despite `config.expand_proc_macros` returning true. To fix this issue:
1. I changed `reload.rs` to check which workspaces are newly added.
2. Spawned new procedural macro expansion servers based on the _new_ workspaces.
    1. This is to prevent spawning duplicate procedural macro expansion servers for already existing workspaces. While the overall memory usage of duplicate procedural macro servers is minimal, this is more about the _principle_ of not leaking processes 😅.
3. Launched procedural macro expansion if any workspaces are `rust-project.json`-based _or_ `same_workspaces` is true. `same_workspaces` being true (and reachable) indicates that that build scripts have finished building (in Cargo-based projects), while the build scripts in `rust-project.json`-based projects have _already been built_ by the build system that produced the `rust-project.json`.

I couldn't really think of structuring this code in a better way without engaging with https://github.com/rust-lang/rust-analyzer/issues/7444.
2023-03-30 07:50:27 +00:00
Lukas Wirth
251b3a47af Simplify 2023-03-30 09:21:10 +02:00
Lukas Wirth
e797479651 fix: Handle box and raw pointers correctly in builtin_deref 2023-03-29 21:38:32 +02:00
David Barsky
25c59b8e92 address PR comments 2023-03-29 15:29:32 -04:00
Lukas Wirth
f1f64e92d7 Fix mutability_error::overloaded_index test 2023-03-29 18:07:25 +02:00
Lukas Wirth
798990bf33 fix: Add missing autoborrow adjustment for index expressions 2023-03-29 16:11:48 +02:00
Lukas Wirth
bea1c71f83 Use struct_tail_without_normalization in Expectation::rvalue_hint 2023-03-29 14:49:06 +02:00
bors
7a98e24777 Auto merge of #14431 - Veykril:simplify, r=Veykril
minor: Simplify
2023-03-29 07:28:42 +00:00
bors
0d1ed56bb3 Auto merge of #14430 - Veykril:canonicalize-project-manifest, r=Veykril
fix: Canonicalize rust-project.json manifest path

Looked a bit more into this and I think we can do this after all, I don't see any place where this should break things
cc https://github.com/rust-lang/rust-analyzer/pull/14168 https://github.com/rust-lang/rust-analyzer/pull/14402#issuecomment-1487257246
2023-03-29 07:11:02 +00:00
Lukas Wirth
8ea1afce28 Simplify 2023-03-28 16:32:26 +02:00
David Barsky
e5bfd7ef0a it, uh, turns out that we should be spawning for new servers. oops. 2023-03-28 09:56:01 -04:00
David Barsky
6a42d7f627 fix: allow new, subsequent rust-project.json-based workspaces to get
proc macro expansion.
2023-03-28 09:17:16 -04:00
hkalbasi
d0d4245a74 use FxHashSet instead of FxHashMap 2023-03-28 15:59:16 +03:30
hkalbasi
d5c7ec499a fix stack overflow in is_ty_uninhabited_from 2023-03-28 15:45:35 +03:30
Eclips4
0a2a50a663 Fix typo 2023-03-28 12:32:51 +03:00
bors
5bba438c9c Auto merge of #14366 - Veykril:linked-proj, r=Veykril
feat: Pop a notification prompting the user to add a Cargo.toml of unlinked file to the linkedProjects

cc https://github.com/rust-lang/rust-analyzer/issues/13226 https://github.com/rust-lang/rust-analyzer/issues/9661
2023-03-28 07:05:43 +00:00
bors
f73510560f Auto merge of #14424 - Veykril:local-trait-impls, r=Veykril
fix: Properly handle local trait impls

Before we only handled trait impls that came from the block of either the trait or the target type, we now handle them correctly by tracking the block we are currently inferring from, then walking that up to collect all block trait impls.
2023-03-28 06:36:35 +00:00
Lukas Wirth
342fd2b9f3 fix: Properly handle local trait impls 2023-03-28 08:34:29 +02:00
Daniil Kolesnichenko
be17eab08b fix(rustdoc): don't escape double hashes outside of Rust code blocks
Fixes #14376
2023-03-28 05:32:59 +07:00
Lukas Wirth
f1de133820 Canonicalize rust-project.json manifest path 2023-03-27 21:55:02 +02:00
Lukas Wirth
b03a218b57 fix: Fix proc-macro paths using incorrect CrateId's for rust-project.json workspaces 2023-03-27 17:17:09 +02:00
Lukas Wirth
c04a13cb19 Simplify 2023-03-27 17:16:45 +02:00
Lukas Wirth
ee02213e65 Handle proc macro fetching via OpQueue 2023-03-26 09:33:41 +02:00
bors
82ec4586f1 Auto merge of #14408 - Veykril:intern-block, r=Veykril
internal: Only intern blocks that declare items

We only used `BlockId` for the block defmap, so this is wasted memory. Lowering for non item declaring blocks is also cheaper now as we no longer have to fully lower a block that defines not items.
2023-03-25 19:48:04 +00:00
Lukas Wirth
675fc88afd internal: Only intern blocks that declare items 2023-03-25 20:44:12 +01:00
bors
d1c7984396 Auto merge of #14407 - Veykril:rename-fix, r=Veykril
fix: Fix renames of locals being broken in macro calls

Fixes https://github.com/rust-lang/rust-analyzer/issues/14379
2023-03-25 18:35:13 +00:00
Lukas Wirth
0daf069b0e fix: Fix renames of locals being broken in macro calls 2023-03-25 18:37:18 +01:00
Lukas Wirth
e5f24a6d7c Set proc_macros input when creating the RootDatabase 2023-03-25 18:20:42 +01:00
Lukas Wirth
607375dc20 Load proc-macros asynchronously 2023-03-25 18:06:06 +01:00
Lukas Wirth
e9fb2ffe45 Add lsp command for rebuilding proc macros 2023-03-25 16:50:31 +01:00
Lukas Wirth
d154ea88f9 Split out proc-macros from the CrateGraph 2023-03-25 16:46:44 +01:00
bors
71b23360e7 Auto merge of #14404 - Veykril:proc-macro-loading, r=Veykril
Remove client side proc-macro version check

The server already verifies versions due to ABI picking now so there shouldn't be a need for the client side check anymore
2023-03-25 14:44:53 +00:00
Lukas Wirth
3ae9bfe266 Remove client side proc-macro version check 2023-03-25 15:43:58 +01:00
bors
992a0fc074 Auto merge of #14403 - Veykril:dependencies, r=Veykril
internal: Bump Cargo.lock
2023-03-25 14:15:10 +00:00
Lukas Wirth
39e86e78c3 Bump Cargo.lock 2023-03-25 15:12:39 +01:00
bors
fc848495f4 Auto merge of #14402 - Veykril:project-json-sym-link, r=Veykril
internal: Reject symlinks in project-json

cc https://github.com/rust-lang/rust-analyzer/pull/14168
2023-03-25 13:34:10 +00:00
Lukas Wirth
c01ba4a310 Reject symlinks in project-json 2023-03-25 14:22:05 +01:00
bors
68aa133108 Auto merge of #14380 - DropDemBits:coalesce-indels, r=Veykril
internal: Coalesce adjacent Indels

Originally part of working on a structured snippet API (since sometimes the `$` bit of snippets would be broken off and would lead to it not being recognized), though since this is a pretty separate change, I thought it would make sense to put it into it's own PR.

The implementation is relatively straight forward and not overly optimized, though it's pretty low hanging fruit to optimize it when need be.
2023-03-25 13:16:43 +00:00
bors
3321799e8f Auto merge of #14368 - HKalbasi:mir, r=HKalbasi
MIR episode 3

This PR adds lowering for try operator and overloaded dereference, and adds evaluating support for function pointers and trait objects. It also adds a flag to `analysis-stats` to show percentage of functions that it fails to emit mir for them, which is currently `20%` (which is somehow lying, as most of the supported `80%` are tests). The most offenders are closure (1975 items) and overloaded index (415 items). I will try to add overloaded index before monday to have it in this PR, and tackle the closure in the next episode.
2023-03-21 19:57:27 +00:00
DropDemBits
28225cc33d
internal: Coalesce adjacent Indels 2023-03-21 11:48:32 -04:00
hkalbasi
8a3ad7c3d5 Support evaluating inherent associated constants with generics 2023-03-21 02:20:30 +03:30
hkalbasi
3303a6eff5 Implement some intrinsics 2023-03-20 21:48:01 +03:30
hkalbasi
8e73ea5253 Desugar try blocks 2023-03-19 13:02:51 +03:30
Ryo Yoshida
e12460bbca
Add regression test
so that we can catch regressions when we move away from chalk.
2023-03-19 16:58:10 +09:00
Ryo Yoshida
1d1a86f350
Bump chalk to 0.89 2023-03-19 16:45:26 +09:00
bors
7c05f55f0c Auto merge of #13789 - feniljain:fix_enum_completion, r=Veykril
feat: show only missing variant suggestion for enums in patterns completion and bump them in list too

Fixes #12438

### Points to help in review:

- This PR can be reviewed commit wise, first commit is about bumping enum variant completions up in the list of completions and second commit is about only showing enum variants which are not complete
- I am calculating missing variants in analysis.rs by firstly locating the enum and then comparing each of it's variant's name and checking if arm string already contains that name, this is kinda hacky but I didn't want to implement complete missing_arms assist here as that would have been too bulky to run on each completion cycle ( if we can improve this somehow would appreciate some inputs on it )

### Output:

https://user-images.githubusercontent.com/49019259/208245540-57d7321b-b275-477e-bef0-b3a1ff8b7040.mov

Relevant Zulip Discussion: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Issue.20.2312438
2023-03-18 07:06:27 +00:00
feniljain
a79a76a942 refactor: pass is_variant_missing as args to build_completion 2023-03-18 11:46:22 +05:30
feniljain
f7113685b5 fix: make tests valid rust code 2023-03-18 11:43:45 +05:30
hkalbasi
453ae2e00e Support range MIR lowering 2023-03-18 02:06:36 +03:30
hkalbasi
9ad83deecc Support overloaded index MIR lowering 2023-03-17 19:10:25 +03:30