Commit graph

2603 commits

Author SHA1 Message Date
bors[bot]
fa15c4d75e Merge #1175
1175: Fix bugs and add error log about macro expansion r=matklad a=edwin0cheng

This PR fixed / add following things:

* Add a fused count which stop recursion of macro expansion in name resolution.
* Add some logs when macro expansion fails
* Add `$crate` meta variable support in mbe, which create a `$crate` ident token in token tree.
* Fixed matching a `$REPEAT` pattern inside a subtree, e.g. `(fn $name:ident {$($i:ident)*} ) => {...}`
* Remove composite-able punct token in syntax node to token conversion. 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-21 10:34:07 +00:00
Aleksey Kladov
fa12ed2b8f switch to official extend selection API 2019-04-21 12:13:48 +03:00
Florian Diebold
82751f8a4a Add a simple test for str method completion 2019-04-20 18:26:53 +02:00
bors[bot]
4ad2e4ce4e Merge #1154
1154: Initial support for lang items (and str completion) r=flodiebold a=marcogroppo

This PR adds partial support for lang items.
For now, the only supported lang items are the ones that target an impl block.

Lang items are now resolved during type inference - this means that `str` completion now works.

Fixes #1139.

(thanks Florian Diebold for the help!)


Co-authored-by: Marco Groppo <marco.groppo@gmail.com>
2019-04-20 16:13:50 +00:00
Edwin Cheng
9e35bf91b8 Fix bugs 2019-04-20 23:53:39 +08:00
Marco Groppo
8ac3d1f9aa lang_item_lookup is now a salsa query. 2019-04-20 00:29:16 +02:00
Marco Groppo
8ebb20edce New krate() method in Resolver.
Renamed Impl to ImplBlock.
2019-04-20 00:20:26 +02:00
Marco Groppo
e85ee60c42 Initial support for lang items. 2019-04-20 00:10:19 +02:00
Edwin Cheng
210c762fe6 Disable test_tt_xx 2019-04-20 02:41:13 +08:00
Edwin Cheng
41c1a639c3 Disable tt matcher 2019-04-20 02:19:46 +08:00
Edwin Cheng
1afde29adb Add back missing assert 2019-04-19 21:52:54 +08:00
Edwin Cheng
763569017a Fix bug for ident to lifetime 2019-04-19 21:43:41 +08:00
Edwin Cheng
87ff908135 Add vis matcher 2019-04-19 21:38:26 +08:00
Edwin Cheng
c5983b85fc Add literal matcher 2019-04-19 21:21:47 +08:00
Edwin Cheng
313854c728 Add lifetime matcher 2019-04-19 21:15:19 +08:00
Edwin Cheng
59b6cc780b add tt matcher 2019-04-19 19:41:59 +08:00
Edwin Cheng
762819864f add block matcher 2019-04-19 19:33:29 +08:00
Edwin Cheng
8092b6487f Add block matcher 2019-04-19 18:30:43 +08:00
bors[bot]
ab0a96586f Merge #1148
1148: Add token_tree_to_xxx functions r=matklad a=edwin0cheng

<del>As discus in  PR #1147 , this PR added a `mbe::MacroKind` .
Currently only 2 kind of macro are supported, `SourceFile` and `Block`.</del>

Added following functions for `tt::TokenTree` and `ast::Node` conversion:

* token_tree_to_expr
* token_tree_to_pat
* token_tree_to_ty
* token_tree_to_macro_stmts
* token_tree_to_macro_items

And added two new syntax kind:

* MACRO_ITEMS
* MACRO_STMTS

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-19 08:56:39 +00:00
Edwin Cheng
a6d51e0961 Return Result for token_tree_to_xx functions 2019-04-19 04:03:22 +08:00
Edwin Cheng
c0f19d7005 Add expr, pat, ty and macro_stmts 2019-04-19 03:49:56 +08:00
Edwin Cheng
3ff5440a50 Add MacroItems and MacroStmts in grammer.ron 2019-04-19 02:47:29 +08:00
Edwin Cheng
e8ddeb869d Fix missing last token in mbe $repeat parsing 2019-04-18 23:33:54 +08:00
Edwin Cheng
e944fd059d Add item matcher in mbe 2019-04-18 10:21:36 +08:00
bors[bot]
112fd0ec7d Merge #1160
1160: better formatting when adding trait members r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-17 11:11:31 +00:00
Aleksey Kladov
a27fc96aa1 better formatting when adding trait members
* it's conventional not to use one-liners
* new placement is more predictable, b/c it does not depend on
  header's length
