Commit Graph

2335 Commits

Author SHA1 Message Date
Aleksey Kladov
f3a82c372c remove flavor 2019-04-02 12:25:24 +03:00
Aleksey Kladov
5287a2506c More future-proof comment kind 2019-04-02 12:18:52 +03:00
Aleksey Kladov
3f3ff2f0f4 fix comment naming 2019-04-02 10:48:59 +03:00
Aleksey Kladov
99e6438660 allow empty doc comments 2019-04-02 10:35:34 +03:00
Aleksey Kladov
ae282d8da6 add ast::tokens 2019-04-02 10:23:29 +03:00
Aleksey Kladov
f874d372bb simplify 2019-04-02 10:09:52 +03:00
Aleksey Kladov
bd1f5ba222 move ast traits to a separate file 2019-04-02 10:03:19 +03:00
bors[bot]
c2912892ef Merge #1084
1084: remove dead code r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-01 21:27:45 +00:00
Aleksey Kladov
8014116e5f remove dead code 2019-04-02 00:14:57 +03: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
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
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
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
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
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
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
Aleksey Kladov
e8477f3260 update salsa some more 2019-03-27 16:31:13 +03:00
Aleksey Kladov
3419fe297a ⬆️ salsa 2019-03-27 13:38:33 +03:00
Hrvoje Ban
8890539e40 Use EXE extension for pre-commit hook on Window 2019-03-27 07:52:59 +01: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
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
Aleksey Kladov
6e5562224e remove some dead code 2019-03-26 16:47:52 +03: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
Aleksey Kladov
e231277ab2 make macro parsing a query 2019-03-26 14:13:17 +03:00
Aleksey Kladov
e4646ce0d5 reduce visibility 2019-03-26 13:53:50 +03:00
Aleksey Kladov
5270bca5f7 store macro def inside macro id
This solves the problem of "macro expansion can't call into name
resolution, because name resolution calls back into macro expansion"

Because we store macro def as a part of call id, macro expansion just
knows the def!
2019-03-26 13:20:54 +03:00
Marco Groppo
12b5d4f795 Assist to flip (some) binary expressions.
This assist can flip the following operators: ==, !=, >, >=, <, <=.
2019-03-25 23:53:57 +01:00
Florian Diebold
99711c1863 Clean up comments / use nicer Iterator methods 2019-03-25 21:28:36 +01:00
Florian Diebold
0f7e4a7d24 Implement a very naive implements check
... to make the infer_trait_method_simple test have the correct result.
2019-03-25 21:28:36 +01:00
Florian Diebold
c947c15ce1 Basics for trait method resolution 2019-03-25 21:28:36 +01:00
Wilco Kusee
e03189c110 Move ra_ide_api unit tests 2019-03-25 21:03:32 +01:00
bors[bot]
d88a96bd05 Merge #1037
1037: inline immutable local varialbe r=matklad a=gfreezy

resolved #1033 

Co-authored-by: gfreezy <gfreezy@gmail.com>
2019-03-25 14:11:18 +00:00
gfreezy
61315e4a89 use | instead of multiple match arms 2019-03-25 20:57:43 +08:00
bors[bot]
c4ead49361 Merge #1034
1034: HIR diagnostics API r=matklad a=matklad

This PR introduces diagnostics API for HIR, so we can now start issuing errors and warnings! Here are requirements that this solution aims to fulfill:

* structured diagnostics: rather than immediately rendering error to string, we provide a well-typed blob of data with error-description. These data is used by IDE to provide fixes
* open set diagnostics: there's no single enum with all possible diagnostics, which hopefully should result in better modularity

The `Diagnostic` trait describes "a diagnostic", which can be downcast to a specific diagnostic kind. Diagnostics are expressed in terms of macro-expanded syntax tree: they store pointers to syntax nodes. Diagnostics are self-contained: you don't need any context, besides `db`, to fully understand the meaning of a diagnostic. 

Because diagnostics are tied to the source, we can't store them in salsa. So subsystems like type-checking produce subsystem-local diagnostic (which is a closed `enum`), which is expressed in therms of subsystem IR. A separate step converts these proto-diagnostics into `Diagnostic`, by merging them with source-maps.

Note that this PR stresses type-system quite a bit: we now type-check every function in open files to compute errors!

