Commit graph

3642 commits

Author SHA1 Message Date
Aleksey Kladov
8014116e5f remove dead code 2019-04-02 00:14:57 +03:00
bors[bot]
9282c6d3d0 Merge #1050
1050: Intelligently add parens when inlining local varaibles r=matklad a=gfreezy

fixed this. https://github.com/rust-analyzer/rust-analyzer/pull/1037#discussion_r268627141

Co-authored-by: gfreezy <gfreezy@gmail.com>
2019-04-01 21:05:10 +00:00
gfreezy
4ca51cfbcf intelligently add parens when inlining local varaibles 2019-04-01 22:53:47 +08:00
bors[bot]
56f3524c69 Merge #1082
1082: Async block in argument position r=matklad a=andreytkachenko

Fixes case when async block appears in argument position

Co-authored-by: Andrey Tkachenko <andreytkachenko64@gmail.com>
2019-04-01 11:22:13 +00:00
Andrey Tkachenko
e89b97524a Async block in argument position 2019-04-01 15:15:41 +04:00
bors[bot]
b7e26c32a1 Merge #1067
1067: Take number of arguments at the call-site into account for signature help r=matklad a=kjeremy

Fixes #1065

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-04-01 11:15:34 +00:00
bors[bot]
6e4865de73 Merge #1081
1081: Async closure syntax r=matklad a=robojumper

Fixes #1080.

Also fixes an error introduced by #1072 where something like `async move "foo"` in expression position would trigger the assertion in `block_expr`.

Co-authored-by: robojumper <robojumper@gmail.com>
2019-04-01 10:57:06 +00:00
bors[bot]
42a883f06c Merge #1078
1078: rewrite syntax trees r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-01 09:30:25 +00:00
Aleksey Kladov
9e213385c9 switch to new rowan 2019-04-01 12:06:24 +03:00
robojumper
d43dff43b4 Async closure syntax 2019-03-31 16:35:22 +02:00
bors[bot]
dec9bde108 Merge #1038
1038: Add WherePred to allow predicate access in WhereClause r=matklad a=vipentti

Lifetime bounds in where predicates are now also parsed into `TYPE_BOUND_LIST` to allow unified access to bounds.

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-03-31 10:43:50 +00:00
Ville Penttinen
3f62ab8f51 Add WherePred to allow predicate access in WhereClause
This also unifies parsing of WHERE_PRED bounds, now Lifetime bounds will also be
parsed using TYPE_BOUND_LIST
2019-03-31 13:20:56 +03:00
bors[bot]
4666138c91 Merge #1072
1072: recognize async move blocks r=matklad a=memoryruins

closes #1053 

Co-authored-by: memoryruins <memoryruinsmusic@gmail.com>
2019-03-31 09:18:21 +00:00
bors[bot]
c5ca49678f Merge #1077
1077: Improve parsing of type bounds r=matklad a=vipentti

This adds new TYPE_BOUND_LIST and TYPE_BOUND syntax kinds. These are now used when parsing type bounds. In addition parsing paths inside a bound now does not recursively parse paths, rather they are treated as separate bounds, separated by +.

Basically now the generic params `struct S<T: 'a + ?Sized + (Copy)>;` in will be parsed as 

```
TYPE_PARAM_LIST@[8; 33)
  L_ANGLE@[8; 9)
  TYPE_PARAM@[9; 32)
    NAME@[9; 10)
      IDENT@[9; 10) "T"
    COLON@[10; 11)
    WHITESPACE@[11; 12)
    TYPE_BOUND_LIST@[12; 32)
      TYPE_BOUND@[12; 14)
        LIFETIME@[12; 14) "'a"
      WHITESPACE@[14; 15)
      PLUS@[15; 16)
      WHITESPACE@[16; 17)
      TYPE_BOUND@[17; 23)
        QUESTION@[17; 18)
        PATH_TYPE@[18; 23)
          PATH@[18; 23)
            PATH_SEGMENT@[18; 23)
              NAME_REF@[18; 23)
                IDENT@[18; 23) "Sized"
      WHITESPACE@[23; 24)
      PLUS@[24; 25)
      WHITESPACE@[25; 26)
      TYPE_BOUND@[26; 32)
        L_PAREN@[26; 27)
        PATH_TYPE@[27; 31)
          PATH@[27; 31)
            PATH_SEGMENT@[27; 31)
              NAME_REF@[27; 31)
                IDENT@[27; 31) "Copy"
        R_PAREN@[31; 32)
  R_ANGLE@[32; 33)
```