2019-04-17 14:05:02 +03:00
bors[bot]
4c8e6e89aa Merge #1145
1145: Fix #1099, plug self type type parameters in infer_path_expr r=flodiebold a=edwin0cheng

As discussed in #1099, this PR try to "plug" a `self type` type parameters in `infer_path_expr`.
All the cases in 1099 was fixed and tested.
And luckily, this PR fixed bug #1030 again and make the test output correct.





Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-17 11:03:34 +00:00
Aleksey Kladov
f75feb6724 cleanup cancellation
Now that we explicitelly exit the reading loop on exit notification,
we can assume that the sender is always alive
2019-04-17 11:47:38 +03:00
bors[bot]
d3afb1b378 Merge #1153
1153: "Restart server" command r=jrvidal a=jrvidal

The only tricky aspect is that fact that once the `exit` command has been received, we no longer need to join on the reader thread. 

Also, I think `terminateProcesses.sh` was not working properly. In fact, the very same script from the vscode language server implementation is not working either! It's because of that I noticed the reader thread issue 😮 

Co-authored-by: Roberto Vidal <vidal.roberto.j@gmail.com>
2019-04-17 05:51:12 +00:00
Edwin Cheng
57e4122b89 Add mbe stmt matcher 2019-04-17 12:34:43 +08:00
Edwin Cheng
8747c903a2 Refactoring 2019-04-17 09:35:03 +08:00
Edwin Cheng
039ab2e820 Simpliy code 2019-04-17 09:31:53 +08:00
Edwin Cheng
0edb5ce97a Bug fix and add more comments 2019-04-17 09:31:52 +08:00
Edwin Cheng
180655077a Fix 1099 2019-04-17 09:31:52 +08:00
Roberto Vidal
8d569d49d2 Breaks read loop on 'exit' 2019-04-17 00:38:56 +02:00
Roberto Vidal
13d92b3f11 Fixes doctest 2019-04-16 22:25:17 +02:00
Roberto Vidal
12f28f6276 Adds "restart server" command 2019-04-16 22:07:33 +02:00
Aleksey Kladov
247ac265f1 fix test 2019-04-15 01:17:26 +03:00
Aleksey Kladov
c4a5aa45dc add a couple of profiling points 2019-04-15 01:10:07 +03:00
Aleksey Kladov
06615bd331 more intuitive name 2019-04-15 01:10:07 +03:00
Aleksey Kladov
5b7012318c filter by time 2019-04-15 01:10:07 +03:00
Aleksey Kladov
b228947b68 cleanup syntax 2019-04-15 01:10:07 +03:00
Aleksey Kladov
e6f32c6d3a fast path for disabled profiler 2019-04-15 01:10:07 +03:00
Aleksey Kladov
30a4099ea7 switch to modern paths 2019-04-15 01:10:07 +03:00
Florian Diebold
4f8a49f43c Refactor method candidate generation a bit
This fixes the order in which candidates are chosen a bit (not completely
though, as the ignored test demonstrates), and makes autoderef work with trait
methods. As a side effect, this also makes completion of trait methods work :)
2019-04-14 21:53:35 +02:00
bors[bot]
88be6f3217 Merge #1137
1137: Adds support for multiple editor workspaces on initialization r=matklad a=jrvidal

OK, so this "simple hack" turned out to be way more contrived than I expected 😂

### What works
This patch only handles multi-folder editor workspaces _on initialization_.
  * I've found that modifying the layout of a workspace in VSCode just reloads the extension, so this hack should be enough for now.
  * Not sure about how emacs-lsp behaves, but we fallback gracefully to the mono-folder workspace, so it should be fine.

### What doesn't work
* [x] `cargo watch` can only watch a single root folder with a `Cargo.toml`. I've left this part untouched but we could either warn that it's not supported or launch _multiple_ `cargo-watch` processes.
* [x] The `rust-analyzer/runnables` command is not functional, since we don't send the correct `cwd`.
* [x] Should we add some happy path test to `heavy_tests`?
* [ ] Going from a single `root` to multiple `roots` leaves us with a couple of `n * m` loops that smell a bit. The number of folders in the editor workspace is probably low though.

Co-authored-by: Roberto Vidal <vidal.roberto.j@gmail.com>
2019-04-14 17:26:07 +00:00
bors[bot]
5d35f284f5 Merge #1138
1138: Add L_DOLLAR and R_DOLLAR r=matklad a=edwin0cheng

