Commit Graph

384 Commits

Author SHA1 Message Date
Aleksey Kladov
b292e1b9da internal: refactor missing match arms diagnostics 2021-06-13 21:44:31 +03:00
Aleksey Kladov
fc30c5ccbe internal: refactor incorrect case diagnostics 2021-06-13 21:09:03 +03:00
Aleksey Kladov
de1fc70ccd internal: refactor find_map diagnostic 2021-06-13 20:32:54 +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
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
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
Aleksey Kladov
39f190b72c internal: refactor unresolved extern crate diagnostic 2021-06-13 16:05:43 +03: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
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
Maan2003
705f7e6e26
clippy::clone_on_copy 2021-06-13 09:27:19 +05:30
Maan2003
c9b4ac5be4
clippy::redudant_borrow 2021-06-13 09:24:16 +05:30
Aleksey Kladov
7731714578 internal: move diagnostics infra to hir 2021-06-12 22:05:23 +03:00
Aleksey Kladov
6940cfed1e Move some hir_ty diagnostics to hir 2021-06-12 21:00:22 +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
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]
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
Kirill Bulatov
3aaf07b8cb Add more profiling for flyimports 2021-06-10 23:43:46 +03:00
Lukas Wirth
ae8d74ab2c Implement dummy expansions for builtin attributes 2021-06-09 18:27:08 +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]
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
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
Jonas Schievink
8482329d65 source_to_def: skip items with no def 2021-06-08 16:42:48 +02:00
bors[bot]
2f376f7475
Merge #9169
9169: internal: steps towards attribute macro token mapping r=jonas-schievink a=jonas-schievink

This doesn't work yet, but we seem to be getting a bit further along (for example, we now stop highlighting `use` items inside item with attribute macros as if they were written verbatim).

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-06-07 17:37:48 +00:00
Jonas Schievink
33be5762e5 Attempt to track attr macros during highlighting 2021-06-07 19:32:28 +02:00
Jonas Schievink
33e747d786 Make "expand macro" command work with attribute macros 2021-06-07 16:05:36 +02:00
Jade
8a57c73640 feat: goto definition on an impl fn goes to that fn in the trait
e.g. if you have a trait T and `impl T for S` for some struct, if you
goto definition on some function name inside the impl, it will go to the
definition of that function inside the `trait T` block, rather than the
current behaviour of not going anywhere at all.
2021-06-06 21:51:17 -07:00
Jonas Schievink
8d87f9b298 Handle attribute macros in descend_into_macros 2021-06-06 17:03:37 +02:00
Jonas Schievink
e5a2c6596d Expand procedural attribute macros 2021-06-03 18:09:21 +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
Jonas Schievink
cb5454db86 Diagnose unimplemented built-in macros 2021-05-30 04:19:47 +02:00
Jonas Schievink
8c639a87bd Thread proc-macro types through the HIR 2021-05-29 20:32:57 +02:00
Laurențiu Nicola
2268a220e4 Don't store supertraits in ItemTree 2021-05-27 16:52:30 +03:00
Jonas Schievink
33debc4065 Update salsa 2021-05-27 15:05:41 +02:00
bors[bot]
d0a4ba294c
Merge #8997
8997: internal: stop expanding UseTrees during ItemTree lowering r=jonas-schievink a=jonas-schievink

Closes https://github.com/rust-analyzer/rust-analyzer/issues/8908

Messy diff, but `ItemTree` lowering got simpler, since we now have a strict 1-to-1 mapping between `ast::Item` and `ModItem`.

The most messy part is mapping a single `UseTree` back to its `ast::UseTree` counterpart for diagnostics, but I think the ad-hoc source map built during lowering does the job.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-05-27 11:56:26 +00:00
Lukas Wirth
26e784a575 simplify 2021-05-26 21:09:27 +02:00
Jonas Schievink
b52df91877 Stop expanding UseTrees during ItemTree lowering 2021-05-26 01:01:58 +02:00