Commit Graph

1256 Commits

Author SHA1 Message Date
Florian Diebold
c80c34867f Improve proc macro errors a bit
Distinguish between
 - there is no build data (for some reason?)
 - there is build data, but the cargo package didn't build a proc macro dylib
 - there is a proc macro dylib, but it didn't contain the proc macro we expected
 - the name did not resolve to any macro (this is now an
 unresolved_macro_call even for attributes)

I changed the handling of disabled attribute macro expansion to
immediately ignore the macro and report an unresolved_proc_macro,
because otherwise they would now result in loud unresolved_macro_call
errors. I hope this doesn't break anything.

Also try to improve error ranges for unresolved_macro_call / macro_error
by reusing the code for unresolved_proc_macro. It's not perfect but
probably better than before.
2022-06-24 13:45:19 +02:00
Lukas Wirth
76ae5434fa internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
Lukas Wirth
0cf677ab42 internal: Update dashmap and freeze its version 2022-06-10 16:19:52 +02:00
Brennan Vincent
364dd5ff89 Fix build on OpenBSD (and probably other BSDs too)
notify-5.0.0-pre.14 does not build on these systems; this was fixed in
41a74f0e98 , which landed in pre.15.
2022-05-22 17:04:57 -04:00
Aleksey Kladov
e64ccddcc7 ⬆️ deps 2022-05-19 17:08:18 +01:00
Aleksey Kladov
57cb65bb7a internal: vendor lsp-server 2022-05-14 21:15:43 +01:00
Aleksey Kladov
59dcb63309 ⬆️ deps 2022-05-03 11:57:40 +01:00
Peh
1f011fa4a3 style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
Laurențiu Nicola
c7396a5c64 Downgrade kqueue to fix NetBSD 2022-04-30 19:02:24 +03:00
Lukas Wirth
4255996965 Re-export FxHashMap and FxHashSet from ide_db 2022-04-25 18:51:59 +02:00
Lukas Wirth
8154365b00 minor: Remove either dependency from ide_completion 2022-04-25 18:40:38 +02:00
Laurențiu Nicola
117f902d55 Bump deps 2022-04-17 19:36:08 +03:00
Lukas Wirth
e2f1a9a558 feat: Attempt to format expand_macro output with rustfmt if possible 2022-04-17 13:33:39 +02:00
Laurențiu Nicola
5901eddb02 Bump chalk 2022-04-12 20:10:10 +03:00
Lukas Wirth
2d445de170 minor: bump lsp-server version 2022-04-09 00:13:47 +02:00
Jonas Schievink
c71c30419c Use bitflags for FnFlags 2022-04-07 16:22:34 +02:00
Laurențiu Nicola
85f797f59c Bump chalk 2022-03-27 10:11:02 +03:00
Lukas Wirth
8e91bb7660 minor: Bump dependencies 2022-03-22 17:42:24 +01:00
Laurențiu Nicola
86b1ef9ab2 Bump deps 2022-03-17 19:24:37 +02:00
Laurențiu Nicola
be6d5001e4 Bump xshell and fix dist 2022-03-17 08:53:33 +02:00
bors[bot]
83575c96ed
Merge #11700
11700: ⬆️ xshell r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2022-03-14 15:02:34 +00:00
Aleksey Kladov
56e43c34e7 ⬆️ xshell 2022-03-14 14:57:24 +00:00
hkalbasi
b301b040f5 Add const generics 2022-03-14 14:38:37 +03:30
Lukas Wirth
a9dd606387 fix: Show what file paths were expected for unresolved modules 2022-03-11 17:08:30 +01:00
Lukas Wirth
533f178a52 minor: Access parser internals through ide_db for ide crates 2022-03-10 17:07:28 +01:00
Lukas Wirth
c0d6471143 fix: Recognize Self as a proper keyword 2022-03-05 23:20:06 +01:00
bors[bot]
8f504dc873
Merge #11598
11598: feat: Parse destructuring assignment r=Veykril a=ChayimFriedman2

Part of #11532.

Lowering is not as easy and may not even be feasible right now as it requires generating identifiers: `(a, b) = (b, a)` is desugared into
```rust
{
    let (<gensym_a>, <gensym_b>) = (b, a);
    a = <gensym_a>;
    b = <gensym_b>;
}
```

