Commit graph

17548 commits

Author SHA1 Message Date
Aleksey Kladov
0413d51317 internal: move missing unsafe diagnostic to hir 2021-06-12 17:39:46 +03:00
Aleksey Kladov
f8009666be internal: move inference diagnostics to hir 2021-06-12 17:17:23 +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
bors[bot]
72ea02869b
Merge #9223
9223: Complete associated types in dyn and impl trait r=Veykril a=Veykril

Fixes #9222
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-11 21:13:28 +00:00
Lukas Wirth
ec9ef9c283 Complete associated types in dyn and impl trait 2021-06-11 23:12:30 +02:00
bors[bot]
187d55a25e
Merge #9221
9221: fix: Highlight tuple field accesses correctly r=Veykril a=Veykril

Fixes  #9220
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-11 19:20:24 +00:00
Lukas Wirth
e09723f0af Highlight tuple field accesses correctly 2021-06-11 21:19:19 +02:00
bors[bot]
863e23f00f
Merge #9219
9219: minor: Replace some AssocItem::containing_trait calls trait_or_trait_impl r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-11 17:56:00 +00:00
Lukas Wirth
db4a1fcab4 Replace some AssocItem::containing_trait calls trait_or_trait_impl 2021-06-11 19:55:24 +02:00
bors[bot]
21d4416235
Merge #9218
9218: Item search now respects trait impl items r=Veykril a=Veykril

Fixes #2977

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-11 17:33:34 +00:00
Lukas Wirth
48f65b3b15 Item search now respects trait impl items 2021-06-11 19:24:52 +02:00
bors[bot]
6ac3e666b7
Merge #9217
9217: internal: Don't stringify and reparse `cfg_attr`-gated attributes r=jonas-schievink a=jonas-schievink

Bumps ungrammar to include https://github.com/rust-analyzer/ungrammar/pull/33

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-06-11 16:35:38 +00:00
Jonas Schievink
99d40e7a3a Don't stringify cfg_attr-gated attributes
This preserves the assigned `TokenId`s
2021-06-11 18:34:30 +02:00
Jonas Schievink
1d6eef1350 Update ungrammar 2021-06-11 18:34:30 +02:00
bors[bot]
5f69420ee3
Merge #9216
9216: fix: Don't allow lookup by self for unprefixed self access completions r=Veykril a=Veykril

Fixes #9211
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-11 16:27:42 +00:00
Lukas Wirth
4e588dfd88 Don't allow lookup by self for unprefixed self access completions 2021-06-11 18:26:52 +02:00
bors[bot]
80b3b74018
Merge #9215
9215: change visibility for use and macro items r=jonas-schievink a=Maan2003



Co-authored-by: Maan2003 <manmeetmann2003@gmail.com>
2021-06-11 14:10:22 +00:00
Maan2003
4c1a02288c
change visibility for use and macro items 2021-06-11 19:10:56 +05:30
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
bors[bot]
de9e989cf4
Merge #9209
9209: Don't suggest Remove unused param in trait impls r=Veykril a=Maan2003

See the added test for description

Co-authored-by: Maan2003 <manmeetmann2003@gmail.com>
2021-06-11 10:05:28 +00:00
Maan2003
7f71000c12
Don't suggest Remove unused param in trait impls 2021-06-11 12:24:56 +05:30
bors[bot]
c62ec3d998
Merge #9208
9208: minor: Populate import maps eagerly to speed up flyimports r=SomeoneToIgnore a=SomeoneToIgnore

Part of #7542
Follow up of https://github.com/rust-analyzer/rust-analyzer/pull/9206#issuecomment-859097783
Reduces `import_on_the_fly @ sel` case in the `integrated_completion_benchmark` by ~300ms.


Also enables cache priming for manual workspace loading to reflect the results in the benchmarks.

Before:
<img width="1198" alt="image" src="https://user-images.githubusercontent.com/2690773/121606148-4a734a80-ca56-11eb-812a-7955e93817f1.png">


After:
<img width="1200" alt="image" src="https://user-images.githubusercontent.com/2690773/121606156-4e06d180-ca56-11eb-891b-1ed878b53d7e.png">


Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-06-11 06:28:32 +00:00
Kirill Bulatov
339448157c Only prefill caches in the completion benchmark 2021-06-11 09:27:25 +03:00
Kirill Bulatov
b24f816c0d Fix visibility issues 2021-06-11 02:00:05 +03:00
Kirill Bulatov
ba65d259de Prime caches on workspace load 2021-06-11 02:00:03 +03:00
Kirill Bulatov
a6cdde0d0b Populate import maps eagerly 2021-06-11 01:27:20 +03:00
bors[bot]
c4c1fcb8e9
Merge #9206
9206: minor: Speed up fst items lookup during completions r=SomeoneToIgnore a=SomeoneToIgnore