Previously it was parsed, with the paths nested:

```
TYPE_PARAM_LIST@[8; 33)
  L_ANGLE@[8; 9)
  TYPE_PARAM@[9; 32)
    NAME@[9; 10)
      IDENT@[9; 10) "T"
    COLON@[10; 11)
    WHITESPACE@[11; 12)
    LIFETIME@[12; 14) "'a"
    WHITESPACE@[14; 15)
    PLUS@[15; 16)
    WHITESPACE@[16; 17)
    QUESTION@[17; 18)
    PATH_TYPE@[18; 32)
      PATH@[18; 23)
        PATH_SEGMENT@[18; 23)
          NAME_REF@[18; 23)
            IDENT@[18; 23) "Sized"
      WHITESPACE@[23; 24)
      PLUS@[24; 25)
      WHITESPACE@[25; 26)
      L_PAREN@[26; 27)
      PATH_TYPE@[27; 31)
        PATH@[27; 31)
          PATH_SEGMENT@[27; 31)
            NAME_REF@[27; 31)
              IDENT@[27; 31) "Copy"
      R_PAREN@[31; 32)
  R_ANGLE@[32; 33)
```

Looking for feedback.



Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-03-31 09:11:48 +00:00
Ville Penttinen
55dcdb7d09 Add trait ast::TypeBoundsOwner 2019-03-31 10:56:48 +03:00
Ville Penttinen
245c0d8584 Update tests 2019-03-31 10:39:23 +03:00
Ville Penttinen
98cff6ecec Change parsing bounds in path_types
Now bounds inside a path are parsed as DYN_TRAIT_TYPE, previously they would be
parsed as `PATH_TYPE` followed by `TYPE_BOUND_LIST`.

Basically this means `Box<T + 'f>` is now parsed almost the same as
`Box<dyn T + 'f>` with the exception of not having the `dyn` keyword.
2019-03-31 10:38:36 +03:00
Ville Penttinen
e3f9d6555b Move parsing a single TYPE_BOUND to a separate function 2019-03-30 17:23:54 +02:00
Ville Penttinen
bfc2ac90c8 Update tests 2019-03-30 17:11:46 +02:00
Ville Penttinen
23fdc562bf Add new TYPE_BOUND_LIST and TYPE_BOUND syntax kinds
These are now used when parsing type bounds. In addition parsing paths inside a
bound now does not recursively parse paths, rather they are treated as separate
bounds, separated by +.
2019-03-30 17:11:21 +02:00
Aleksey Kladov
23dd53eb35
kill ra.el: it is superseeded by the lsp integraion 2019-03-30 17:52:40 +03:00
bors[bot]
9ebd14a14e Merge #1075
1075: Fix parsing <= in type_args r=matklad a=vipentti

Fixes #1074 

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-03-30 12:21:18 +00:00
Ville Penttinen
444a119220 Fix parsing <= in type_args 2019-03-30 13:52:47 +02:00
Lenard Pratt
7f3bf7cc73 Added defWithBody 2019-03-30 10:50:00 +00:00
Aleksey Kladov
c4dfced1f8
fix typo 2019-03-29 16:51:20 +03:00
Sergey Parilin
ef02c3c038 some PR issues fixed 2019-03-29 15:34:05 +03:00
memoryruins
c7264b4f07 add test for async blocks 2019-03-28 18:54:06 -04:00
memoryruins
abe96a4765 recognize async move 2019-03-28 18:38:59 -04:00
bors[bot]
849d7428aa Merge #1071
1071: Fix emacs-lsp runnables support with native json r=matklad a=flodiebold