rustc uses hygiene to implement that, but we don't support hygiene yet.

However, I think parsing was the main problem as lowering will just affect type inference, and while `{unknown}` is not nice it's much better than a syntax error.

I'm still looking for the best way to do lowering, though.

Fixes #11454.

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
2022-03-05 11:31:29 +00:00
Chayim Refael Friedman
d9f0731bd2 Parse destructuring assignment
The only patterns we should parse are `..` in structs and `_`: the rest are either not supported or already valid expressions.
2022-03-02 01:51:25 +00:00
Moritz Vetter
96c16bc382 redirct: use iterators and knowledge about preordered arrays for more efficient merging 2022-02-28 05:56:51 +01:00
Chayim Refael Friedman
9881614db1 Upgrade ungrammar to 1.15.0 2022-02-21 08:34:36 +02:00
bors[bot]
02904e99ac
Merge #11464
11464: minor: Bump deps r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-02-13 16:15:37 +00:00
Laurențiu Nicola
60c698bbcf Bump deps 2022-02-13 18:14:49 +02:00
bors[bot]
7a17fb9c43
Merge #11444
11444: feat: Fix up syntax errors in attribute macro inputs to make completion work more often r=flodiebold a=flodiebold

This implements the "fix up syntax nodes" workaround mentioned in #11014. It isn't much more than a proof of concept; I have only implemented a few cases, but it already helps quite a bit.

Some notes:
 - I'm not super happy about how much the fixup procedure needs to interact with the syntax node -> token tree conversion code (e.g. needing to share the token map). This could maybe be simplified with some refactoring of that code.
 - It would maybe be nice to have the fixup procedure reuse or share information with the parser, though I'm not really sure how much that would actually help.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2022-02-12 12:48:46 +00:00
Laurențiu Nicola
50a1319f46 Bump lsp-types 2022-02-09 09:22:25 +02:00
Laurențiu Nicola
c8f056a6db Revert "Revert "Bump dashmap""
This reverts commit 39674cd350.
2022-02-09 09:19:57 +02:00
Laurențiu Nicola
bde624d5ab Bump deps 2022-02-09 09:14:55 +02:00
Florian Diebold
1b5cd03a37 Actually check in fixup.rs 2022-02-07 20:30:28 +01:00
Moritz Vetter
ba2ef69c79 Bump pulldown-cmark-to-cmark, adjust usages and fix test 2022-02-06 09:04:06 +01:00
Laurențiu Nicola
d0f371c80b Bump thread_local 2022-02-05 16:19:08 +02:00
Laurențiu Nicola
145e88ddfe Update lockfile 2022-02-05 16:17:12 +02:00
Laurențiu Nicola
39674cd350 Revert "Bump dashmap"
This reverts commit 485f318b70.
2022-02-05 16:15:56 +02:00
bors[bot]
2cb85c14b6
Merge #11281
11281: ide: parallel prime caches r=jonas-schievink a=jhgg

cache priming goes brrrr... the successor to #10149

---

this PR implements a parallel cache priming strategy that uses a topological work queue to feed a pool of worker threads the crates to index in parallel.

## todo
- [x] should we keep the old prime caches?
- [x] we should use num_cpus to detect how many cpus to use to prime caches. should we also expose a config for # of worker CPU threads to use?
- [x] something is wonky with cancellation, need to figure it out before this can merge. 

