Commit graph

3325 commits

Author SHA1 Message Date
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
Aleksey Kladov
c4dfced1f8
fix typo 2019-03-29 16:51:20 +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
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
Aleksey Kladov
b17217b34a simplify 2019-03-26 18:57:57 +03:00
Aleksey Kladov
cffa3f960e make stuff private 2019-03-26 18:47:52 +03:00
Aleksey Kladov
8f32477312 more type safety 2019-03-26 18:27:22 +03:00
Aleksey Kladov
071a19537d strongy-typed ids for macros 2019-03-26 18:03:17 +03:00
Aleksey Kladov
fb8b354dcc add typed ids 2019-03-26 17:25:14 +03:00
bors[bot]
96acf4f7ec Merge #1051
1051: Move ra_ide_api unit tests r=matklad a=detrumi

Closes #1048

Co-authored-by: Wilco Kusee <wilcokusee@gmail.com>
2019-03-26 13:58:12 +00:00
bors[bot]
619a4c05ba Merge #1058
1058: remove some dead code r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-03-26 13:50:49 +00:00
Aleksey Kladov
6e5562224e remove some dead code 2019-03-26 16:47:52 +03:00
Aleksey Kladov
b1c865fd5a add links to readme 2019-03-26 15:38:46 +03:00
bors[bot]
fbd0b772e0 Merge #1057
1057: simplify r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-03-26 11:57:11 +00:00
Aleksey Kladov
f6f2d69bb8 simplify 2019-03-26 14:54:05 +03:00
Aleksey Kladov
0b820cacab move source_id to a separate file 2019-03-26 14:42:28 +03:00
bors[bot]
8254244e49 Merge #1055
1055: store macro def inside macro id r=matklad a=matklad

This makes macro expansion resilient to changes to code inside the macro

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-03-26 11:19:38 +00:00
Aleksey Kladov
e231277ab2 make macro parsing a query 2019-03-26 14:13:17 +03:00
bors[bot]
71f8619b4e Merge #1056
1056: ⬆️ vfs r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-03-26 10:54:45 +00:00
Aleksey Kladov
274990bc83 ⬆️ vfs 2019-03-26 13:54:23 +03:00
Aleksey Kladov
e4646ce0d5 reduce visibility 2019-03-26 13:53:50 +03:00