Evgenii P
f1e62501c3
Fix for<'lifetime> for types specified by path
2019-08-11 16:56:05 +07:00
bors[bot]
e3f8e6023d
Merge #1673
...
1673: Move numeric names inside of `NameRef` r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-08-09 10:17:47 +00:00
Aleksey Kladov
f3ee5a1509
Move numeric names inside of NameRef
2019-08-09 12:16:47 +02:00
bors[bot]
5f82012779
Merge #1669
...
1669: Parse tuple struct field initialization r=matklad a=eupn
Closes #1218 .
This PR modifies the parser to accept the following code:
```rust
fn main() {
struct TupleStruct(usize);
let s = TupleStruct {
0: 1usize,
};
dbg!(s.0);
}
```
<details><summary>with following AST:</summary>
```
SOURCE_FILE@[0; 118)
FN_DEF@[0; 116)
FN_KW@[0; 2) "fn"
WHITESPACE@[2; 3) " "
NAME@[3; 7)
IDENT@[3; 7) "main"
PARAM_LIST@[7; 9)
L_PAREN@[7; 8) "("
R_PAREN@[8; 9) ")"
WHITESPACE@[9; 10) " "
BLOCK@[10; 116)
L_CURLY@[10; 11) "{"
WHITESPACE@[11; 16) "\n "
STRUCT_DEF@[16; 42)
STRUCT_KW@[16; 22) "struct"
WHITESPACE@[22; 23) " "
NAME@[23; 34)
IDENT@[23; 34) "TupleStruct"
POS_FIELD_DEF_LIST@[34; 41)
L_PAREN@[34; 35) "("
POS_FIELD_DEF@[35; 40)
PATH_TYPE@[35; 40)
PATH@[35; 40)
PATH_SEGMENT@[35; 40)
NAME_REF@[35; 40)
IDENT@[35; 40) "usize"
R_PAREN@[40; 41) ")"
SEMI@[41; 42) ";"
WHITESPACE@[42; 47) "\n "
LET_STMT@[47; 94)
LET_KW@[47; 50) "let"
WHITESPACE@[50; 51) " "
BIND_PAT@[51; 52)
NAME@[51; 52)
IDENT@[51; 52) "s"
WHITESPACE@[52; 53) " "
EQ@[53; 54) "="
WHITESPACE@[54; 55) " "
STRUCT_LIT@[55; 93)
PATH@[55; 66)
PATH_SEGMENT@[55; 66)
NAME_REF@[55; 66)
IDENT@[55; 66) "TupleStruct"
WHITESPACE@[66; 67) " "
NAMED_FIELD_LIST@[67; 93)
L_CURLY@[67; 68) "{"
WHITESPACE@[68; 77) "\n "
NAMED_FIELD@[77; 86)
NAME_REF@[77; 78)
INT_NUMBER@[77; 78) "0"
COLON@[78; 79) ":"
WHITESPACE@[79; 80) " "
LITERAL@[80; 86)
INT_NUMBER@[80; 86) "1usize"
COMMA@[86; 87) ","
WHITESPACE@[87; 92) "\n "
R_CURLY@[92; 93) "}"
SEMI@[93; 94) ";"
WHITESPACE@[94; 104) "\n \n "
EXPR_STMT@[104; 114)
MACRO_CALL@[104; 113)
PATH@[104; 107)
PATH_SEGMENT@[104; 107)
NAME_REF@[104; 107)
IDENT@[104; 107) "dbg"
EXCL@[107; 108) "!"
TOKEN_TREE@[108; 113)
L_PAREN@[108; 109) "("
IDENT@[109; 110) "s"
DOT@[110; 111) "."
INT_NUMBER@[111; 112) "0"
R_PAREN@[112; 113) ")"
SEMI@[113; 114) ";"
WHITESPACE@[114; 115) "\n"
R_CURLY@[115; 116) "}"
WHITESPACE@[116; 118) "\n\n"
```
</summary>
Co-authored-by: Evgenii P <eupn@protonmail.com>
2019-08-09 09:21:50 +00:00
Evgenii P
fa24e20867
Make name_ref to accept numeric names optionally
2019-08-09 16:08:36 +07:00
Evgenii P
957b5ed23a
Parse tuple struct field initialization
2019-08-09 15:38:52 +07:00
bors[bot]
2fbec23d99
Merge #1668
...
1668: Reduce code duplication in lexer r=matklad a=eupn
During an investigation of a fix for #1218 , I stumbled upon some code duplication in the lexer.
Co-authored-by: Evgenii P <eupn@protonmail.com>
2019-08-09 08:11:26 +00:00
Evgenii P
db4839033c
Change macro to function
2019-08-09 15:04:13 +07:00
Evgenii P
073cf42391
rustfmt
2019-08-09 14:23:13 +07:00
Evgenii P
f4a6d92050
Reduce code duplication in lexer by introducing small macro
2019-08-09 14:08:34 +07:00
bors[bot]
87608904f6
Merge #1661
...
1661: Parse function parameters attributes r=matklad a=eupn
Fixes #1397 . The [RFC-2565](https://github.com/rust-lang/rfcs/blob/master/text/2565-formal-function-parameter-attributes.md ) specifies `#[attributes]` to function parameters:
```rust
fn foo(#[attr] a, #[unused] b, #[must_use] ...) {
// ...
}
```
This PR adds those attributes into grammar and to the parser, extending corresponding inline tests.
Co-authored-by: Evgenii P <eupn@protonmail.com>
2019-08-08 13:04:28 +00:00
Evgenii P
6fa2d82147
Fix parser tests according to review
2019-08-08 09:12:07 +07:00
Evgenii P
77f4ab3e9b
Deduplicate while loop break condition
2019-08-08 08:58:28 +07:00
bors[bot]
de4523fae0
Merge #1664
...
1664: assoc types bounds r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-08-07 19:00:38 +00:00
Aleksey Kladov
d6ab1af086
assoc types bounds
2019-08-07 21:00:02 +02:00
bors[bot]
fc40e42003
Merge #1663
...
1663: architecture.md: update path to parser tests r=matklad a=eupn
Co-authored-by: eupn <36292692+eupn@users.noreply.github.com>
2019-08-07 18:31:37 +00:00
bors[bot]
d74af56248
Merge #1662
...
1662: architecture.md: "finish not Y" -> "finish node Y" r=matklad a=eupn
Is this a typo?
Co-authored-by: eupn <36292692+eupn@users.noreply.github.com>
2019-08-07 18:21:33 +00:00
Evgenii P
79d4202194
Fix parser to correctly consume outer attrs before ellipsis param
2019-08-08 00:36:19 +07:00
eupn
3c09c8105d
architecture.md: update path to parser tests
2019-08-08 00:23:10 +07:00
eupn
61f42cc647
architecture.md: "finish not Y" -> "finish node Y"
...
Is this a typo?
2019-08-08 00:18:47 +07:00
Evgenii P
9ea36703d2
Fix variadic arg inline test
2019-08-07 23:48:21 +07:00
Evgenii P
3fb58c620c
Add function parameters attributes
2019-08-07 23:42:28 +07:00
bors[bot]
c5b44975b8
Merge #1660
...
1660: implement while let desugaring r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-08-07 13:16:06 +00:00
Aleksey Kladov
6efc79b89d
implement while let desugaring
2019-08-07 15:14:22 +02:00
Aleksey Kladov
39967a85e1
refactor if-let lowering
...
mainly to get rid of unwraps
2019-08-07 13:57:24 +02:00
Aleksey Kladov
4d6475ada0
refactor if lowering
2019-08-07 12:32:32 +02:00
bors[bot]
9ea4ae680a
Merge #1659
...
1659: install server first r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-08-07 10:25:22 +00:00
Aleksey Kladov
a2966944a8
install server first
...
closes #1658
2019-08-07 12:12:23 +02:00
bors[bot]
7e12422fa2
Merge #1652
...
1652: Improve type hints behavior r=matklad a=SomeoneToIgnore
This PR fixed the following type hints issues:
* Restructures the `InlayKind` enum contents based on the discussion here: https://github.com/rust-analyzer/rust-analyzer/pull/1606#issuecomment-515968055
* Races described in #1639
* Caches the latest decorations received for each file to show them the next time the file is opened (instead of a new server request)
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2019-08-06 16:50:49 +00:00
bors[bot]
811492aa54
Merge #1657
...
1657: Ignore r=matklad a=matklad
closes #1616
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-08-06 12:54:49 +00:00
Aleksey Kladov
3d45da9bca
fix tests
2019-08-06 14:41:22 +02:00
Aleksey Kladov
deea8f52d9
allow to exclude certain files and directories
2019-08-06 14:28:31 +02:00
Aleksey Kladov
058c2daba1
push glob errors outwards
2019-08-06 14:28:31 +02:00
Aleksey Kladov
f70b7e1f07
rename config
2019-08-06 14:28:31 +02:00
Aleksey Kladov
34203256bf
introduce ra_vfs_glob crate
...
It manages exclusion rules for the vfs crate
2019-08-06 14:28:31 +02:00
bors[bot]
c971869104
Merge #1656
...
1656: cargo update r=kjeremy a=kjeremy
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-08-06 12:09:45 +00:00
Jeremy Kolb
f7bdf9d268
cargo update
2019-08-06 07:56:18 -04:00
bors[bot]
cf5d478b67
Merge #1655
...
1655: cleanup imports r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-08-06 08:59:53 +00:00
Aleksey Kladov
6cf56b6615
cleanup imports
2019-08-06 10:57:16 +02:00
Aleksey Kladov
d751bd08bf
cleanup
2019-08-06 10:57:16 +02:00
Aleksey Kladov
0e4a542cfb
rename
2019-08-06 10:50:32 +02:00
bors[bot]
e01c6b4e1b
Merge #1654
...
1654: use Conv for severity r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-08-06 07:50:41 +00:00
Aleksey Kladov
27303da419
use Conv for severity
2019-08-06 09:50:00 +02:00
Kirill Bulatov
c5598d9ade
Avoid shared mutable state
2019-08-05 23:11:16 +03:00
bors[bot]
12a7329cb3
Merge #1648
...
1648: Optimize parsing a little r=lnicola a=lnicola
This is the change from https://github.com/rust-analyzer/rust-analyzer/issues/1643#issuecomment-517979911 . In the long run we should probably take a different approach, but until then this provides a decent speed-up (10.5s vs 11.5s according to `ra_cli analysis-stats`.
EDIT: Does the profiling part make sense? I'm not sure if all parsing happens before the type inference begins or it's lazy.
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2019-08-05 13:55:17 +00:00
Laurențiu Nicola
f1cfd5ec3d
Update crates/ra_cli/src/analysis_stats.rs
...
Co-Authored-By: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-08-05 16:53:54 +03:00
Laurențiu Nicola
b118f7511c
Optimize Parser::is_composite a little
2019-08-05 16:53:54 +03:00
Laurențiu Nicola
6f5ac06b47
Display the parsing time in ra_cli analysis-stats
2019-08-05 16:53:54 +03:00
Kirill Bulatov
777552b6a8
Cache decorations before the first change only
2019-08-05 13:41:02 +03:00
bors[bot]
a490f80a9c
Merge #1642
...
1642: Add test for #1540 r=matklad a=kjeremy
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-08-05 10:12:24 +00:00