Co-authored-by: Jake Heinz <jh@discordapp.com>
2022-01-25 16:03:35 +00:00
Laurențiu Nicola
bdfdb525bb Bump chalk 2022-01-21 19:51:21 +02:00
Laurențiu Nicola
e3e6133ff4 Bump pulldown-cmark and pulldown-cmark-to-cmark 2022-01-21 19:49:57 +02:00
Laurențiu Nicola
09fb755432 Bump hashbrown 2022-01-21 19:44:03 +02:00
Laurențiu Nicola
485f318b70 Bump dashmap 2022-01-21 19:42:04 +02:00
Jake Heinz
c3f30ae4f0 removed scoped threads, cleanup 2022-01-14 10:06:28 +00:00
Jake Heinz
f83c0166be cleanup + detect num cpus 2022-01-14 09:48:59 +00:00
Jake Heinz
3168148cc6 ide: parallel prime caches 2022-01-14 09:16:35 +00:00
Aleksey Kladov
b360ea91f2 internal: move inline parser tests to parser crate 2021-12-26 18:19:09 +03:00
Aleksey Kladov
5d01f2550d ⬆️ expect test 2021-12-25 17:41:17 +03:00
Dawer
deb05930ef internal: Sync match checking algorithm with rustc
Original version: rust-lang/rust  68b76a483 2021-10-01
2021-12-20 00:10:01 +05:00
Laurențiu Nicola
c9ca77f641 Bump object 2021-12-19 19:00:42 +02:00
Laurențiu Nicola
32b6f103a6 Bump chalk 2021-12-19 18:58:39 +02:00
Laurențiu Nicola
e687e53695 Bump deps 2021-12-19 18:44:18 +02:00
Aleksey Kladov
a022ad68c9 internal: move all the lexing to the parser crate 2021-12-18 17:20:38 +03:00
Aleksey Kladov
7e99864dbf move lexing to the parser crate 2021-12-18 14:55:20 +03:00
Laurențiu Nicola
8782e8e704 Bump deps 2021-12-12 13:10:21 +02:00
bors[bot]
48cd733c9e
Merge #10956 #10986
10956: minor: Bump deps r=Veykril a=lnicola

bors r+

10986: fix: Fix lint completions not working for unclosed attributes r=Veykril a=Veykril

Fixes #10682
Uses keywords and nested `TokenTree`s as a heuristic to figure out when to stop parsing in case the attribute is unclosed which should work pretty well as attributes are usually followed by either of those.
bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-11 14:58:07 +00:00
bors[bot]
9946def7e2
Merge #10877
10877: feat: make hightlighting linear r=matklad a=matklad

In https://youtu.be/qvIZZf5dmTE, we've noticed that AstIdMap does a
linear lookup when going from SyntaxNode to Id. This leads to
accidentally quadratic overall performance. Replace linear lookup with a
O(1) hashmap lookup.

Future work: don't duplicate `SyntaxNodePtr` in `AstIdMap` and switch to
"call site dependency injection" style storage (eg, store a
`HashSet<ErasedFileAstId>`).

See the explanation of the work here on YouTube :-)

As you can see from then benchmark results, this doesn't actually make analysis stats fastre. I am a bit mystified as to why this is happening to be honest. 

Baseline
```
Database loaded:     598.40ms, 304minstr, 118mb (metadata 390.57ms, 21minstr, 841kb; build 111.31ms, 8764kinstr, -214kb)
  crates: 39, mods: 824, decls: 18647, fns: 13910
Item Collection:     9.70s, 75ginstr, 377mb
  exprs: 382426, ??ty: 387 (0%), ?ty: 285 (0%), !ty: 145
Inference:           43.16s, 342ginstr, 641mb
Total:               52.86s, 417ginstr, 1018mb
```

This PR:
```
Database loaded:     626.34ms, 304minstr, 118mb (metadata 416.26ms, 21minstr, 841kb; build 113.67ms, 8750kinstr, -209kb)
  crates: 39, mods: 824, decls: 18647, fns: 13910
Item Collection:     10.16s, 75ginstr, 389mb
  exprs: 382426, ??ty: 387 (0%), ?ty: 285 (0%), !ty: 145
Inference:           44.51s, 342ginstr, 644mb
Total:               54.67s, 417ginstr, 1034mb
```

