Commit Graph

11852 Commits

Author SHA1 Message Date
Aleksey Kladov
24262f9ff6 minor 2021-06-13 20:20:58 +03:00
Aleksey Kladov
949a6ec469 internal: refactor missing or or some diagnostic 2021-06-13 20:19:11 +03:00
Aleksey Kladov
74f3cca85a internal: refactor remove this semicolon diagnostics 2021-06-13 20:14:12 +03:00
Aleksey Kladov
8d391ec981 internal: refactor mismatched args count diagnostic 2021-06-13 20:06:25 +03:00
Aleksey Kladov
bccf77f26c internal: refactor missing unsafe diagnostic 2021-06-13 20:01:01 +03:00
Aleksey Kladov
886b66cd03 internal: refactor BreakOutsideOfLoop diagnostic 2021-06-13 19:51:19 +03:00
Aleksey Kladov
7166e8549b internal: refactor NoSuchField diagnostic 2021-06-13 19:45:16 +03:00
Aleksey Kladov
d3621eeb02 internal: refactor unimplemented builtin macro diagnostic 2021-06-13 19:35:30 +03:00
Aleksey Kladov
dec207f56a minor: simplify 2021-06-13 19:27:24 +03:00
Aleksey Kladov
a1940d8c75 internal: check diagnostics in all files and not just the first one 2021-06-13 19:23:37 +03:00
bors[bot]
7bff76d8ae
Merge #9249
9249: internal: remove def-level diagnostics tests r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-13 15:46:09 +00:00
Aleksey Kladov
4af7a35197 internal: remove def-level diagnostics tests 2021-06-13 18:45:38 +03:00
Aleksey Kladov
00303284b5 internal: refactor macro error 2021-06-13 18:41:04 +03:00
Aleksey Kladov
1e4aaee7bb internal: refactor unresolved proc macro diagnostic 2021-06-13 17:51:44 +03:00
Aleksey Kladov
f85e383b94 internal: refactor inactive code diagnostics 2021-06-13 17:29:25 +03:00
bors[bot]
3d8df2aef8
Merge #9248
9248: internal: refactor unresolved macro call diagnostic r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-13 14:09:41 +00:00
Aleksey Kladov
fa9ed4e0ce internal: refactor unresolved macro call diagnostic 2021-06-13 17:08:54 +03:00
Aleksey Kladov
6d104de15a internal: refactor unresolved import diagnostic 2021-06-13 16:42:34 +03:00
bors[bot]
e6fa9b016f
Merge #9247
9247: internal: refactor unresolved extern crate diagnostic r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-13 13:06:27 +00:00
Aleksey Kladov
39f190b72c internal: refactor unresolved extern crate diagnostic 2021-06-13 16:05:43 +03:00
bors[bot]
cc6d761a99
Merge #9246
9246: internal: unified missing fields diagnostic r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-13 12:49:37 +00:00
Aleksey Kladov
6383252cc2 internal: unified missing fields diagnostic 2021-06-13 15:48:54 +03:00
Aleksey Kladov
c6509a4592 internal: move missing_fields diagnostics 2021-06-13 15:27:15 +03:00
bors[bot]
3f53a5dd72
Merge #9245
9245: internal: start new diagnostics API r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-13 11:56:15 +00:00
Aleksey Kladov
efa069d288 internal: start new diagnostics API
At the moment, this moves only a single diagnostic, but the idea is
reafactor the rest to use the same pattern. We are going to have a
single file per diagnostic. This file will define diagnostics code,
rendering range and fixes, if any. It'll also have all of the tests.
This is similar to how we deal with assists.

After we refactor all diagnostics to follow this pattern, we'll probably
move them to a new `ide_diagnostics` crate.

Not that we intentionally want to test all diagnostics on this layer,
despite the fact that they are generally emitted in the guts on the
compiler. Diagnostics care to much about the end presentation
details/fixes to be worth-while "unit" testing. So, we'll unit-test only
the primary output of compilation process (types and name res tables),
and will use integrated UI tests for diagnostics.
2021-06-13 14:55:45 +03:00
bors[bot]
be9742809c
Merge #9244
9244: feat: Make block-local trait impls work r=flodiebold a=flodiebold

As long as either the trait or the implementing type are defined in the same block.