As discussion in issue https://github.com/rust-analyzer/rust-analyzer/issues/1132 and PR #1125 , this PR add 2 `Syntax::Kind` : `L_DOLLAR` and `R_DOLLAR` for representing `Delimiter::None` in mbe and proc_marco. By design, It should not affect the final syntax tree, and will be discard in `TreeSink`.

My original idea is handling these 2 tokens case by case, but i found that they will appear in every place in the parser (imagine `tt` matcher). So this PR only handle it in `Parser::do_bump` and `Parser::start`, although It will not fix the `expr` matcher executing order problem in original idea.


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-14 14:16:42 +00:00
Florian Diebold
8bcbcc454c Extract generic_params method to a HasGenericParams trait 2019-04-14 13:07:45 +02:00
Florian Diebold
4497e1d3ea Add Container enum to handle both kinds of container (impl/trait) 2019-04-14 11:28:53 +02:00
Florian Diebold
7650a44640 Make callable signature handling a bit nicer 2019-04-14 11:28:53 +02:00
Florian Diebold
9339241b78 Some cleanup 2019-04-14 11:28:53 +02:00
Florian Diebold
a1ed53a4f1 More trait infrastructure
- make it possible to get parent trait from method
 - add 'obligation' machinery for checking that a type implements a
   trait (and inferring facts about type variables from that)
 - handle type parameters of traits (to a certain degree)
 - improve the hacky implements check to cover enough cases to exercise the
   handling of traits with type parameters
 - basic canonicalization (will probably also be done by Chalk)
2019-04-14 11:28:53 +02:00
Florian Diebold
413c87f155 Get substs for trait refs in impl blocks 2019-04-14 11:28:53 +02:00
Roberto Vidal
c2dfc8a229 Modifies runnables test to use multi-workspace root 2019-04-14 10:04:38 +02:00
Roberto Vidal
7c7cfc5f04 Sends cwd info for runnables and code lenses 2019-04-14 10:04:38 +02:00
Roberto Vidal
3507bcb97a Adds support for multiple editor workspaces on initialization
This is a quick, partial fix for #1104
2019-04-14 10:04:38 +02:00
Edwin Cheng
6646d49f23 Fix bug and add expr , pat , ty matcher 2019-04-14 11:42:20 +08:00
Robin Freyler
6aae0cf7fa
replace usages of algo::generate with iter::successors from std 2019-04-13 16:43:49 +02:00
Aleksey Kladov
2facb5e061 cleanups 2019-04-13 14:16:46 +03:00
Aleksey Kladov
b260641e0c slight encapsulation 2019-04-13 11:29:47 +03:00
Aleksey Kladov
f9e825d956 move ScopeEntryWithSyntax 2019-04-13 11:24:09 +03:00
Aleksey Kladov
d387bdccba drop obsolete fixme 2019-04-13 11:21:32 +03:00
Aleksey Kladov
4f8dc1b9f0 make expr scope stuff private 2019-04-13 11:06:53 +03:00
Aleksey Kladov
a2cc76ce63 make resolver private 2019-04-13 11:03:02 +03:00
Aleksey Kladov
62d01dd4df hide resolver 2019-04-13 11:00:15 +03:00
Aleksey Kladov
f4a94e74bc fold ScopeWithSyntax into SourceAnalyzer 2019-04-13 10:49:01 +03:00
Aleksey Kladov
30481808fb make stuff private 2019-04-13 09:53:02 +03:00
Aleksey Kladov
cec67b2b65 obsolete fixm 2019-04-13 09:50:02 +03:00
Aleksey Kladov
1e8569dce9 make private 2019-04-13 09:46:39 +03:00
Aleksey Kladov
d4043a8dba only def-with-body remains 2019-04-13 09:45:52 +03:00
Aleksey Kladov
d88269bc2d generalize 2019-04-13 09:38:37 +03:00
Aleksey Kladov
17a0e22883 simplify 2019-04-13 09:36:28 +03:00
Aleksey Kladov
65b0073653 simplify 2019-04-13 09:33:34 +03:00
Aleksey Kladov
9ead801a9c make private 2019-04-13 09:32:25 +03:00
Aleksey Kladov
3aae223d93 hide some scopes 2019-04-13 09:31:03 +03:00
Aleksey Kladov
58fe5598e7 simplify 2019-04-13 01:32:43 +03:00
Aleksey Kladov
b0d8f9ff5d make stuff private 2019-04-13 01:07:24 +03:00
Aleksey Kladov
81e91980dd simplify 2019-04-13 01:05:18 +03:00
Aleksey Kladov
7c13e22334 simplify tests 2019-04-13 00:56:57 +03:00
Aleksey Kladov
0fd93bc14a use really correct resolver for expressions 2019-04-13 00:44:47 +03:00
Edwin Cheng
f66300ccd1 Remove skip Delimiter::None and handle Dollars 2019-04-13 01:50:05 +08:00
Aleksey Kladov
20013de2ab fix typo 2019-04-11 17:15:20 +03:00
Aleksey Kladov
cf2ba2791d add todo 2019-04-11 17:14:41 +03:00
Aleksey Kladov
a347208bb2 use correct resolver for expressions 2019-04-11 16:51:30 +03:00
Aleksey Kladov
ebb0c377f0 remove resolver from CompletonContext 2019-04-11 16:49:35 +03:00
Aleksey Kladov
3c9f2d0e37 simplify 2019-04-11 16:39:56 +03:00
Aleksey Kladov
5471c1ef4b generalize SourceAnalyzer to handle all defs with bodies 2019-04-11 16:37:29 +03:00
Aleksey Kladov
07cc047b4f minimize the API 2019-04-11 16:29:33 +03:00
Aleksey Kladov
b6809b6695 rename 2019-04-11 16:29:33 +03:00
Aleksey Kladov
6c2ba945ed reduce visibility 2019-04-11 16:29:33 +03:00
Aleksey Kladov
505acc973b Make call info to use real name resolution 2019-04-11 16:29:33 +03:00
Aleksey Kladov
10d66d63d7 introduce SourceAnalyzer 2019-04-11 16:29:33 +03:00
Aleksey Kladov
6a8b3c1d4b fix typo 2019-04-11 11:13:31 +03:00
Edwin Cheng
74e846b9ec Add L_DOLLAR and R_DOLLAR 2019-04-11 11:02:41 +08:00
bors[bot]
6d9acb8753 Merge #1131
1131: Use inline snapshots in complete_dot r=matklad a=vipentti