I think we probably should merge the first commit here, but not the second. 

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-12-11 14:49:29 +00:00
Aleksey Kladov
278e7c3311 more frugal map 2021-12-11 17:49:09 +03:00
Laurențiu Nicola
9a624abc84 Bump deps 2021-12-07 13:15:14 +02:00
Laurențiu Nicola
3678cbd12e Bump tracing 2021-12-06 20:54:45 +02:00
Laurențiu Nicola
f5db6e0e95 Bump parser step limit a little 2021-12-06 11:47:36 +02:00
Aleksey Kladov
4f3fc6fa1a try to optimize things unsuccessfully
Baseline
```
Database loaded:     598.40ms, 304minstr, 118mb (metadata 390.57ms, 21minstr, 841kb; build 111.31ms, 8764kinstr, -214kb)
  crates: 39, mods: 824, decls: 18647, fns: 13910
Item Collection:     9.70s, 75ginstr, 377mb
  exprs: 382426, ??ty: 387 (0%), ?ty: 285 (0%), !ty: 145
Inference:           43.16s, 342ginstr, 641mb
Total:               52.86s, 417ginstr, 1018mb
```

Eager
```
Database loaded:     625.86ms, 304minstr, 118mb (metadata 414.52ms, 21minstr, 841kb; build 113.81ms, 8764kinstr, -230kb)
  crates: 39, mods: 824, decls: 18647, fns: 13910
Item Collection:     10.09s, 75ginstr, 389mb
  exprs: 382426, ??ty: 387 (0%), ?ty: 285 (0%), !ty: 145
Inference:           43.27s, 341ginstr, 644mb
Total:               53.37s, 417ginstr, 1034mb
```

Lazy
```
Database loaded:     626.34ms, 304minstr, 118mb (metadata 416.26ms, 21minstr, 841kb; build 113.67ms, 8750kinstr, -209kb)
  crates: 39, mods: 824, decls: 18647, fns: 13910
Item Collection:     10.16s, 75ginstr, 389mb
  exprs: 382426, ??ty: 387 (0%), ?ty: 285 (0%), !ty: 145
Inference:           44.51s, 342ginstr, 644mb
Total:               54.67s, 417ginstr, 1034mb
```
2021-12-05 15:32:39 +03:00
Laurențiu Nicola
bff377c712 Clean up some unused cross-crate dependencies 2021-12-05 13:54:49 +02:00
Laurențiu Nicola
b7368d34a6 Bump pulldown-cmark-to-cmark 2021-12-04 15:21:04 +02:00
Laurențiu Nicola
076f2247f2 Bump miow 2021-12-04 15:17:30 +02:00
Laurențiu Nicola
f2a1082c84 Bump countme 2021-12-04 15:14:31 +02:00
Laurențiu Nicola
26aba38168 Bump chalk 2021-12-04 15:08:43 +02:00
Laurențiu Nicola
89a1256f9a Bump most deps 2021-12-04 15:08:37 +02:00
Lukas Wirth
92f7db447c minor: Lift out FxIndex{Map/Set} types into ide_db 2021-11-16 12:15:47 +01:00
Laurențiu Nicola
e98b072da7 Bump chalk 2021-11-09 20:05:04 +02:00
Laurențiu Nicola
eb879ee06c Bump libc and paste 2021-11-09 20:03:48 +02:00
Laurențiu Nicola
d18a379c7b Bump deps 2021-11-06 17:40:38 +02:00
Laurențiu Nicola
80f9afa1ec Bump object avoid a duplicate dependency 2021-10-30 09:02:45 +03:00
bors[bot]
103bef178c
Merge #10650
10650: minor: Bump deps r=lnicola a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-10-29 20:27:51 +00:00
Laurențiu Nicola
d0a99ad54e Bump chalk 2021-10-29 23:26:59 +03:00
Laurențiu Nicola
79d3f61590 Bump some deps 2021-10-29 23:26:58 +03:00
Lukas Wirth
ebd63ec1cf feat: Make unqualified derive attributes flyimportable 2021-10-29 14:51:26 +02:00
bors[bot]
11326a6847
Merge #10387
10387: Move `IdxRange` into la-arena r=Veykril a=arzg

Currently, `IdxRange` (named `IdRange`) is located in `hir_def::item_tree`, when really it isn’t specific to `hir_def` and could become part of la-arena. The rename from `IdRange` to `IdxRange` is to maintain consistency with the naming convention used throughout la-arena (`Idx` instead of `Id`, `RawIdx` instead of `RawId`). This PR also adds a few new APIs to la-arena on top of `IdxRange` for convenience, namely:

- indexing into an `Arena` by an `IdxRange` and getting a slice of values back
- creating an `IdxRange` from an inclusive range

