Florian Diebold
dfe95d735b
Remove Arc from RawVisibility
...
Now that it's not used as a direct query return value anymore, it doesn't need
to be cheaply cloneable anymore.
2019-12-26 16:42:57 +01:00
Florian Diebold
04cf98f8a6
Fix cross-crate glob privacy handling
2019-12-26 16:31:38 +01:00
Florian Diebold
78111620a3
Remove visibility query, instead add struct field visibility to data
...
Methods should be handled the same, and for items the visibility will be in the
def map.
2019-12-26 16:23:40 +01:00
Florian Diebold
50ebff257d
Rename ResolvedVisibility -> Visibility
2019-12-26 16:23:40 +01:00
Florian Diebold
e1a2961273
Rename Visibility -> RawVisibility
2019-12-26 16:23:40 +01:00
Florian Diebold
04e8eaa14b
Handle privacy for modules
2019-12-26 16:23:40 +01:00
Florian Diebold
21359c3ab5
Take visibility into account for glob imports
2019-12-26 16:23:40 +01:00
Florian Diebold
8ac25f119e
Keep track of visibility during def collection
2019-12-26 16:23:40 +01:00
Florian Diebold
79c90b5641
Collect visibility of items during nameres
2019-12-26 16:23:40 +01:00
Florian Diebold
c31dae2aca
Add doc comment
2019-12-26 16:23:40 +01:00
Florian Diebold
8aeaf93b9a
Make enum variant fields public
2019-12-26 16:23:40 +01:00
Florian Diebold
9e9c4be48a
Hide completions for private struct fields
2019-12-26 16:23:40 +01:00
Florian Diebold
ca15cf422c
Add visibility in code model for fields
2019-12-26 16:23:40 +01:00
Florian Diebold
1ce809d0fa
Add logic for resolving and checking visibility
2019-12-26 16:23:40 +01:00
Florian Diebold
069bf55cca
Add infrastructure for visibility on syntax and hir_def level
2019-12-26 16:23:40 +01:00
bors[bot]
97f01396ed
Merge #2658
...
2658: Only add features flags if non-empty r=matklad a=edwin0cheng
This prevent error when disabled `all-features` in a cargo workspace, because of `--features is not allowed in the root of a virtual workspace` when running `cargo metadata`.
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-25 20:26:08 +00:00
bors[bot]
24e552fadf
Merge #2663
...
2663: Fill in type params in 'add missing impl members' assist r=flodiebold a=flodiebold
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-12-25 19:26:18 +00:00
Emil Lauridsen
0cdbd08149
Keep VSCode config mostly backwards compatible
2019-12-25 20:26:06 +01:00
Emil Lauridsen
71d2d81dcc
Some documentatioN
2019-12-25 19:56:07 +01:00
Emil Lauridsen
069c165536
Actually respect disabling cargo check functionality
2019-12-25 19:17:54 +01:00
Emil Lauridsen
f7d04d0575
Re-format ra_lsp_server changes
2019-12-25 19:14:30 +01:00
Emil Lauridsen
178c23f505
Re-implement status display using LSP 3.15 progress event
2019-12-25 19:08:44 +01:00
Emil Lauridsen
c21fbc3e87
Migrate tests from extension to rust
2019-12-25 17:37:40 +01:00
Emil Lauridsen
17360b5d14
Fix use of wrong message in diagnostic
2019-12-25 17:37:40 +01:00
Emil Lauridsen
6af4bf7a8d
Configuration plumbing for cargo watcher
2019-12-25 17:37:40 +01:00
Emil Lauridsen
66e8ef53a0
Initial implementation of cargo check watching
2019-12-25 17:37:40 +01:00
Florian Diebold
c39352fa43
Fill in type params in 'add missing impl members' assist
2019-12-24 17:29:27 +01:00
bors[bot]
3f7e5cde0b
Merge #2661
...
2661: Implement infer await from async function r=flodiebold a=edwin0cheng
This PR is my attempt for trying to add support for infer `.await` expression from an `async` function, by desugaring its return type to `Impl Future<Output=RetType>`.
Note that I don't know it is supposed to desugaring it in that phase, if it is not suitable in current design, just feel free to reject it :)
r=@flodiebold
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-24 16:28:46 +00:00
Edwin Cheng
208ad97fdc
Remove AsyncOwner
2019-12-25 00:25:18 +08:00
Edwin Cheng
42813126d9
Check if parameters is empty
2019-12-25 00:12:29 +08:00
Edwin Cheng
3a2cf708ed
Add FIXME
2019-12-24 23:39:17 +08:00
Edwin Cheng
d0537cda9e
Formatting
2019-12-24 20:30:39 +08:00
Edwin Cheng
0edb5b4a50
Implement infer await from async func
2019-12-24 19:45:28 +08:00
Kirill Bulatov
242be3631e
Omit closure parameters
2019-12-23 18:30:25 +02:00
Edwin Cheng
4ee3c5202e
Only add features flags if non-empty
2019-12-24 00:27:48 +08:00
Jeremy Kolb
019fab2261
lsp-types 0.67
2019-12-23 09:33:49 -05:00
Edwin Cheng
12cc2ed557
Use pre-stored macro file
2019-12-23 21:56:10 +08:00
bors[bot]
ce07a2daa9
Merge #2636
...
2636: Chalk update and refactoring r=flodiebold a=flodiebold
This updates the Chalk integration to https://github.com/rust-lang/chalk/pull/311 , which will presumably get merged soon, and refactors it some more, most notably introducing our own `TypeFamily` instead of reusing `ChalkIr`. It's still mostly the same as `ChalkIr` though, except for using Salsa `InternId`s directly.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-12-23 10:58:06 +00:00
John-John Tedro
700e74df4a
Bump lsp-types to 0.66.0 ( fixes #2651 )
2019-12-23 11:03:41 +01:00
Edwin Cheng
16156d766d
Add macro call support for type_of
2019-12-23 13:19:01 +08:00
Florian Diebold
1f7f4578f7
Filter out error predicates in type bounds as well
2019-12-23 00:08:03 +01:00
Florian Diebold
4053fcfca0
Introduce our own Chalk TypeFamily, instead of using ChalkIr
...
It's not very different, except we can directly use Salsa IDs instead of casting
them. This means we need to refactor the handling of errors to get rid of
UNKNOWN_TRAIT though.
2019-12-23 00:08:03 +01:00
Florian Diebold
6b5efe5bda
Refactor Chalk integration some more
2019-12-23 00:08:03 +01:00
Florian Diebold
67a2555f6d
Update Chalk, clean up Chalk integration a bit
2019-12-23 00:08:03 +01:00
Aleksey Kladov
e424545c0f
Rudimentary name resolution for local items
2019-12-22 22:41:21 +01:00
Aleksey Kladov
7c405c0156
Simplify
2019-12-22 19:32:35 +01:00
Aleksey Kladov
007032f850
Refactor
2019-12-22 19:31:01 +01:00
Aleksey Kladov
baee746185
Share impl Scope between modules and blocks
2019-12-22 15:52:35 +01:00
Aleksey Kladov
6c3ddcfa50
Simplify
2019-12-22 15:37:53 +01:00
Aleksey Kladov
e8da7d4061
Remove unused parameters
2019-12-22 15:31:30 +01:00
Aleksey Kladov
558956c84b
Remove import field
2019-12-22 15:28:55 +01:00
Aleksey Kladov
2c60f42825
Separate defs from imports
2019-12-22 15:21:48 +01:00
Aleksey Kladov
e69af85962
Refactor PerNs construction
2019-12-22 15:10:19 +01:00
Aleksey Kladov
fe38fffaa9
Minor rename
2019-12-22 15:04:31 +01:00
Aleksey Kladov
08df355375
More compact profiling display
2019-12-22 14:17:31 +01:00
Aleksey Kladov
6acef5a7c0
Don't fire no-op changes after files are saved to disk
2019-12-22 13:56:19 +01:00
bors[bot]
436df298ba
Merge #2642
...
2642: Use name instead of ident in parser for macro 2.0 syntax r=matklad a=edwin0cheng
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-22 08:05:02 +00:00
bors[bot]
d33493d779
Merge #2641
...
2641: Parse const generics r=matklad a=roblabla
Adds very primitive support for parsing const generics (`const IDENT: TY`) so that rust-analyzer stops complaining about the syntax being invalid.
Fixes #1574
Fixes #2281
Co-authored-by: roblabla <unfiltered@roblab.la>
2019-12-22 07:56:33 +00:00
Edwin Cheng
737045c1ea
Use name instead of ident for macro 2.0 sytnax
2019-12-22 11:11:10 +08:00
roblabla
b04d4a88d1
Parse const generics
...
Fixes #1574
Fixes #2281
2019-12-22 01:32:08 +00:00
Jeremy Kolb
4ef5cd9a89
Add some module docs
2019-12-21 15:27:38 -05:00
Aleksey Kladov
e903f58d29
More profiling
2019-12-21 19:44:08 +01:00
bors[bot]
f874d6c475
Merge #2637
...
2637: Optimize and profile r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-21 17:46:52 +00:00
Aleksey Kladov
d4b135f38c
Optimize and profile
2019-12-21 18:46:21 +01:00
Aleksey Kladov
1a8f2aa024
Move LocalImportId
2019-12-21 17:34:28 +01:00
Aleksey Kladov
02f79e37ca
Remove import source map
2019-12-21 17:26:28 +01:00
Aleksey Kladov
ec56f59ac1
Remove import from resolution
2019-12-21 17:26:28 +01:00
Aleksey Kladov
4e0168ec14
Remove imports from hir
2019-12-21 15:18:14 +01:00
Aleksey Kladov
973b5cf7e2
Revert "Merge #2629 "
...
This reverts commit cdc9d682b0
, reversing
changes made to 90ef070db3
.
2019-12-21 15:04:33 +01:00
Florian Diebold
2058f704cb
Add dummy implementations of env! and option_env! builtins
...
They don't do anything except return the correct type.
Also refactor the builtin macro tests a bit.
2019-12-21 13:34:43 +01:00
bors[bot]
cdc9d682b0
Merge #2629
...
2629: Remove imports from hir r=matklad a=matklad
We only used them to avoid self-confirming completions (`use self::foo`), but that can be handled more locally.
bors r+
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-21 11:48:12 +00:00
Aleksey Kladov
2d3fdf3fb5
Privatize LocalImportID
2019-12-21 12:47:34 +01:00
Aleksey Kladov
d335311893
Remove import source map
2019-12-21 12:45:33 +01:00
Aleksey Kladov
ab7a70fb14
Don't track imports
2019-12-21 12:38:40 +01:00
Aleksey Kladov
67ba9072fa
Remove hir for imports
2019-12-21 12:18:20 +01:00
bors[bot]
90ef070db3
Merge #2628
...
2628: Add macro 2.0 support in parser r=matklad a=edwin0cheng
This PR added a new syntax kind : `MACRO_DEF` and a keyword `MACRO_KW`
there are two syntax for declarative macro 2.0 :
1. Normal : `macro m { ($i:ident) => {} }` , which handle similar to legacy one.
2. Call like: `macro m($i:ident) {}`, it produces a single token tree which have two child token trees : `($i:ident)` and `{}`
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-21 10:47:47 +00:00
Edwin Cheng
4195c0e5f9
Add macro keyword to ITEM_RECOVERY_SET
2019-12-21 18:42:17 +08:00
Edwin Cheng
bea8f58118
Add macro 2.0 support in parser
2019-12-21 18:29:14 +08:00
bors[bot]
3ebf15c9b2
Merge #2626
...
2626: Recursive collect macros in impl items r=matklad a=edwin0cheng
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-21 10:12:18 +00:00
bors[bot]
b902d4403a
Merge #2627
...
2627: Use SelectionRange from LSP 3.15 r=matklad a=kjeremy
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-12-21 10:01:42 +00:00
bors[bot]
1cbef27ff8
Merge #2625
...
2625: Clippy lints r=matklad a=kjeremy
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-12-21 06:12:36 +00:00
Jeremy Kolb
429199d481
Use SelectionRange from LSP 3.15
2019-12-20 18:57:31 -05:00
Edwin Cheng
c1166697a7
Add a limit for protect against infinite recursion
2019-12-21 05:16:29 +08:00
Edwin Cheng
360de5ba71
Recursive collect macros in impl items
2019-12-21 05:02:31 +08:00
kjeremy
0d5d63a80e
Clippy lints
2019-12-20 15:14:30 -05:00
bors[bot]
6eab968c60
Merge #2624
...
2624: Separate module item from module scope r=matklad a=matklad
bors r+
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-20 19:51:03 +00:00
bors[bot]
f578cd2182
Merge #2623
...
2623: Add support macros in impl blocks r=matklad a=edwin0cheng
This PR add support for macros in impl blocks, which reuse `Expander` for macro expansion.
see also: #2459
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-20 19:42:46 +00:00
Edwin Cheng
ad81d1dbc1
Add support macros in impl blocks
2019-12-21 03:37:03 +08:00
Aleksey Kladov
f5947be0ea
Simplify
2019-12-20 20:15:54 +01:00
bors[bot]
02f9e04ee9
Merge #2617
...
2617: Remove index resolving from hover r=matklad a=kjeremy
I have left in `HoverResult`'s support for multiple entries because we may still want that at some point.
Per https://github.com/rust-analyzer/rust-analyzer/issues/2542#issuecomment-565238142
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-12-20 18:16:16 +00:00
Florian Diebold
44b00aed4a
Coerce closures to fn pointers
...
E.g. `let x: fn(A) -> B = |x| { y };`
2019-12-20 18:54:33 +01:00
Florian Diebold
9c3f00a906
Fix coercion of last expression in function body
2019-12-20 18:28:21 +01:00
Florian Diebold
2a8c9100bf
Handle closure return types
...
Fixes #2547 .
2019-12-20 18:16:11 +01:00
kjeremy
77626d7bda
Remove unused imports
2019-12-20 11:18:24 -05:00
kjeremy
428358925c
Remove the index resolution from hover
...
We are reasonably precise now to do this.
2019-12-20 11:16:47 -05:00
Aleksey Kladov
7a862f0d47
Make legacy macros private
2019-12-20 17:12:20 +01:00
Aleksey Kladov
af42cb5981
Privitize impls
2019-12-20 16:55:38 +01:00
Aleksey Kladov
7adb53319d
Make items private
2019-12-20 16:52:02 +01:00
Aleksey Kladov
e6b1194f2f
Move some code to scope
2019-12-20 16:52:02 +01:00
Aleksey Kladov
4f9e3f3632
Fix typos
2019-12-20 16:52:02 +01:00