Commit graph

1349 commits

Author SHA1 Message Date
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
Aleksey Kladov
2bf81922f7 internal: more reasonable grammar for blocks
Consider these expples

        { 92 }
  async { 92 }
    'a: { 92 }
   #[a] { 92 }

Previously the tree for them were

  BLOCK_EXPR
    { ... }

  EFFECT_EXPR
    async
    BLOCK_EXPR
      { ... }

  EFFECT_EXPR
    'a:
    BLOCK_EXPR
      { ... }

  BLOCK_EXPR
    #[a]
    { ... }

As you see, it gets progressively worse :) The last two items are
especially odd. The last one even violates the balanced curleys
invariant we have (#10357) The new approach is to say that the stuff in
`{}` is stmt_list, and the block is stmt_list + optional modifiers

  BLOCK_EXPR
    STMT_LIST
      { ... }

  BLOCK_EXPR
    async
    STMT_LIST
      { ... }

  BLOCK_EXPR
    'a:
    STMT_LIST
      { ... }

  BLOCK_EXPR
    #[a]
    STMT_LIST
      { ... }
2021-09-26 19:16:09 +03:00
hamidreza kalbasi
13d36e96c2 use crates io version 2021-09-26 10:39:23 +03:30
hamidreza kalbasi
70061d2b7e move lsif types to lsp types crate 2021-09-26 10:04:02 +03:30
Lukas Wirth
42eb4efb5b Cleanup 2021-09-23 16:28:03 +02:00
Lukas Wirth
a6dde501df Only strip derive attributes when preparing macro input 2021-09-19 23:38:38 +02:00
Giles Cope
15312aab58
removing seemingly unused dev deps. 2021-09-11 16:26:36 +01:00
Giles Cope
4ccd90af81
remove unused deps 2021-09-11 16:20:04 +01:00
Laurențiu Nicola
c930dcca13 Bump chalk 2021-09-09 21:12:38 +03:00
Laurențiu Nicola
968000ee96 Bump deps 2021-09-09 21:09:57 +03:00
Aleksey Kladov
dbb702cfc1 internal: remove accidental code re-use
FragmentKind played two roles:

* entry point to the parser
* syntactic category of a macro call

These are different use-cases, and warrant different types. For example,
macro can't expand to visibility, but we have such fragment today.

This PR introduces `ExpandsTo` enum to separate this two use-cases.

I suspect we might further split `FragmentKind` into `$x:specifier` enum
specific to MBE, and a general parser entry point, but that's for
another PR!
2021-09-05 22:36:36 +03:00
Jade
1857b2b5d6 Update dependency minor versions 2021-09-04 00:27:05 -07:00
Jonas Schievink
8969cbb22f Depend on both crates individually 2021-08-31 13:10:16 +02:00
Jonas Schievink
e6255356d2 Fix DNF construction, add proptest 2021-08-30 22:26:35 +02:00
Dezhi Wu
ba0947dded switch log crate to tracing 2021-08-30 15:11:42 +08:00
bors[bot]
10e9408d38
Merge #10066
10066: internal: improve compile times a bit r=matklad a=matklad

I wanted to *quickly* remove `smol_str = {features = "serde"}`, and figured out that the simplest way to do that is to replace our straightforward proc macro serialization with something significantly more obscure. 

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-28 20:38:58 +00:00
Aleksey Kladov
c639fe333f internal: improve compilation critical path a bit 2021-08-28 22:43:37 +03:00
Aleksey Kladov
0dabcf0044 remove unused serde feature from smol_str 2021-08-28 22:43:37 +03:00
Lukas Wirth
1195cb50c2 Add simple test for syntax_node_to_token_tree_censored 2021-08-25 19:57:18 +02:00
Lukas Wirth
d6134b6802 Don't mutate syntax trees when preparing proc-macro input 2021-08-25 18:57:24 +02:00
Lukas Wirth
d38380715a ⬆️ rowan 2021-08-23 23:22:31 +02:00
Aleksey Kladov
3f2add81fc ⬆️ rowan
This pulls in https://github.com/rust-analyzer/rowan/pull/111, which
fixes a bug in green node hash, making it more efficient.

On analysis stats, total memory goes from 1271mb to 1244mb, instructions
from 358ginstr to 353ginstr (not 100% clear on this one -- for some
reasons instruction counts are not stable for me anymore).

The counts are (before, than after):

rowan::green::node::GreenNode       11_490_596    2_357_063    2_233_347
rowan::green::token::GreenToken      5_010_401      994_281      991_920

rowan::green::node::GreenNode        9_738_085    1_988_164    1_890_549
rowan::green::token::GreenToken      3_353_409      687_333      685_831
                                         total     max_live         live
2021-08-23 21:15:44 +03:00
Laurențiu Nicola
e6d78834dd Bump deps 2021-08-23 13:25:59 +03:00
Aleksey Kladov
c044493434 ⬆️ rowan
Just so we don't live on a per-release
2021-08-23 12:10:49 +03:00
Aleksey Kladov
e86388689f internal: remove unreasonable crate dependency
Proc macro expansion shouldn't know about salsa at all.
2021-08-22 14:05:12 +03:00
Aleksey Kladov
881d71a489 internal: reduce crate interdependence
I don't think there's anything wrong with project_model depending on
proc_macro_api directly -- fundamentally, both are about gluing our pure
data model to the messy outside world.

However, it's easy enough to avoid the dependency, so why not.

As an additional consideration, `proc_macro_api` now pulls in `base_db`.
project_model should definitely not depend on that!
2021-08-22 13:32:00 +03:00
Alexander Sieg
7bf19f9842 rebuild Cargo.lock 2021-08-17 17:27:37 +02:00
Alexander Sieg
ca6a1d8c63 Revert "Downgrade notify and use RecommendedWatcher"
This reverts commit 5b0c86af7d.

The pre-5.0.12 release of notify fixed this issue.
2021-08-17 17:17:13 +02:00
Aleksey Kladov
92da7e9ffa internal: optimize compile time
cargo llvm-lines shows that path_to_error bloats the code. I don't think
I've needed this functionality recently, seems that we've fixed most of
the serialization problems. So let's just remove it. Should be easy to
add back if we ever need it, and it does make sense to keep the
`from_json` function around.
2021-08-15 13:24:37 +03:00
Jeremy Kolb
ddf23abfef cargo update 2021-08-13 11:08:24 -04:00
Jonas Schievink
d568e7686a Support if let match guards 2021-08-13 00:25:14 +02:00
Aleksey Kladov
3e5b155716 fix: avoid pathological macro expansions
Today, rust-analyzer (and rustc, and bat, and IntelliJ) fail badly on
some kinds of maliciously constructed code, like a deep sequence of
nested parenthesis.

"Who writes 100k nested parenthesis" you'd ask?

Well, in a language with macros, a run-away macro expansion might do
that (see the added tests)! Such expansion can be broad, rather than
deep, so it bypasses recursion check at the macro-expansion layer, but
triggers deep recursion in parser.

In the ideal world, the parser would just handle deeply nested structs
gracefully. We'll get there some day, but at the moment, let's try to be
simple, and just avoid expanding macros with unbalanced parenthesis in
the first place.

closes #9358
2021-08-09 16:15:02 +03:00
Florian Diebold
16ab75a83a Upgrade Chalk 2021-08-07 13:12:35 +02:00
bors[bot]
4b0c97668c
Merge #9772
9772: feat: filter out duplicate macro completions r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-03 14:37:25 +00:00
Aleksey Kladov
2f9273633b feat: filter out duplicate macro completions
closes #9303
2021-08-03 17:36:06 +03:00
Laurențiu Nicola
5b0c86af7d Downgrade notify and use RecommendedWatcher 2021-08-03 14:33:37 +03:00
Laurențiu Nicola
90e05ba57e Bump deps 2021-07-31 11:25:03 +03:00
Aleksey Kladov
89d4b9a95a ⬆️ crates 2021-07-31 10:25:13 +03:00
Lukas Wirth
b537cb186e Use more strictly typed syntax nodes for analysis in extract_function assist 2021-07-29 17:26:37 +02:00
Laurențiu Nicola
d9ec9d95c5 Bump deps 2021-07-24 11:16:32 +03:00
bors[bot]
0bee7cb716
Merge #9453
9453: Add first-class limits. r=matklad,lnicola a=rbartlensky

Partially fixes #9286.

This introduces a new `Limits` structure which is passed as an input
to `SourceDatabase`. This makes limits accessible almost everywhere in
the code, since most places have a database in scope.

One downside of this approach is that whenever you query limits, you
essentially do an `Arc::clone` which is less than ideal.

Let me know if I missed anything, or would like me to take a different approach!

Co-authored-by: Robert Bartlensky <bartlensky.robert@gmail.com>
2021-07-22 10:33:05 +00:00
Aleksey Kladov
b0c4b776b5 internal: add simple smoke test for project model
Our project model code is rather complicated -- the logic for lowering
from `cargo metadata` to `CrateGraph` is fiddly and special-case. So
far, we survived without testing this at all, but this increasingly
seems like a poor option.

So this PR introduces a simple tests just to detect the most obvious
failures. The idea here is that, although we rely on external processes
(cargo & rustc), we are actually using their stable interfaces, so we
might just mock out the outputs.

Long term, I would like to try to virtualize IO here, so as to do such
mocking in a more principled way, but lets start simple.

Should we forgo the mocking and just call `cargo metadata` directly
perhaps? Touch question -- I personally feel that fast, in-process tests
are more important in this case than any extra assurance we get from
running the real thing.

Super-long term, we would probably want to extend our heavy tests to
cover more use-cases, but we should figure a way to do that without
slowing the tests down for everyone.

Perhaps we need two-tiered bors system, where we pull from `master` into
`release` branch only when an additional set of tests passes?
2021-07-20 16:23:57 +03:00
Aleksey Kladov
e20a1a4e4e minor: publish la_arena 2021-07-20 14:33:08 +03:00
bors[bot]
c595676f7e
Merge #9625
9625: internal: simplify handling of the build scripts r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-19 15:28:36 +00:00
Robert Bartlensky
0b3d0cde8b Add Limit struct.
Fixes #9286.
2021-07-19 13:26:11 +01:00
bors[bot]
ea105f9396
Merge #9619
9619: Support GATs for associated type arg parsing r=Veykril a=Veykril

Fixes #9602

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-18 09:10:56 +00:00
Lukas Wirth
e7aa37c20a Support GATs for associated type arg parsing 2021-07-18 11:08:43 +02:00
Aleksey Kladov
f4de2ece0d internal: simplify handling of the build scripts 2021-07-18 11:29:22 +03:00
Aleksey Kladov
8d8c26e6f5 internal: a bit more of cwd safety for flycheck 2021-07-17 18:13:35 +03:00
Aleksey Kladov
8df38aa797 internal: make sure that proc macro machinery doesn't depend on cwd 2021-07-17 17:55:16 +03:00
Laurențiu Nicola
df729eda69 Bump chalk 2021-07-10 18:58:14 +03:00
Laurențiu Nicola
861f1e2a86 Bump rustc_lexer a little 2021-07-10 18:57:59 +03:00
Laurențiu Nicola
932d4183a1 Bump deps 2021-07-10 18:55:01 +03:00
kjeremy
35016c772c cargo_metadata 0.14
Removes the following dependent crates:
* semver-parser
* pest
* ucd-trie

Removes project_model's dependency on itertools
2021-07-09 11:01:55 -04:00
Aleksey Kladov
90e27d6289 internal: make xtask lighter
Moving tests to `rust-analyzer` crate allows removing walkdir dependency
from `xtask`. It does seem more reasonable to keep tidy tests outside of
the "build system" and closer to other integration tests.
2021-07-04 12:47:56 +03:00
Aleksey Kladov
58d2ece88a internal: overhaul code generation
* Keep codegen adjacent to the relevant crates.
* Remove codgen deps from xtask, speeding-up from-source installation.

This regresses the release process a bit, as it now needs to run the
tests (and, by extension, compile the code).
2021-07-03 22:11:03 +03:00
kjeremy
bf7651886e Cargo update and pull in the new rowan
This brings in the new hashbrown for better compile times.
2021-06-30 10:03:31 -04:00
kjeremy
5b6e168928 Update crates 2021-06-22 13:18:48 -04:00
kjeremy
a1aba2e8cc cargo update 2021-06-18 14:32:02 -04:00
Aleksey Kladov
06f5d6f640 internal: don't pull tracing via chalk 2021-06-14 20:41:08 +03:00
Aleksey Kladov
a91071b57b internal: cut deps between assists and diagnostics 2021-06-14 17:45:17 +03:00
Aleksey Kladov
1d2772c2c7 internal: move diagnostics to a new crate 2021-06-14 17:45:17 +03:00
Aleksey Kladov
3d2f0400a2 internal: start ide diagnostics crate 2021-06-14 17:45:17 +03:00
Aleksey Kladov
0463d76a1f internal: cross-crate cov-marks 2021-06-12 23:40:52 +03:00
Aleksey Kladov
6f0141a140 minor: optimize
We shouldn't be looking at the source map unless we actually have
diagnostics.
2021-06-12 17:49:41 +03:00
bors[bot]
409f5fb563
Merge #9204
9204: feat: more accurate memory usage info on glibc Linux r=jonas-schievink a=jonas-schievink

This adds support for the new `mallinfo2` API added in glibc 2.33. It addresses a shortcoming in the `mallinfo` API where it was unable to handle memory usage of more than 2 GB, which we sometimes exceed.

Blocked on https://github.com/rust-lang/libc/pull/2228

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-06-11 22:00:23 +00:00
Jonas Schievink
74dc9bb0e9 Update libc 2021-06-11 23:55:27 +02:00
Jonas Schievink
1d6eef1350 Update ungrammar 2021-06-11 18:34:30 +02:00
bors[bot]
050232a37e
Merge #9192
9192: internal: Build test-macros in a build script r=jonas-schievink a=jonas-schievink

This build the test-proc-macros in `proc_macro_test` in a build script, and copies the artifact to `OUT_DIR`. This should make it available throughout all of rust-analyzer at no cost other than depending on `proc_macro_test`, fixing https://github.com/rust-analyzer/rust-analyzer/issues/9067.

This hopefully will let us later write inline tests that utilize proc macros, which makes my life fixing proc macro bugs easier.

Opening this as a sort of RFC, because I'm not totally sure this approach is the best.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-06-11 10:44:07 +00:00
Jonas Schievink
2c1ca98aba Make MemoryUsage work on Windows 2021-06-10 14:06:35 +02:00
Jonas Schievink
05b3a4bc93 Build test-macros in a build script 2021-06-09 17:16:52 +02:00
Jonas Schievink
cfcadcb295 Simplify proc_macro_srv tests 2021-05-31 17:32:56 +02:00
bors[bot]
e9a797748d
Merge #8866
8866: Update salsa r=matklad a=jonas-schievink

This updates salsa to include https://github.com/salsa-rs/salsa/pull/265, and removes all cancellation-related code from rust-analyzer

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-05-31 12:42:32 +00:00
bors[bot]
f41b68637a
Merge #9062
9062: internal: Bump deps r=lnicola a=lnicola

Fixes #9061

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-05-30 11:48:59 +00:00
Laurențiu Nicola
36567eb9be Bump deps 2021-05-30 14:48:10 +03:00
Jonas Schievink
acb5c227ed Update to prerelease 2021-05-29 21:10:00 +02:00
Lukas Wirth
fc37e2f953 Attribute completion is context aware 2021-05-27 23:28:14 +02:00
Jonas Schievink
33debc4065 Update salsa 2021-05-27 15:05:41 +02:00
Laurențiu Nicola
b43bc61981 Bump rustc_lexer 2021-05-24 16:39:19 +03:00
Laurențiu Nicola
d525cfc85a Bump object 2021-05-24 16:35:23 +03:00
Laurențiu Nicola
47afa4a5fc Bump misc deps 2021-05-24 16:31:54 +03:00
Laurențiu Nicola
74f1b21b08 Bump chalk 2021-05-24 16:27:24 +03:00
kjeremy
58621f114b Update notify and fst 2021-05-17 07:49:27 -04:00
Aleksey Kladov
0650f77dd9 internal: remove one more immutable tree 2021-05-14 16:19:27 +03:00
Jonas Schievink
a85a2c4d15 Allow viewing the crate graph in a webview 2021-05-11 16:15:31 +02:00
Aleksey Kladov
53f7149d45 internal: expose cfg attrs from hir::Crate 2021-05-07 23:50:24 +03:00
John Renner
d8a9b450a6 Switch from jemalloc to tikv-jemalloc 2021-05-07 12:17:37 -07:00
Dawer
52143f389f Update to rowan 0.13.0-pre.5 2021-05-06 10:04:39 +05:00
Jonas Schievink
851bd2a32b Update salsa 2021-05-05 23:00:29 +02:00
memoryruins
27ba1dd8e3 Replace memmap to memmap2 in proc_macro_api 2021-05-03 20:20:47 -04:00
Jeremy Kolb
666302f007 cargo update 2021-05-02 15:17:04 -04:00
Jeremy Kolb
36c20dc23d Return ServerNotInitialized according to the spec
According to the spec we should return ServerNotInitialized if the server is waiting for an initialize request and something else comes in.
Upgrading to lsp-server 0.5.1 will do this and retry until the initialize request comes in.

Fixes #8581
2021-04-27 07:47:06 -04:00
Jeremy Kolb
321aa9eb92 Update deps 2021-04-25 15:43:42 -04:00
bors[bot]
e529f73355
Merge #8627
8627: Add profiling spans under cargo_to_crate_graph r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-04-22 18:26:09 +00:00
Laurențiu Nicola
6b187af337 Add profiling spans under cargo_to_crate_graph 2021-04-22 21:25:29 +03:00
bors[bot]
32491c0978
Merge #8570
8570: Flycheck tries to parse both Cargo and Rustc messages. r=rickvanprim a=rickvanprim

This change allows non-Cargo build systems to be used for Flycheck provided they call `rustc` with `--error-format=json` and emit those JSON messages to `stdout`.

Co-authored-by: James Leitch <rickvanprim@gmail.com>
2021-04-21 21:56:54 +00:00
Laurențiu Nicola
81054a2581 Bump other deps 2021-04-21 19:20:18 +03:00
Laurențiu Nicola
27c5e2da48 Bump chalk 2021-04-21 19:20:01 +03:00
Laurențiu Nicola
e50ca6b067 Bump rustc_lexer 2021-04-21 19:19:27 +03:00
Aleksey Kladov
1772eb0f1a fix: no longer get stuck on windows
reading both stdout & stderr is a common gotcha, you need to drain them
concurrently to avoid deadlocks. Not sure why I didn't do the right
thing from the start. Seems like I assumed the stderr is short? That's
not the case when cargo spams `compiling xyz` messages
2021-04-20 18:02:54 +03:00
James Leitch
b5c194f3f7 Flycheck tries to parse both Cargo and Rustc messages. 2021-04-18 16:36:29 -07:00
kjeremy
7091082f38 notify 5.0.0.pre7
Fixes windows leak: https://github.com/notify-rs/notify/pull/298
2021-04-15 11:51:32 -04:00
kjeremy
9b673aa9d8 crossbeam-channel 0.5.1
Fixes a potential memory leak in unbound channels.
2021-04-13 08:19:47 -04:00
kjeremy
3634b2145c Bump lsp-types and syn
This lsp-types now supports a default InsertTextMode for completion and a per-completion item commit_characters
2021-04-08 10:57:47 -04:00
kjeremy
761a81822a Update crates 2021-04-07 11:39:33 -04:00
Alexandru Macovei
4e2a6ac7ea Avoid duplicating VfsPath in vfs::path_interner::PathInterner by using an IndexSet 2021-04-06 16:03:57 +03:00
kjeremy
b246f57fad Use arrayvec 0.7 to avoid perf regression in 0.6.1
See: https://github.com/bluss/arrayvec/issues/182
2021-04-05 12:58:35 -04:00
Aleksey Kladov
d1474ae518 Check if bitflags deps pulls its weight
Bitflags is generally a good dependency -- it's lightweight, well
maintained and embraced by the ecosystem.

I wonder, however, do we really need it? Doesn't feel like it adds much
to be honest.
2021-04-04 12:06:01 +03:00
Jonas Schievink
ee4b5a34d8 Use bitflags to compress function properties
Very minor savings, only 1 MB or so
2021-04-03 20:58:42 +02:00
Jeremy Kolb
c7a664c2ea cargo update 2021-04-03 12:18:00 -04:00
Jonas Schievink
b00266b79f Global TypeRef/TraitRef interning 2021-04-01 19:46:43 +02:00
Laurențiu Nicola
9787bddac5 Use arrayvec 0.6 2021-03-25 21:03:20 +02:00
kjeremy
0630ff5de5 cargo update
Removes dependency on socket2
2021-03-23 14:44:26 -04:00
Aleksey Kladov
48b534ceb8 ⬆️ rowan 2021-03-22 20:26:59 +03:00
Lukas Wirth
4771a56791 Parse extended_key_value_attributes 2021-03-19 02:13:46 +01:00
Aleksey Kladov
f5a81ec468 Upgrade rowan
Notably, new rowan comes with support for mutable syntax trees.
2021-03-16 16:10:49 +03:00
Edwin Cheng
8e07b23b84 Fix macro expansion for statements w/o semicolon 2021-03-16 13:44:50 +08:00
Lukas Wirth
2e3c156b0e Return multiple modules in parent_module 2021-03-15 15:15:40 +01:00
Jonas Schievink
bc4ecb199b Use expect-test for builtin macro/derive tests 2021-03-10 21:05:02 +01:00
bors[bot]
6c32e2d8a0
Merge #7965
7965: cargo update and lexer r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-03-10 18:59:19 +00:00
kjeremy
08e0e9976d cargo update and lexer 2021-03-10 13:47:12 -05:00
Jonas Schievink
2b8674b37e Implement builtin cfg! macro 2021-03-10 19:43:03 +01:00
bors[bot]
654313dbc7
Merge #6822
6822: Read version of rustc that compiled proc macro r=edwin0cheng a=jsomedon

Signed-off-by: Jay Somedon <jay.somedon@outlook.com>

This PR is to fix #6174.

I basically
* added two methods, `read_version` and `read_section`(used by `read_version`)
* two new crates `snap` and `object` to be used by those two methods

I just noticed that some part of code were auto-reformatted by rust-analyzer on file save. Does it matter?

Co-authored-by: Jay Somedon <jay.somedon@outlook.com>
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-03-09 20:57:04 +00:00
Laurențiu Nicola
fc9eed4836 Use upstream cov-mark 2021-03-08 22:19:44 +02:00
Aleksey Kladov
da73c93c7f Don't punish every crate with serde-json 2021-03-08 20:37:20 +03:00
kjeremy
e13ac349b5 Cargo update
Chalk changes just a version # bump. There are no actual commits.
2021-03-08 10:39:11 -05:00
Aleksey Kladov
0296cd590e ⬆️ xflags 2021-03-07 11:12:59 +03:00
kjeremy
124c9fe006 cargo update 2021-03-05 13:14:29 -05:00
Aleksey Kladov
142f9a03fd Cleanup install command 2021-03-05 11:51:32 +03:00
Jay Somedon
55d73bc675 Fix multiple issues from code review
* check metadata version
* use memmap
* use Result instead of unwrap

with Jay Somedon <jay.somedon@outlook.com>
2021-03-04 09:11:33 +08:00
Jay Somedon
6608acef71 Read version of rustc that compiled proc macro
With Jay Somedon <jay.somedon@outlook.com>
2021-03-04 09:05:23 +08:00
kjeremy
41d1b4cd26 Update lexer 2021-03-02 15:33:22 -05:00
kjeremy
58697afca4 bump once_cell 2021-03-02 12:41:20 -05:00
bors[bot]
91bf5fa827
Merge #7513
7513: NFA parser for mbe matcher r=matklad a=edwin0cheng

Almost straight porting from rustc one, but a little bit slow :(

```
rust-analyzer analysis-stats -q . 
```

From:
```log
Database loaded:     636.11ms, 277minstr
  crates: 36, mods: 594, decls: 11527, fns: 9017
Item Collection:     10.99s, 60ginstr
  exprs: 249618, ??ty: 2699 (1%), ?ty: 2101 (0%), !ty: 932
Inference:           28.94s, 123ginstr
Total:               39.93s, 184ginstr
```

To:
```log
Database loaded:     630.90ms, 277minstr
  crates: 36, mods: 594, decls: 11528, fns: 9018
Item Collection:     13.70s, 77ginstr
  exprs: 249482, ??ty: 2699 (1%), ?ty: 2101 (0%), !ty: 932
Inference:           30.27s, 133ginstr
Total:               43.97s, 211ginstr
```

Fixes #4777

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-03-02 13:20:47 +00:00
bors[bot]
8eee9149e8
Merge #7848
7848: Bump cargo_metadata r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-03-02 12:31:15 +00:00
Laurențiu Nicola
b20708f6ee Bump cargo_metadata 2021-03-02 14:27:29 +02:00
Aleksey Kladov
3038579c8e Switch from pico-args to xflags 2021-03-02 15:08:20 +03:00
bors[bot]
10a57b8109
Merge #7835
7835: Use cli parser with auto-generated help r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-01 19:57:25 +00:00
Aleksey Kladov
4ce20b80c5 Use cli parser with auto-generated help 2021-03-01 22:12:43 +03:00
Laurențiu Nicola
63e8bdb8a2 Bump chalk 2021-03-01 18:17:03 +02:00
Laurențiu Nicola
8ffd76ddc5 Bump deps 2021-03-01 18:13:08 +02:00
Edwin Cheng
cff2201c30 NFA parser for mbe matcher 2021-03-01 00:11:14 +08:00
bors[bot]
a8cf346b97
Merge #7566
7566: Add benchmark tests for mbe r=matklad a=edwin0cheng

This PR add more real world tests dumped from `rust-analyzer analysis-stats .` to benchmark its performance.

cc #7513

r? @matklad 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-02-27 14:39:22 +00:00
kjeremy
d42730b76e bump crates 2021-02-25 10:34:48 -05:00
Aleksey Kladov
eb7333f0a9 ⬆️ crates 2021-02-25 17:55:50 +03:00
Edwin Cheng
23dbf36c7d Add benchmark test for mbe 2021-02-25 05:47:13 +08:00
kjeremy
722d071dbf Update mio 2021-02-23 12:16:56 -05:00
Chetan Khilosiya
eb6cfa7f15 7526: Renamed create ssr to ide_ssr. 2021-02-23 00:59:16 +05:30
Chetan Khilosiya
e4756cb4f6 7526: Rename crate assists to ide_assists. 2021-02-23 00:59:16 +05:30
kjeremy
e103ca7d8d update tracing-tree 2021-02-22 12:03:34 -05:00
bors[bot]
63d61c0c98
Merge #7752
7752: up once_cell r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-02-22 13:32:40 +00:00
kjeremy
d51c58e14e up once_cell 2021-02-22 08:31:33 -05:00
Aleksey Kladov
58be1edfbb Make more common assist easier to ues 2021-02-22 16:07:08 +03:00
Laurențiu Nicola
6c0f7a2f56 Pin ungrammar 2021-02-21 19:33:55 +02:00
Laurențiu Nicola
48ae948b22 Bump deps 2021-02-21 19:13:11 +02:00
Jeremy Kolb
b43bec380f Update some crates 2021-02-20 14:15:26 -05:00
Aleksey Kladov
3db64a400c rename completion -> ide_completion
We don't have completion-related PRs in flight, so lets do it
2021-02-17 17:53:31 +03:00
kjeremy
88a5e1d036 Bump lsp-types 2021-02-16 09:21:07 -05:00
kjeremy
2cb0544c20 cargo update 2021-02-15 09:49:36 -05:00
Jeremy Kolb
8105418b25 Start LSP 3.17 support 2021-02-14 14:51:29 -05:00
kjeremy
61092bd900 libloading 0.7
See https://docs.rs/libloading/0.7.0/libloading/changelog/r0_7_0/index.html
2021-02-11 10:07:49 -05:00
Aleksey Kladov
4b1279d0b1 Infra for "unit" benchmarking 2021-02-09 20:25:39 +03:00
kjeremy
0c3b38695a Update crates
Pulls in https://github.com/rust-lang/chalk/pull/682
2021-02-08 11:38:51 -05:00
Aleksey Kladov
7022ea52b5 AdtDef -> Adt 2021-02-07 14:15:02 +03:00
kjeremy
c3ddf3e1d6 cargo update 2021-02-05 15:35:45 -05:00
Lukas Wirth
eeb5bfcfab Cleanup decl_check 2021-02-05 16:09:45 +01:00
kjeremy
4a722a34f9 Update thread_local
Pulls in https://github.com/Amanieu/thread_local-rs/pull/30 which fixes
a leak when dropping ThreadLocal.
2021-02-04 14:42:45 -05:00
kjeremy
b9ad1f587d Update mimalloc 2021-02-02 17:17:49 -05:00
Laurențiu Nicola
6b60206669 Bump rustc_lexer 2021-02-02 17:40:01 +02:00
Laurențiu Nicola
9c4b799dce Bump chalk 2021-02-02 17:40:01 +02:00
kjeremy
953883ca54 Use non-deprecated memmap2 crate
`cargo audit` complains that `memmap` is unmaintained so switch to
RazrFalcon's maintained version.

Removes yet another edge on winapi
2021-02-02 10:25:17 -05:00
kjeremy
1c9e216f69 cargo update 2021-02-02 10:00:34 -05:00
Laurențiu Nicola
7ed80bae92 Reap proc macro server instances 2021-02-01 21:24:09 +02:00
kjeremy
16f40d6e20 cargo update 2021-01-29 10:12:39 -05:00
Aleksey Kladov
921bfc0984 ⬆️ rowan 2021-01-29 16:12:41 +03:00
Aleksey Kladov
06b56e720f ⬆️ rowan 2021-01-28 22:27:35 +03:00
bors[bot]
92a6dcc360
Merge #7477
7477: ⬆️ cm r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-28 16:00:43 +00:00
Aleksey Kladov
29da27004e ⬆️ cm 2021-01-28 18:59:54 +03:00
kjeremy
ffff827828 cargo update 2021-01-28 09:55:34 -05:00
Laurențiu Nicola
efafcf2428 Bump deps 2021-01-27 14:22:19 +02:00
Aleksey Kladov
b8d50a7414 add more counts 2021-01-27 12:39:19 +03:00
Aleksey Kladov
d35bda6429 Make always-assert crate reusable 2021-01-26 22:13:42 +03:00
Aleksey Kladov
1df711b95c ⬆️ rowan 2021-01-25 12:32:35 +03:00
Jeremy Kolb
ea1683ea96 cargo update 2021-01-23 11:28:59 -05:00
kjeremy
486066417a Cargo update 2021-01-21 14:00:42 -05:00
Aleksey Kladov
e5c5c0a040 Include countme crate to count important data structures. 2021-01-21 19:30:52 +03:00
kjeremy
f006517857 Up lexer 2021-01-21 09:31:06 -05:00
Laurențiu Nicola
e42dfd7a40 Bump chalk 2021-01-21 10:29:19 +02:00
kjeremy
1e0b163860 chalk 0.49.0 2021-01-20 12:31:03 -05:00
kjeremy
46359ae841 bump serde 2021-01-20 09:44:48 -05:00
bors[bot]
de5aabd48b
Merge #7350
7350: Update pico-args r=matklad a=kjeremy

Should maintain existing behavior

Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-01-20 12:28:10 +00:00
Aleksey Kladov
3429b32ad1 ⬆️ rowan
It now stores text inline with tokens
2021-01-20 14:04:53 +03:00
Aleksey Kladov
46b4f89c92 . 2021-01-20 01:56:11 +03:00
Aleksey Kladov
cd21b0e9c1 ⬆️ rowan 2021-01-19 22:11:42 +03:00
kjeremy
db0aaeca33 Update pico-args
Should maintains existing behavior
2021-01-19 11:56:45 -05:00
Aleksey Kladov
4d510dfc56 ⬆️ rowan 2021-01-19 12:05:27 +03:00
bors[bot]
342bf41022
Merge #7297 #7338
7297: Propose trait associated items and autoimport traits on completion r=matklad a=SomeoneToIgnore

![trait_imports](https://user-images.githubusercontent.com/2690773/104819998-6faeb480-583a-11eb-8b45-b7351b51b90e.gif)

Closes #7248

7338: Parse `impl const Trait` r=Veykril a=Veykril

Closes #7313

bors r+

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-18 19:40:11 +00:00
Lukas Wirth
b26002410b Parse impl const Trait 2021-01-18 20:18:02 +01:00
Jonas Schievink
9b5fa1c61a Add back jemalloc support 2021-01-18 19:39:46 +01:00
kjeremy
a8b984185b cargo update
Update test_serialize_proc_macro for new serde version
2021-01-18 13:13:24 -05:00
Jonas Schievink
872bf09381 Add MacroType syntax 2021-01-18 17:56:35 +01:00
bors[bot]
9daba961f2
Merge #7291
7291: Wrap remaining self/super/crate in Name{Ref} r=matklad a=Veykril

That should be the remaining special casing for `self` 🎉 

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-18 16:13:06 +00:00
Aleksey Kladov
e13065b8ac Add profile call 2021-01-18 13:30:12 +03:00
Aleksey Kladov
1b6b5c9f28 ⬆️ rowan 2021-01-17 20:56:37 +03:00
Aleksey Kladov
33cce3d114 ⬆️ rowan
https://github.com/rust-analyzer/rowan/pull/86, which speeds up things
visibly
2021-01-17 18:27:29 +03:00
Aleksey Kladov
1c8feac01f ⬆️ arena 2021-01-17 11:43:04 +03:00
bors[bot]
f5f011ba71
Merge #7304
7304: Depend on local copy of la-arena instead of crates.io’s r=lnicola a=arzg

This addresses [this comment](https://github.com/rust-analyzer/rust-analyzer/pull/7276#issuecomment-760909936). #7275 and #7276 should start compiling if this is merged.

Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
2021-01-17 07:05:44 +00:00
Aramis Razzaghipour
709034d123
Depend on local copy of la-arena instead of crates.io’s 2021-01-17 17:52:57 +11:00