Discussion on Zulip: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Diagnostics.20API

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-03-25 11:38:46 +00:00
Aleksey Kladov
309716cffe move tests to where they belong 2019-03-25 14:29:24 +03:00
Sergey Parilin
36cb58f76d structure moved to ra_ide_api
ra_ide_api_light removed completely
2019-03-25 11:41:21 +03:00
Aleksey Kladov
6c4b06e2e3 simplify 2019-03-25 10:59:42 +03:00
Aleksey Kladov
e9af69d9db simplify 2019-03-25 10:56:55 +03:00
Aleksey Kladov
5ce84f3cbc tweak diagnostics API 2019-03-25 10:52:50 +03:00
Aleksey Kladov
4c4a714328 test diagnostics 2019-03-25 10:52:50 +03:00
Aleksey Kladov
c7ffd939f6 more enterprisey diagnostics setup 2019-03-25 10:52:50 +03:00
Aleksey Kladov
7ee2887d1e fixes 2019-03-25 10:52:50 +03:00
Aleksey Kladov
45fbab2b1a check impls as well 2019-03-25 10:52:50 +03:00
Aleksey Kladov
79df62bc74 cleanup 2019-03-25 10:52:50 +03:00
Aleksey Kladov
3fb88e95aa switch modules to new diagnostics 2019-03-25 10:52:50 +03:00
Aleksey Kladov
fcca35969d allow dyn diagnostics 2019-03-25 10:52:12 +03:00
Aleksey Kladov
7e8f17188e diagnostics 2019-03-25 10:52:12 +03:00
bors[bot]
4132fbf3a0 Merge #1041
1041: Add convenience functions to SourceChange for creating single edits r=matklad a=vipentti

Fixes #1018 

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-03-25 07:42:30 +00:00
Ville Penttinen
4d26bae46d Rename source_edit to source_file_edit to match file_system_edit 2019-03-25 09:13:58 +02:00
bors[bot]
965363db15 Merge #1036
1036: Assist to flip equality (==) and negated equality (!=) operands. r=matklad a=marcogroppo

This PR adds an assist to flip the equality operands.

I hope this is the right way to do this (I'm a newbie...)

Fixes #1023.


Co-authored-by: Marco Groppo <marco.groppo@gmail.com>
2019-03-25 07:04:47 +00:00
Ville Penttinen
b92fcbc956 Further improvements to the SourceChange convenience methods
Rename system_edit to file_system_edit, add more documentation, add
source_file_edit_from to create a SourceChange from `FileId` and `TextEdit`.
2019-03-25 09:03:10 +02:00
gfreezy
fd1585a071 inline immutable local varialbe 2019-03-25 10:18:20 +08:00
Marco Groppo
67055c47da Target only the actual operator.
Renamed `BinExpr::op()` and `PrefixExpr::op()` to `op_kind`.
Now `op()` returns the `SyntaxNode`.
2019-03-24 22:21:22 +01:00
bors[bot]
94cf23bfc4 Merge #1029
1029: Add impl members assist shold not copy docstrings, attrs and default methods r=matklad a=gfreezy

1. `add missing impl members` assist should not copy docstrings, attrs and default methods
2. Add `add impl default members` assist

fixed #1022

Co-authored-by: gfreezy <gfreezy@gmail.com>
2019-03-24 21:04:53 +00:00
Ville Penttinen
22e1c7a112 Add convenience functions to SourceChange for creating single edits 2019-03-24 22:53:41 +02:00
Ville Penttinen
95505e80fc Support references in higher-ranked trait bounds
Fixes #1020
2019-03-24 20:51:55 +02:00
Marco Groppo
acac7415a6 Minor formatting changes. 2019-03-24 15:12:39 +01:00
Marco Groppo
481d3f56cf Assist to flip equality (==) and negative equality (!=) operands. 2019-03-24 14:42:11 +01:00
bors[bot]
18a8f48039 Merge #1031
1031: Move most things out of ra_ide_api_light r=matklad a=detrumi

This moves everything except `structure` out of `ra_ide_api_light`. So this PR and #1019 finish up #1009, whichever is merged last should probably remove the `ra_ide_api_light` crate.

Also, `LocalEdit` was removed since it wasn't used any more.

Co-authored-by: Wilco Kusee <wilcokusee@gmail.com>
2019-03-23 17:25:40 +00:00
Florian Diebold
dbfc68cea0 Fix apply_substs assertion failure
Fixes #1030.
2019-03-23 18:03:09 +01:00
Wilco Kusee
a3711e08dc Move highlighting and matching_brace 2019-03-23 17:34:49 +01:00
Wilco Kusee
a656b891fb Remove LocalEdit usage 2019-03-23 17:00:49 +01:00
gfreezy
02383b91d5 Add assist for adding default methods 2019-03-23 23:13:07 +08:00
gfreezy
d99ae9ba56 Add impl members assist shold not copy docstrings, attrs and default methods. 2019-03-23 22:49:20 +08:00
Aleksey Kladov
46a21b07e6 remove obsolete diagnostic 2019-03-23 16:31:11 +03:00
Aleksey Kladov
3f0cf6ebe1 rename persistent hir database -> def database 2019-03-23 15:44:24 +03:00
bors[bot]
331220fee2 Merge #1025
1025: Disable fork feature for proptest r=matklad a=detrumi



Co-authored-by: Wilco Kusee <wilcokusee@gmail.com>
2019-03-23 12:09:07 +00:00
Wilco Kusee
0c15deac76 Move typing to ra_ide_api 2019-03-23 12:11:46 +01:00
Aleksey Kladov
4fd8cfd6ad replace todo with fixme 2019-03-23 11:07:09 +03:00
Wilco Kusee
497934a7b4 Disable fork feature for proptest 2019-03-23 08:57:07 +01:00
Aleksey Kladov
2394a2ee35 forbid todo markers 2019-03-23 10:53:28 +03:00