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
bors[bot]
825afb0854
Merge #2622
...
2622: Simplify r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-20 19:17:28 +00:00
Aleksey Kladov
f5947be0ea
Simplify
2019-12-20 20:15:54 +01:00
bors[bot]
9467f81c58
Merge #2620
...
2620: Update packages r=matklad a=kjeremy
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-12-20 19:09:02 +00:00
kjeremy
6049f60a05
Protect against null as revealed by npm test
2019-12-20 13:52:34 -05:00
kjeremy
be78e3c224
Update to latest packages
2019-12-20 13:52:11 -05: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
bors[bot]
979cbb496e
Merge #2619
...
2619: Coerce closures to fn pointers r=flodiebold a=flodiebold
E.g. `let x: fn(A) -> B = |x| { y };`
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2019-12-20 17:58:59 +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
bors[bot]
1d7931e5ff
Merge #2618
...
2618: Fix coercion of last expression in function body r=flodiebold a=flodiebold
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2019-12-20 17:29:11 +00:00
Florian Diebold
9c3f00a906
Fix coercion of last expression in function body
2019-12-20 18:28:21 +01:00
bors[bot]
99d6f544f2
Merge #2616
...
2616: Handle closure return types r=flodiebold a=flodiebold
Fixes #2547 .
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2019-12-20 17:18:52 +00: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
Aleksey Kladov
1b8ce5b37b
Move impls to ItemScope
2019-12-20 16:52:02 +01:00
Aleksey Kladov
030e540ad1
Reduce visibility
2019-12-20 16:52:02 +01:00
Aleksey Kladov
2ce1aa32c4
Rename ModuleScope -> ItemScope
2019-12-20 16:52:02 +01:00
Aleksey Kladov
16ac792f48
Docs
2019-12-20 16:52:02 +01:00
Aleksey Kladov
0f212b3798
Move ModuleScope to a new module
2019-12-20 16:52:02 +01:00
Aleksey Kladov
49aac9ef63
Add item_scope module
2019-12-20 16:52:02 +01:00
bors[bot]
cfc50ff160
Merge #2615
...
2615: Fix wrong path parsing for macro call in pattern position r=edwin0cheng a=edwin0cheng
The parser incorrectly insert a `PathPat` inside `MacroCall` syntax node when parsing inside a pattern position, for example :
```rust
let foo!() = 0;
```
become:
```
MACRO_CALL@[60; 66)
PATH_PAT@[60; 63) <------------- It should not exist
PATH@[60; 63)
PATH_SEGMENT@[60; 63)
NAME_REF@[60; 63)
IDENT@[60; 63) "foo"
EXCL@[63; 64) "!"
TOKEN_TREE@[64; 66)
L_PAREN@[64; 65) "("
R_PAREN@[65; 66) ")"
```
This PR fix this bug and add some test to make sure goto-defintion works for macro inside pattern.
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-20 15:30:36 +00:00
Edwin Cheng
4a7e19946a
Fix parser for macro call in pattern position
2019-12-20 23:26:04 +08:00
bors[bot]
af5e2abe15
Merge #2614
...
2614: Clippy cleanup r=matklad a=kjeremy
Just a few tweaks from the latest clippy. There are a lot more but we should probably tweak our settings.
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-12-20 14:46:24 +00:00
kjeremy
f22aabc136
Use unwrap_or_default
2019-12-20 09:43:30 -05:00
kjeremy
133b4063a6
Remove useless clone
2019-12-20 09:43:01 -05:00
bors[bot]
d590f6ce12
Merge #2592
...
2592: Add std::ops::Index support for infering r=edwin0cheng a=edwin0cheng
see also #2534
Seem like this can't fix #2534 for this case:
```rust
fn foo3(bar: [usize; 2]) {
let baz = bar[1]; // <--- baz is still unknown ?
println!("{}", baz);
}
```
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-20 14:36:53 +00:00
bors[bot]
81a1b14d78
Merge #2613
...
2613: Remove code that never was alive? r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-20 14:28:41 +00:00
Aleksey Kladov
794bbab70d
Remove code that never was alive?
2019-12-20 15:26:19 +01:00
bors[bot]
890ec6f798
Merge #2612
...
2612: Fix resolve for field init shorthand r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-20 13:50:44 +00:00
Aleksey Kladov
3d4b48e481
Fix resolve for field init shorthand
2019-12-20 14:48:14 +01:00
bors[bot]
a0571359f3
Merge #2611
...
2611: Fix highlighting for field init shorthand r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-20 13:12:39 +00:00
Aleksey Kladov
77af7b087f
Fix highlighting for field init shorthand
2019-12-20 14:12:14 +01:00