(In that case args is a vector, which string-join doesn't like.)

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2019-03-28 20:35:03 +00:00
Florian Diebold
156b1ddf67 Fix emacs-lsp runnables support with native json
(In that case args is a vector, which string-join doesn't like.)
2019-03-28 21:32:17 +01:00
bors[bot]
2a770190b0 Merge #1070
1070: Support extern_crate_self r=matklad a=memoryruins

closes #1069

Co-authored-by: memoryruins <memoryruinsmusic@gmail.com>
2019-03-28 16:19:56 +00:00
memoryruins
7a06282d71 Add tests to ra_syntax for extern_crate_self 2019-03-28 12:15:44 -04:00
memoryruins
f0fcd02013 Add extern_crate_self to ra_parser. 2019-03-28 12:15:18 -04:00
Sergey Parilin
58224bc659 profiling crate first draft 2019-03-27 18:23:26 +03:00
kjeremy
80113876e2 Simplify 2019-03-27 11:02:06 -04:00
kjeremy
7b34c4c002 Take number of arguments at the call-site into account for signature help
Fixes #1065
2019-03-27 10:00:51 -04:00
bors[bot]
de56dba452 Merge #1066
1066: update salsa some more r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-03-27 13:31:38 +00:00
Aleksey Kladov
e8477f3260 update salsa some more 2019-03-27 16:31:13 +03:00
bors[bot]
eeb21dc8cc Merge #1063
1063: ⬆️ salsa r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-03-27 10:39:00 +00:00
Aleksey Kladov
3419fe297a ⬆️ salsa 2019-03-27 13:38:33 +03:00
bors[bot]
9816bc5b2d Merge #1061
1061: Use EXE extension for pre-commit hook on Window r=matklad a=hban

Tested on Git Bash, CMD and Powershell.

Closes: #875 

Co-authored-by: Hrvoje Ban <hban@users.noreply.github.com>
2019-03-27 07:03:24 +00:00
Hrvoje Ban
8890539e40 Use EXE extension for pre-commit hook on Window 2019-03-27 07:52:59 +01:00
bors[bot]
de8f72aad9 Merge #1052
1052: Flip binary expression assist r=matklad a=marcogroppo

Adds an assist that can flip these binary comparison operators: `==`, `!=`, `>`, `>=`, `<`, `<=`.

This is a small extension to the 'flip ==' assist.
In theory we could easily flip ANY binary expression, but I'm not sure it would be a good idea (IMHO we should try not to change the meaning of the expression).

Does it make sense?

Co-authored-by: Marco Groppo <marco.groppo@gmail.com>
2019-03-27 05:40:18 +00:00
Marco Groppo
7b81c088f7 Flip any binary expression except assignments. 2019-03-26 23:12:46 +01:00
Marco Groppo
6030d6f500 Merge branch 'master' of github.com:rust-analyzer/rust-analyzer into flip-binexpr 2019-03-26 20:26:16 +01:00
bors[bot]
1011e37f3a Merge #1060
1060: more realistic test for incrementality r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-03-26 16:55:19 +00:00
Aleksey Kladov
a3fee2bda0 more realistic test for incrementality 2019-03-26 19:54:52 +03:00
bors[bot]
a82755e241 Merge #1059
1059: Typed ids r=matklad a=matklad

just some type-safety and refactorings. 

closes https://github.com/rust-analyzer/rust-analyzer/issues/1054

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-03-26 16:16:54 +00:00
Aleksey Kladov
1325a31e34 reduce visibility 2019-03-26 19:15:39 +03:00
Aleksey Kladov
e28db444df rename 2019-03-26 19:11:01 +03:00