CC #8961

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-06-13 11:13:31 +00:00
Florian Diebold
5ca71a1990 Make block-local trait impls work
As long as either the trait or the implementing type are defined in the
same block.
2021-06-13 13:00:34 +02:00
Aleksey Kladov
546be18e3a internal: check that coverage marks are always paired 2021-06-13 13:13:26 +03:00
Aleksey Kladov
0eafc88079 minor: put a mark back 2021-06-13 11:49:32 +03:00
bors[bot]
adbee621a7
Merge #9242
9242: Clippy r=matklad a=Maan2003

Best viewed commit wise

Co-authored-by: Maan2003 <manmeetmann2003@gmail.com>
2021-06-13 07:18:49 +00:00
bors[bot]
f107b0f1e2
Merge #9240
9240: Fixed a small typo in comment r=matklad a=fee1-dead



Co-authored-by: fee1-dead <ent3rm4n@gmail.com>
2021-06-13 06:58:37 +00:00
Maan2003
5ac6804bb3
cargo fmt 2021-06-13 09:48:15 +05:30
Maan2003
aabd41cafc
clippy::redundant_field_names 2021-06-13 09:40:22 +05:30
Maan2003
b857a5dcf0
clippy::manual_str_repeat 2021-06-13 09:37:28 +05:30
Maan2003
c50b4579ec
clippy::useless_return 2021-06-13 09:35:29 +05:30
Maan2003
75370312fb
clippy::redundant_closure 2021-06-13 09:29:36 +05:30
Maan2003
705f7e6e26
clippy::clone_on_copy 2021-06-13 09:27:19 +05:30
Maan2003
6cc6dee9e9
clippy::useless_conversion 2021-06-13 09:25:55 +05:30
Maan2003
c9b4ac5be4
clippy::redudant_borrow 2021-06-13 09:24:16 +05:30
bors[bot]
d6737e55fb
Merge #9239
9239: fix: Fix coercion in match with expected type r=flodiebold a=flodiebold

Plus add infrastructure to test type mismatches without expect.

CC #8961

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-06-12 21:05:12 +00:00
Florian Diebold
20487a1b4a Fix coercion in match with expected type
Plus add infrastructure to test type mismatches without expect.
2021-06-12 23:04:43 +02:00
Aleksey Kladov
0463d76a1f internal: cross-crate cov-marks 2021-06-12 23:40:52 +03:00
bors[bot]
124123a53b
Merge #9237
9237: internal: move diagnostics infra to hir r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-12 19:05:58 +00:00
Aleksey Kladov
7731714578 internal: move diagnostics infra to hir 2021-06-12 22:05:23 +03:00
Kirill Bulatov
9c0b141dc9 Fix some typos in flyimport docs 2021-06-12 21:51:09 +03:00
bors[bot]
85d2cd331f
Merge #9233
9233: Move some hir_ty diagnostics to hir r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-12 18:01:00 +00:00
Aleksey Kladov
6940cfed1e Move some hir_ty diagnostics to hir 2021-06-12 21:00:22 +03:00
bors[bot]
10ca6b286c
Merge #9231
9231: minor: optimize r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-12 14:50:37 +00: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
Aleksey Kladov
1b1e3de988 minor: reduce visibility 2021-06-12 17:41:47 +03:00
bors[bot]
f9e67d692d
Merge #9230
9230: internal: move inference diagnostics to hir r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-12 14:40:28 +00:00
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
Aleksey Kladov
787d980c71 minor: squelch "unused" warning 2021-06-12 15:10:07 +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
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
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
fee1-dead
7ad8cd8232
Fixed a small typo in comment 2021-06-11 22:01:34 +08: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
Maan2003
7f71000c12
Don't suggest Remove unused param in trait impls 2021-06-11 12:24:56 +05:30
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
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
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
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
bors[bot]
b6199de706
Merge #9181 #9182
9181: Don't complete values in type position r=jonas-schievink a=Veykril

Will add some proper tests in a bit

9182: fix: don't complete derive macros as fn-like macros r=jonas-schievink a=jonas-schievink

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

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-06-08 19:09:13 +00:00
Lukas Wirth
1a26af15ef Add tests checking no value completion in type pos 2021-06-08 20:27:25 +02:00
Jonas Schievink
ee374ff1ee fix: don't complete derive macros as fn-like macros 2021-06-08 17:31:47 +02:00
Lukas Wirth
1d74ef1d98 Don't complete values in type position 2021-06-08 16:50:10 +02:00