Commit Graph

1135 Commits

Author SHA1 Message Date
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