Currently this PR also exposes a new `Arena::next_idx` method to make constructing inclusive`IdxRange`s using `IdxRange::new` easier; however, it would in my opinion be better to remove this as it allows for easy creation of out-of-bounds `Idx`s, when `IdxRange::new_inclusive` mostly covers the same use-case while being less error-prone.

I decided to bump the la-arena version to 0.3.0 from 0.2.0 because adding a new `Index` impl for `Arena` turned out to be a breaking change: I had to add a type hint in `crates/hir_def/src/body/scope.rs` when one wasn’t necessary before, since rustc couldn’t work out the type of a closure parameter now that there are multiple `Index` impls. I’m not sure whether this is the right decision, though. 

Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
2021-10-20 20:54:36 +00:00
bors[bot]
dfa355b431
Merge #10588
10588: internal: Parse const trait bounds r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10582
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-19 12:32:30 +00:00
Lukas Wirth
b219a4c465 internal: Parse const trait bounds 2021-10-19 14:20:00 +02:00
Laurențiu Nicola
edb03ad6f1 Pull in new lsp-types for VS compat 2021-10-18 12:03:49 +03:00
Jeremy Kolb
14ddc3353e Update crates 2021-10-15 07:12:30 -04:00
Aramis Razzaghipour
dce5c640f8
Move IdxRange into la_arena 2021-10-15 13:03:28 +11:00
bors[bot]
1cca1fa5bf
Merge #10525
10525: Regenerate lints and features r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-12 07:56:00 +00:00
Lukas Wirth
ed7c2948b3 Move lint source generator 2021-10-12 08:59:39 +02:00
Alex Muscar
41856e2682 fix: make signature info response conform to spec
This addreses
https://github.com/rust-analyzer/rust-analyzer/issues/10464.

This patch picks up `lsp-types` 0.90.1, which serialises the
`SignatureInformation` and `ParameterInformation` with the right casing.
It also adds `activeSignature` field as part of the top-level signature
response. It keeps `activeParameter` at the top-level for backwards
compatibility.
2021-10-11 20:42:16 +01:00
Aleksey Kladov
afacdd612d internal: update expect 2021-10-09 17:17:16 +03:00
Jonas Schievink
f8acae7895 Support let...else 2021-10-07 17:06:24 +02:00
bors[bot]
f30b62b751
Merge #10479
10479: fix: fix "index out of bounds" panic in name resolution r=jonas-schievink a=jonas-schievink

Closes https://github.com/rust-analyzer/rust-analyzer/issues/10084
Closes https://github.com/rust-analyzer/rust-analyzer/issues/9163

This is really just a salsa update to a version that removes the problematic code (see https://github.com/rust-analyzer/rust-analyzer/issues/10084#issuecomment-934445711)

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-10-06 20:54:27 +00:00
Jonas Schievink
cda9668289 Update salsa 2021-10-06 22:42:54 +02:00
Lukas Wirth
fb27c58a04 Update Cargo.lock 2021-10-06 22:34:55 +02:00
Lukas Wirth
454ecd167c Make multiple import edits work for completions 2021-10-04 21:44:33 +02:00
Laurențiu Nicola
035cb443aa Bump notify 2021-10-01 18:57:04 +03:00
Laurențiu Nicola
ffa8270f6a Bump memmap2 2021-10-01 18:55:52 +03:00
Laurențiu Nicola
34adcc800c Bump libc 2021-10-01 18:51:45 +03:00
Laurențiu Nicola
193a926d45 Bump deps 2021-10-01 18:50:52 +03:00
bors[bot]
ee12b0f173
Merge #10181
10181: Begining of lsif r=HKalbasi a=HKalbasi

This PR adds a `lsif` command to cli, which can be used as `rust-analyzer lsif /path/to/project > dump.lsif`. It now generates a valid, but pretty useless lsif (only supports folding ranges). The propose of this PR is to discussing about the structure of lsif generator, before starting anything serious.

cc `@matklad` #8696 #3098


Co-authored-by: hamidreza kalbasi <hamidrezakalbasi@protonmail.com>
2021-09-29 13:13:03 +00:00