Commit Graph

125 Commits

Author SHA1 Message Date
Aleksey Kladov
7910202ecd tiny simplification 2019-09-09 13:23:41 +03:00
Aleksey Kladov
b2be998b7b better error recovery for use trees 2019-09-05 19:53:07 +03:00
Aleksey Kladov
3c2dea7f55 always wrap block into an expression 2019-09-02 20:15:51 +03:00
Aleksey Kladov
c89abd4262 simplify 2019-09-02 18:58:21 +03:00
Aleksey Kladov
32bebfaf0e cleanup 2019-09-02 17:37:48 +03:00
Dylan MacKenzie
c08ad1cf8a Handle Struct { box i } syntax
Named structs can have `box` patterns that will bind to their fields.
This is similar to the behavior of the `ref` and `mut` fields, but is at
least a little bit surprising.
2019-08-23 16:20:18 -07:00
Dylan MacKenzie
83433cd1f0 Centralize box pattern tests in patterns.rs 2019-08-23 16:19:53 -07:00
Dylan MacKenzie
ab51f57e1d Parse BoxPat 2019-08-23 16:07:11 -07:00
Dylan MacKenzie
e6f3790106 Add BoxPat variant 2019-08-23 15:11:34 -07:00
Aleksey Kladov
5b18a4eef9 rename struct -> record, pos -> tuple 2019-08-23 16:59:50 +03:00
Dylan MacKenzie
3e14b16c4d Add test for nested box pattern 2019-08-22 12:53:54 -07:00
Dylan MacKenzie
f3b320adf4 Add BOX_KW to PATTERN_FIRST 2019-08-22 12:33:03 -07:00
Aleksey Kladov
00ccc6c292 use derive(Debug) for SyntaxKind 2019-08-19 13:11:51 +03:00
Aleksey Kladov
038975b348 plug new boilerplate_gen into ra_tools 2019-08-19 12:26:34 +03:00
Aleksey Kladov
832b40a075 use new quote-generated syntax kinds 2019-08-19 11:42:39 +03:00
bors[bot]
5ed6a13a2c Merge #1685
1685: fix error of RangeFrom in for-loop r=DJMcNab a=bravomikekilo

fix [issue-1542](https://github.com/rust-analyzer/rust-analyzer/issues/1542) @matklad 

Co-authored-by: bravomikekilo <bmk1221@126.com>
2019-08-15 05:49:13 +00:00
bors[bot]
19e0d7d596 Merge #1676
1676: Fix for<'lifetime> for types specified by path r=matklad a=eupn

Fixes #1467.

Co-authored-by: Evgenii P <eupn@protonmail.com>
2019-08-14 15:10:31 +00:00
bravomikekilo
4f31fed362 fix test position 2019-08-14 21:20:04 +08:00
bravomikekilo
2bebdf0b37 fix error of RangeFrom in for-loop 2019-08-14 11:55:21 +08:00
Evgenii P
8222a1fddf Fix is_path_start to accept T![<], fix is_path_start usages 2019-08-13 22:36:01 +07:00
bors[bot]
978e3e384b Merge #1636
1636: fix block parse problem r=matklad a=bravomikekilo

try to fix [issue-1598](https://github.com/rust-analyzer/rust-analyzer/issues/1598).

Co-authored-by: bravomikekilo <bmk1221@126.com>
2019-08-13 12:46:47 +00:00
bravomikekilo
eb0e9bd981 add inline test 2019-08-13 18:17:10 +08:00
Evgenii P
f1e62501c3 Fix for<'lifetime> for types specified by path 2019-08-11 16:56:05 +07:00
Aleksey Kladov
f3ee5a1509 Move numeric names inside of NameRef 2019-08-09 12:16:47 +02: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]
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
Aleksey Kladov
d6ab1af086 assoc types bounds 2019-08-07 21:00:02 +02:00
Evgenii P
79d4202194 Fix parser to correctly consume outer attrs before ellipsis param 2019-08-08 00:36:19 +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
Laurențiu Nicola
b118f7511c Optimize Parser::is_composite a little 2019-08-05 16:53:54 +03:00
bravomikekilo
562359d706 fix block parse problem 2019-08-03 19:57:07 +08:00
csmoe
8fe58c3598 fix: parse box syntax inside parentheses 2019-07-22 20:52:10 +08:00
Unreal Hoang
3a7f07c62d
add await to syntax, parser for await_expr 2019-07-20 17:41:31 +09:00
Aleksey Kladov
1834bae5b8 allow rustfmt to reorder imports
This wasn't a right decision in the first place, the feature flag was
broken in the last rustfmt release, and syntax highlighting of imports
is more important anyway
2019-07-04 23:09:09 +03:00
Ryan Cumming
2959aa446e Remove parse error on array initializer attributes
This is actually allowed by the `rustc` parser but most attributes will
fail later due to attributes on expressions being experimental.
2019-06-30 19:55:50 +10:00
Ryan Cumming
b01496538c Support attributes on array members
Array members are allow to have attributes such as `#[cfg]`.

This is a bit tricky as we don't know if the first expression is an
initializer or a member until we encounter a `;`. This reuses a trick
from `stmt` where we remember if we saw an attribute and then raise an
error if the first expression ends up being an initializer.

This isn't perfect as the error isn't correctly located on the attribute
or initializer; it ends up immediately after the `;`.
2019-06-30 18:36:54 +10:00
zjy
de930237ff fixed #1384 2019-06-28 15:22:17 +08:00
bors[bot]
67ecc88f66 Merge #1415
1415: fix: specialization r=matklad a=csmoe

Closes #1402 
r? @matklad 

Co-authored-by: csmoe <csmoe@msn.com>
2019-06-24 10:10:05 +00:00
csmoe
d04473accb fix: specialization(with blindly parsing)
Change-Id: Ic5d2767e8781568d76d4d0013cd6081e95ae8a95
2019-06-19 18:37:38 +08:00
csmoe
d6533994e4 fix: box_pattern
Change-Id: I45a856d74fb616d3bce33050f9e69d327186bd59
2019-06-19 14:28:50 +08:00
csmoe
5999733ca6 fix: box_syntax(#1412)
Change-Id: I6e20e0163fa545de37226c1561b3b7103615626c
2019-06-18 21:46:47 +08:00
csmoe
2ca9f71897 fix: support existential type 2019-06-12 14:32:39 +00:00
csmoe
205a8278a9 fix: never type with binding
Change-Id: I14e1bc628b9d2dfdb1f40de3d3707f4e872767f2
2019-06-07 19:49:49 +08:00
Andrey Tkachenko
505b8d873f [#1083] Try block syntax: fix tests 2019-06-06 16:26:54 +04:00
Andrey Tkachenko
281c9eeaff [#1083] Try block syntax 2019-06-06 15:43:26 +04:00
Alan Du
4e449fb0b0 Fix clippy::if_same_then_else 2019-06-04 18:05:07 -04:00