Relates to #1127 

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-04-10 11:05:31 +00:00
Ville Penttinen
57283b4e5f Use inline snapshots in complete_dot 2019-04-10 13:47:20 +03:00
Ville Penttinen
1b19c1c8f2 Use inline snapshots in complete_fn_param 2019-04-10 13:22:50 +03:00
Aleksey Kladov
10726fdb65 type-safer source-map for bindings 2019-04-10 10:48:15 +03:00
Aleksey Kladov
1cd184d653 use either for uses 2019-04-10 10:12:54 +03:00
bors[bot]
b863272899 Merge #1126
1126: Swithc to native salsa interning r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-09 20:04:42 +00:00
Aleksey Kladov
88189c4282 drop old interning infra 2019-04-09 22:52:06 +03:00
Aleksey Kladov
6b993a9760 migrate to salsas interning 2019-04-09 22:51:22 +03:00
bors[bot]
cc284dad30 Merge #1122
1122: Add explicit type assist. r=matklad a=marcogroppo

This assist can be used to specify the explicit type in let statements. For example `let num = 1;` becomes `let num: i32 = 1;`. 

The assist is applicable only if the inferred type is fully known.


Co-authored-by: Marco Groppo <marco.groppo@gmail.com>
2019-04-09 19:16:28 +00:00
Marco Groppo
c5f8f3b1f4 Stylistic changes. Updated features.md with the new assists. 2019-04-09 21:12:54 +02:00
Ville Penttinen
45a2b92524 Fix doc comment 2019-04-09 16:08:24 +03:00
Ville Penttinen
07f0069f34 Move display related things from hover to display 2019-04-09 14:45:05 +03:00
Ville Penttinen
fead60aa27 Move FunctionSignature to display/function_signature 2019-04-09 14:45:05 +03:00
Ville Penttinen
bd6ddfcdde Make display modules private 2019-04-09 14:45:05 +03:00
Ville Penttinen
7821c56be7 Move structure to display/structure 2019-04-09 14:45:05 +03:00
Ville Penttinen
027d4d229d Move navigation_target to display/navigation_target 2019-04-09 14:45:05 +03:00
Ville Penttinen
946b5789d1 Move completion label functions to display 2019-04-09 14:45:05 +03:00
Ville Penttinen
dfaebd76ab Add FunctionSignature::from_hir 2019-04-09 14:45:05 +03:00
Ville Penttinen
2fe075f56e Normalize line-endings in display.rs
This changes from CRLF to LF
2019-04-09 14:45:05 +03:00
Ville Penttinen
f4aa15c16b Move FunctionSignature creation to display 2019-04-09 14:45:05 +03:00
Ville Penttinen
ed65e2619a Add no parameter test to call_info 2019-04-09 14:45:05 +03:00
Ville Penttinen
7ba22f1c19 Move FunctionSignature to display, remove write_joined
write_joined is replaced with `join_to_string::join` which provides the
necessary functionality.
2019-04-09 14:45:05 +03:00
Ville Penttinen
84fde47d00 Move test specific things 2019-04-09 14:45:04 +03:00
Ville Penttinen
751b454442 Update test snapshots 2019-04-09 14:45:04 +03:00
Ville Penttinen
0e49abb7fb Refactor CallInfo function signatures to new FunctionSignature type
This is used by CallInfo to create a pretty printed function signature that can
be used with completions and other places as well.
2019-04-09 14:45:04 +03:00
Aleksey Kladov
faf526e021 migrate to untyped rowan 2019-04-09 10:26:51 +03:00
Marco Groppo
a4ba3841b4 Add explicit type assist. 2019-04-08 19:56:37 +02:00
bors[bot]
ac6ab07587 Merge #1105
1105: [WIP] Implement ra_mbe meta variables support  r=matklad a=edwin0cheng