Part of https://github.com/rust-analyzer/rust-analyzer/issues/7542

A number of profile calls added for `import_on_the_fly` contents.
Before:
<img width="606" alt="Screenshot 2021-06-11 at 00 19 13" src="https://user-images.githubusercontent.com/2690773/121598998-22321e80-ca4b-11eb-9a3d-dc9cb2936705.png">

After:
<img width="859" alt="Screenshot 2021-06-11 at 00 19 27" src="https://user-images.githubusercontent.com/2690773/121599022-2a8a5980-ca4b-11eb-82b6-13ab0ed56d58.png">

As a result, low hanging fruit was spotted: crazy amount of `fst_path` calls. Reducing that won ~200ms in the `import_on_the_fly @ sel` case in the `integrated_completion_benchmark`:

<img width="861" alt="Screenshot 2021-06-11 at 00 19 38" src="https://user-images.githubusercontent.com/2690773/121599277-7d641100-ca4b-11eb-8667-53206994de27.png">

I'm not sure how to proceed with the remaining `???` marks in such methods as `collect_import_map` though: there's nothing but library calls in cycles, but maybe I'll come up with something later.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-06-10 21:28:14 +00:00
Kirill Bulatov
690cd95327 Reduce fst_path calls 2021-06-11 00:10:09 +03:00
Kirill Bulatov
3aaf07b8cb Add more profiling for flyimports 2021-06-10 23:43:46 +03:00
Jonas Schievink
35b18b2725 Add support for mallinfo2 on glibc Linux 2021-06-10 14:58:52 +02:00
bors[bot]
f4da4de7cd
Merge #9202
9202: feat: Make `MemoryUsage` work on Windows r=jonas-schievink a=jonas-schievink

Unfortunately there is no convenient API for heap statistics, so this instead uses the Commit Charge value, which is the amount of memory that needs to be allocated either in physical RAM or in the page file. This approximation seems to be good enough to find queries that waste a large amount of memory, but it should generally be expected to be off by several MB.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-06-10 12:09:54 +00:00
Jonas Schievink
2c1ca98aba Make MemoryUsage work on Windows 2021-06-10 14:06:35 +02:00
bors[bot]
660a89620f
Merge #9196
9196: fix: Don't classify attributes on macro-calls are the macro itself r=Veykril a=Veykril

Fixes #9184
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-09 22:27:07 +00:00
Lukas Wirth
26c869ddc0 Don't classify attributes on macro-calls are the macro itself 2021-06-10 00:26:15 +02:00
bors[bot]
c6133fe51c
Merge #9195
9195: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-09 21:45:35 +00:00
Lukas Wirth
20d26bd109 Simplify 2021-06-09 23:45:12 +02:00
bors[bot]
85056423e3
Merge #9193
9193: Implement dummy expansions for builtin attributes r=jonas-schievink a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-09 17:21:50 +00:00
Lukas Wirth
1e51b137d9 Remove unnecessary duplication 2021-06-09 18:42:01 +02:00
Lukas Wirth
ae8d74ab2c Implement dummy expansions for builtin attributes 2021-06-09 18:27:08 +02:00
Jonas Schievink
d236fc6abe Try to fix unique file names on Windows 2021-06-09 18:02:04 +02:00
Jonas Schievink
05b3a4bc93 Build test-macros in a build script 2021-06-09 17:16:52 +02:00
bors[bot]
5f592f4f58
Merge #9191
9191: fix: Don't descend MacroCall TokenTree delimiters r=jonas-schievink a=Veykril

Fixes #9190

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-09 13:17:38 +00:00
Lukas Wirth
3c40b15d62 Don't descend MacroCall TokenTree delimiters 2021-06-09 15:02:11 +02:00
bors[bot]
cc7cfc5d3d
Merge #9186
9186: fix: Prefer attr macros in "expand macro recursively" r=jonas-schievink a=jonas-schievink

This allows expanding attribute macros on fn-like macro invocations

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-06-08 21:08:58 +00:00
bors[bot]
a60978d172
Merge #9183
9183: Fix typo r=lnicola a=phynalle



Co-authored-by: phynalle <phynalism@gmail.com>
2021-06-08 20:47:10 +00:00
Jonas Schievink
fcf22d68d4 Prefer attr macros in "expand macro recursively" 2021-06-08 22:26:01 +02:00
bors[bot]
f1a40f9093
Merge #9187
9187: fix: Fix edge case for ImportGranularity guessing r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-08 20:18:54 +00:00
Lukas Wirth
31aad2528f Fix edge case for ImportGranularity guessing 2021-06-08 22:14:30 +02:00
phynalle
e8a5fb434d Fix typo 2021-06-09 04:51:28 +09:00