This PR implements the following meta variable support in `ra_mba` crate (issue  #720):

- [x] `path`
- [ ] `expr`
- [ ] `ty`
- [ ]  `pat`
- [ ] `stmt`
- [ ]  `block`
- [ ]  `meta`
- [ ] `item`

*Implementation Details*

In the macro expanding lhs phase, if we see a meta variable type, we try to create a `tt:TokenTree` from the remaining input. And then we use a special set of `ra_parser` to parse it to `SyntaxNode`. 


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-08 14:18:57 +00:00
Laurențiu Nicola
61c09edb4a Avoid two-phase borrow conflict 2019-04-08 16:47:28 +03:00
Edwin Cheng
8ed7104578 Refactoring and add some docs 2019-04-08 20:32:21 +08:00
Edwin Cheng
c785c7312d Fixed infintite loop bug 2019-04-08 19:21:07 +08:00
Edwin Cheng
184e9ea230 Fixed empty node bug 2019-04-08 18:21:48 +08:00
Edwin Cheng
2697ecaa64 Use SubtreeWalker instread of flatten TtToken 2019-04-08 15:58:02 +08:00
Edwin Cheng
a7254201df Combine all tokensource to one and refactoring 2019-04-08 00:12:07 +08:00
Edwin Cheng
7f1e93a3c9 Refactoring subtree_source 2019-04-07 21:42:53 +08:00
Lenard Pratt
b27fa33a9f updated snapshots 2019-04-07 13:23:18 +01:00
Lenard Pratt
e175921932 Added ArrayExprKind,
changed the  display for fixed array types,
Added Array Enum to ra_hir/expr
2019-04-07 13:23:14 +01:00
Lenard Pratt
2d73c909fe Added inference of array length 2019-04-07 13:23:12 +01:00
bors[bot]
36f5d99756 Merge #1119
1119: Add warning when open file outside workspace r=matklad a=edwin0cheng

When file is not found in `ra_vfs` but exist, use `LspError` for warning instead of `error_fmt` to bail out error, 

Temporarily fix #967 .

edit: typo

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-07 10:48:49 +00:00
Edwin Cheng
ce3d78335d Remove checking file exists 2019-04-07 18:26:02 +08:00
Edwin Cheng
e92740c28b fix formatting 2019-04-07 12:46:45 +08:00
Edwin Cheng
333feb3869 Add warning when open file outside workspace 2019-04-07 01:20:33 +08:00
Edwin Cheng
aac9dfa464 Add TtCursorTokenSource and TtCursorTokenSink 2019-04-06 20:14:28 +08:00
Edwin Cheng
1d7735fbc6 Add path test and empty eat_path handling 2019-04-06 12:12:32 +08:00
robojumper
2caa690ef6 Rudimentarily autocomplete tuple struct field access 2019-04-06 01:10:48 +02:00
robojumper
ca40ca93a5 Parse and infer tuple indices 2019-04-06 01:07:35 +02:00
Edwin Cheng
7abc06bd57 Add proper test for literals and fixed typo bug 2019-04-05 20:58:24 +08:00
Edwin Cheng
1ea0238e53 Add classify_literal and undo expose next_token 2019-04-05 18:45:19 +08:00
Edwin Cheng
1ab78d6056 Fix literal support in token tree to ast item list 2019-04-05 18:23:01 +08:00
Edwin Cheng
6ff16c7ad9 Clean up 2019-04-05 03:54:18 +08:00
Edwin Cheng
c23408751c Add multi-byte token support in tkn tree to ast 2019-04-05 03:39:54 +08:00
pcpthm
0010d62cad Make robust about target directory 2019-04-04 18:57:10 +09:00
bors[bot]
c083515eec Merge #1106
1106: ⬆️ salsa r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-04 07:03:18 +00:00
Aleksey Kladov
afd64756dd ⬆️ salsa 2019-04-04 10:02:53 +03:00
bors[bot]
84d8665e13 Merge #1101
1101: Parse unsafe async / const unsafe fns properly r=matklad a=robojumper

Also adds tests that `unsafe async fn` as well as `const unsafe fn` parse properly and that these keywords in the reversed order cause parse errors.

[Playground link to verify that this is the correct order.](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=7850b8d92579de31c38f835f76afa4ce)

Closes #1086.


Co-authored-by: robojumper <robojumper@gmail.com>
2019-04-03 15:33:58 +00:00
bors[bot]
f1ac9c8f55 Merge #1098
1098: added some docs to public functions r=matklad a=pasa

some docs for #961

Co-authored-by: Sergey Parilin <sergey.parilin@fxdd.com>
2019-04-03 15:13:51 +00:00
robojumper
636270f4a4 Parse unsafe async / const unsafe fns properly 2019-04-03 17:11:56 +02:00
Sergey Parilin
cc2212f3cb added some docs to public functions 2019-04-03 16:05:55 +03:00
bors[bot]
c6c88070c4 Merge #1068
1068: profiling crate first draft r=matklad a=pasa

I've made this first draft for #961 
Could you look at it? Is this something what you are looking for?
It has lack of tests. I can't figure out how to test stderr output in rust right now. Do you have some clues?
Additionally I'm thinking about to implement procedural  macros to annotate methods with this profiler. Will it be helpful?



Co-authored-by: Sergey Parilin <sergey.parilin@fxdd.com>
2019-04-03 09:09:11 +00:00
bors[bot]
fdbebccd71 Merge #1076
1076: Const body inference r=flodiebold a=Lapz

This is the second part of #887. I've added type inference on const bodies and introduced the DefWithBody containing Function, Const and Static. I want to add tests but im unsure on how I would go about testing that completions work.


Co-authored-by: Lenard Pratt <l3np27@gmail.com>
2019-04-02 19:01:54 +00:00
Lenard Pratt
b9d2c2c21f made ExprCollector pub(crate) and moved
collect_fn_body_syntax
2019-04-02 19:22:06 +01:00
Lenard Pratt
88e22e9d70 Added const bodies and static body to the ast
and added inference the inference test

reduce code duplication
2019-04-02 19:21:36 +01:00
bors[bot]
5cdf525caa Merge #1093
1093: simplify r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-02 16:15:46 +00:00
Aleksey Kladov
cf1caf5181 simplify 2019-04-02 19:15:13 +03:00
Aleksey Kladov
0de89f786f always produce source for import 2019-04-02 17:58:04 +03:00
Sergey Parilin
b74449e995 Merge remote-tracking branch 'upstream/master' into issue961_profiling 2019-04-02 17:55:14 +03:00
Sergey Parilin
9b73f80959 PR issuse resolved 2019-04-02 17:52:04 +03:00
bors[bot]
0a758a2c48 Merge #1090
1090: always show token text r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-02 13:36:52 +00:00
Aleksey Kladov
7d6bd5d137 always show token text 2019-04-02 14:49:46 +03:00
Aleksey Kladov
e7a4b96d03 fix inner block doc comments 2019-04-02 14:42:47 +03:00
Aleksey Kladov
49f13d3a9b fix a panic with glob-import missing a source map 2019-04-02 13:26:09 +03:00
Aleksey Kladov
ab19ff16e5 add minimal comments 2019-04-02 13:02:23 +03:00
Aleksey Kladov
0e1e40676a rename flavor to kind 2019-04-02 12:53:44 +03:00
Aleksey Kladov
cb5001c0a5 move extensions to submodules 2019-04-02 12:47:39 +03:00
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