Commit graph

607 commits

Author SHA1 Message Date
Robin Freyler
6aae0cf7fa
replace usages of algo::generate with iter::successors from std 2019-04-13 16:43:49 +02:00
Aleksey Kladov
20013de2ab fix typo 2019-04-11 17:15:20 +03:00
Edwin Cheng
74e846b9ec Add L_DOLLAR and R_DOLLAR 2019-04-11 11:02:41 +08:00
Aleksey Kladov
faf526e021 migrate to untyped rowan 2019-04-09 10:26:51 +03: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
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
robojumper
636270f4a4 Parse unsafe async / const unsafe fns properly 2019-04-03 17:11:56 +02: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
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
Aleksey Kladov
cf1caf5181 simplify 2019-04-02 19:15:13 +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
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]
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
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
memoryruins
c7264b4f07 add test for async blocks 2019-03-28 18:54:06 -04:00
memoryruins
7a06282d71 Add tests to ra_syntax for extern_crate_self 2019-03-28 12:15:44 -04:00
Florian Diebold
c947c15ce1 Basics for trait method resolution 2019-03-25 21:28:36 +01: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
6c4b06e2e3 simplify 2019-03-25 10:59:42 +03:00
Aleksey Kladov
fcca35969d allow dyn diagnostics 2019-03-25 10:52:12 +03: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
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
Ville Penttinen
95505e80fc Support references in higher-ranked trait bounds
Fixes #1020
2019-03-24 20:51:55 +02:00
Aleksey Kladov
4fd8cfd6ad replace todo with fixme 2019-03-23 11:07:09 +03:00
pcpthm
bf8e7930da Fix reparsing failure when removing newline 2019-03-22 08:09:11 +09:00
pcpthm
edbc18516d Fix reparsing bug on "{}{}" 2019-03-22 08:09:11 +09:00
pcpthm
7669113e7c Completely ignore errors for reparse fuzz 2019-03-22 08:09:11 +09:00
pcpthm
c60ec02d75 Use template text to improve reparse fuzzing 2019-03-22 08:09:11 +09:00
pcpthm
ec59d9bda5 Fix lexer not producing right token on "_" 2019-03-22 08:09:11 +09:00
pcpthm
9623e77d9f Fix reparsing bug when lex result is different 2019-03-22 08:09:11 +09:00
pcpthm
c622000413 Improve reparse fuzz test 2019-03-22 08:09:11 +09:00
pcpthm
0acb61a911 Fix an arithmetic overflow in reparser 2019-03-22 08:09:11 +09:00
pcpthm
4c7142d0c9 Add fuzz test for reparsing 2019-03-22 08:04:48 +09:00
pcpthm
e734190c24 Refactor parser fuzz testing 2019-03-22 08:04:48 +09:00
pcpthm
2fb110e1fa Error about attributes on
unallowed types of expression statement
2019-03-19 17:37:08 +09:00
pcpthm
ffed132e52 Allow attributes on top level expression
A top level expression is either
- a expression statement or
- the last expression in a block
2019-03-19 17:24:02 +09:00
bors[bot]
1cd18f9237 Merge #991
991: Use Marker argument for item parsers r=matklad a=pcpthm

Before doing this for expressions, I found that the pattern (Marker argument) should be applied to the item parsers because visiblity and modifiers are parsed in a separate function.

Fixed some parser bugs:
- Fix pub_expr: `pub 42;` was allowed.
- Fix incorrect parsing of crate::path: incorrectly parsed as `crate` as a visibility.

Co-authored-by: pcpthm <pcpthm@gmail.com>
2019-03-18 09:32:28 +00:00
pcpthm
76075c7410 Use Marker argument for item parsers
- Fix pub_expr
- Fix incorrect parsing of crate::path
2019-03-18 14:34:08 +09:00
bors[bot]
91e7a3b6f2 Merge #983
983: support remainder assignment operator r=matklad a=JeanMertz

`%=` was returning errors for me, turns out it wasn't added as a valid assignment operation.

I'm not sure what the best location would be to add a test for this. Please let me know and I'll add one.

Co-authored-by: Jean Mertz <jean@mertz.fm>
2019-03-17 14:34:14 +00:00
Jean Mertz
a8ee994ae0
support remainder assignment operator 2019-03-17 14:11:24 +01:00
pcpthm
a67fe4ea7e Fix parse tree of attribute on match arm 2019-03-17 20:57:27 +09:00
pcpthm
a1d84f5fb0 Allow attribute on struct literal field 2019-03-17 19:08:35 +09:00
Aleksey Kladov
182c05a96c add name resolution from the old impl
unlike the old impl, this also handles macro imports across crates
2019-03-17 12:46:13 +03:00
Michael Chesser
943d2fb781 Add test for minus in inner pattern 2019-03-14 19:24:12 +10:30
Caio
cc9721996c Add test for async block 2019-03-10 14:35:25 -03:00
Caio
ad72699553 Add async keyword 2019-03-09 20:40:22 -03:00
Ville Penttinen
1f4468a8da Add support for parsing multiple if and while-let patterns 2019-03-04 19:10:14 +02:00
Aleksey Kladov
90122542b2 allow mut ident patterns in trait methods
closes #928
2019-03-04 17:47:02 +03:00
Aleksey Kladov
0a19f4f1b4 allow aliases in underscores
this helps with

    use foo::Trait as _;

syntax
2019-03-04 16:40:08 +03:00
bors[bot]
dc8bcc1e42 Merge #926
926: allow vararg functions r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-03-04 12:49:37 +00:00
Aleksey Kladov
77f2381eea improve error recovery
parse the contents of error block as an expression
2019-03-04 15:31:18 +03:00
Aleksey Kladov
a99b1db49f allow vararg functions 2019-03-04 14:34:59 +03:00
Ville Penttinen
d3ce69aee3 Remove TypeRef from item opts which implement TypeAscriptionOwner 2019-02-27 14:08:09 +02:00
Ville Penttinen
6eb070d661 Add new trait TypeAscriptionOwner
This trait should be implemented for nodes which have an ascribed type,
e.g. thing : Type. Such as let, const, static, param, named struct fields.
2019-02-26 11:35:57 +02:00
Aleksey Kladov
78f10fcdc4 rename type to type_alias in the AST as well 2019-02-25 13:49:32 +03:00
Aleksey Kladov
65a2be4953 complete struct literals 2019-02-24 17:01:56 +03:00
Aleksey Kladov
666303faf3 support upcastig in AST enum 2019-02-24 16:57:05 +03:00
Aleksey Kladov
f078f7adc8 introduce tree builder 2019-02-23 16:55:01 +03:00
Aleksey Kladov
0c1cb98182 rename 2019-02-23 16:07:29 +03:00
bors[bot]
5100aeac42 Merge #876
876: Fix join_lines not adding a comma after join_single_expr_block with match arm r=matklad a=vipentti

Fixes #868 

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-02-21 16:55:26 +00:00
Ville Penttinen
82173c8de4 Move non_trivia_sibling to ra_syntax::algo 2019-02-21 18:49:03 +02:00
Aleksey Kladov
4fe07a2b61 add API guide to ra_syntax 2019-02-21 17:35:45 +03:00
Aleksey Kladov
7060a39d5c simplify trait bounds 2019-02-21 16:12:15 +03:00
Aleksey Kladov
b51b71bf25 rearrange methods 2019-02-21 16:04:03 +03:00
Aleksey Kladov
f7f99af0a6 kill utils module 2019-02-21 15:57:40 +03:00
Aleksey Kladov
6225e1ab70 Ignore lockfile in fuzz
It's too much trouble maintaining it
2019-02-21 15:44:38 +03:00
Aleksey Kladov
412ac63ff5 docs 2019-02-21 15:24:42 +03:00
Aleksey Kladov
c47f9e2d37 fix compilation 2019-02-21 13:37:32 +03:00
Aleksey Kladov
d334b5a1db move parser to a separate crate 2019-02-21 13:27:45 +03:00
Aleksey Kladov
cd0d2866fc make grammar independent of syntax tree 2019-02-21 12:12:04 +03:00
Aleksey Kladov
1b2e70df99 minor 2019-02-21 12:05:52 +03:00
Aleksey Kladov
79ce0fa8d7 move whitespace handling to tree builder 2019-02-21 12:03:42 +03:00
Aleksey Kladov
882c47f187 move syntax error to parser 2019-02-20 23:17:07 +03:00
Aleksey Kladov
61992dc1cd simplify 2019-02-20 23:05:59 +03:00
Aleksey Kladov
4c1f9b8d4e remove TokenPos 2019-02-20 23:02:24 +03:00
Aleksey Kladov
cce23fddba flattern module structure 2019-02-20 22:52:32 +03:00
Aleksey Kladov
2acb21e8f7 merge parse_impl and parser_api 2019-02-20 22:44:06 +03:00
Aleksey Kladov
e72ad0a2fa fix off by one error 2019-02-20 22:27:49 +03:00
Aleksey Kladov
2b5e336ce7 move abstract traits to top 2019-02-20 22:19:12 +03:00
Aleksey Kladov
d2bce118ae switch to dynamic dispatch for TokenSource
Benchmarks show no difference. This is probably because we are
bottlenecked on memory allocations, and we should fix that, but we are
not optimizing for performance just yet.

changes. Lines starting # with '#' will be ignored, and an empty
message aborts the commit. # # On branch token-source # Changes to be
committed: # modified: crates/ra_syntax/src/parsing/parser_api.rs #
modified: crates/ra_syntax/src/parsing/parser_impl.rs #
2019-02-20 22:02:03 +03:00
Aleksey Kladov
0c81b9deee route parsing via TokenSource trait 2019-02-20 21:50:07 +03:00
Aleksey Kladov
3517c175ac rename Sink -> TreeSink 2019-02-20 21:08:59 +03:00
Aleksey Kladov
86a67dce25 fix tests 2019-02-20 16:48:06 +03:00
Aleksey Kladov
45fc91cc47 rearrange modules in a suggestd reading order 2019-02-20 16:24:39 +03:00
Aleksey Kladov
a4a1e08ab8 flatten modules 2019-02-20 16:16:14 +03:00
Aleksey Kladov
9f6883fbf1 move reparsers to grammar 2019-02-20 16:02:06 +03:00
Aleksey Kladov
5a6eda528c tighten visibility 2019-02-20 15:57:26 +03:00
Aleksey Kladov
5222b8aba3 move all parsing related bits to a separate module 2019-02-20 15:47:32 +03:00
Aleksey Kladov
9d0cda4bc8 slightly better name 2019-02-20 15:03:31 +03:00
Aleksey Kladov
df6efe62c5 make stuff private 2019-02-20 14:53:19 +03:00
Aleksey Kladov
4e8a3f565b handle != operator 2019-02-18 10:09:44 +03:00
Ville Penttinen
58d14bcaf7 Enable parsing attributes for generic lifetimes and type parameters 2019-02-17 23:32:10 +02:00
Ville Penttinen
bb25958705 Remove match_armlist validator 2019-02-17 20:32:10 +02:00
Ville Penttinen
96e3ac389f Parse only outer_attributes for match arms for now 2019-02-17 19:48:08 +02:00
Ville Penttinen
1c97c1ac11 Enable parsing of attributes inside a match block
We allow invalid inner attributes to be parsed, e.g. inner attributes that are
not directly after the opening brace of the match block.

Instead we run validation on `MatchArmList` to allow better reporting of errors.
2019-02-17 19:26:57 +02:00
Florian Diebold
a1bda3fc08 Handle generic args for method calls 2019-02-16 23:06:41 +01:00
Florian Diebold
da7056245d Add generic params to impl blocks 2019-02-16 23:06:41 +01:00
Florian Diebold
1526eb25c9 Import the prelude 2019-02-13 20:10:09 +01:00
Aleksey Kladov
4e91c23c79 rename yellow -> syntax_node
why yellow in the first place? Its red + green.
2019-02-12 19:02:30 +03:00
Aleksey Kladov
2efdf41bdb make macro a NameOwner 2019-02-11 19:24:13 +03:00
Ville Penttinen
710975ecd8 Fix typo in Cargo.toml authors
Fixes typo introduced in #782
2019-02-11 10:20:04 +02:00
Ville Penttinen
ab3d231b1d Update authors field in Cargo.tomls to "rust-analyzer developers"
This closes #777
2019-02-11 08:55:35 +02:00
Florian Diebold
f1afc93353 Fix handling of literal patterns
Wrap them in a LiteralPat node so they can be distinguished from literal
expressions.
2019-02-09 21:37:30 +01:00
Florian Diebold
fcd615e4b7 Extract project model to separate crate 2019-02-09 11:15:25 +01:00
Aleksey Kladov
12e3b4c70b reformat the world 2019-02-08 14:49:43 +03:00
kjeremy
852b083794 Fill deprecation for LSP 2019-02-05 17:05:46 -05:00
Florian Diebold
e163c908ac Add AST for extern crate
Also change it to parse the crate name as a NAME_REF, not a NAME.
2019-02-04 21:49:34 +01:00
DJMcNab
7417c0775b Fix number of extern_inner_attributes 2019-02-02 16:18:12 +00:00
Florian Diebold
5a7fce4e4c Pass aliases to ImportData 2019-02-02 00:23:53 +01:00
Aleksey Kladov
3bd4560d6e convert punts and literals 2019-01-31 22:23:30 +02:00
bors[bot]
97ade89993 Merge #692
692: [WIP] Correctly parse attributes  r=matklad a=DJMcNab

Reference - https://doc.rust-lang.org/reference/attributes.html
This fixes/investigates inner attributes for:

- [x] `impl` blocks
- [x] `extern` blocks
- [x] `fn`s (fixes #689)
- [x] `mod`s (already supported)
- [x] 'block expressions' (the long text just describes all 'blocks' used as statements)

This also investigates/fixes outer attributes for:

- [ ] 'most statements' (see also: #685, https://doc.rust-lang.org/reference/expressions.html#expression-attributes)
- [x] Enum variants, Struct and Union fields (Fixed in #507)
- [ ] 'Match expression arms' (@matklad can you provide a test case which explains what this means?)
- [ ] 'Generic lifetime or type parameters'
- [ ] 'Elements of array expressions, tuple expressions, call expressions, tuple-style struct and enum variant expressions'
- [ ] 'The tail expression of block expressions'

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2019-01-31 07:06:31 +00:00
Marcus Klaas de Vries
3daca3eb4d Infer type of match guard 2019-01-28 23:09:14 +01:00
DJMcNab
00e6b5d26c Parse and validate attributes in blocks 2019-01-28 20:03:56 +00:00
DJMcNab
137b1ccb71 Add a test for inner attributes on extern blocks 2019-01-27 15:20:36 +00:00
DJMcNab
73b075c556 Correctly parse inner attributes of impl blocks 2019-01-27 14:55:03 +00:00
Erlend Tobiassen
e2e1f4ceca
Typos 2019-01-27 15:19:42 +01:00
bors[bot]
964086e0d4 Merge #685
685: Support attributes on let statements r=matklad a=DJMcNab

Fix #677.

Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2019-01-27 09:04:02 +00:00
DJMcNab
4d35cc3875 Stop using let_stmt twice 2019-01-27 09:00:57 +00:00
bors[bot]
ffcf618842 Merge #662
662: Preserve indentation in doc comments r=matklad a=kjeremy

Fixes #502 

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-01-27 08:21:04 +00:00
Aleksey Kladov
7177fffd7b fix verification on CI
remove `--verify` flag from the binaries: we have tests for this!
2019-01-27 02:30:54 +03:00
DJMcNab
7055d43c3a Make attrs be a child of the let statement 2019-01-26 22:02:23 +00:00
Aleksey Kladov
619af1e22c fix AST for if expressions
then is not always a block...
2019-01-27 00:37:11 +03:00
DJMcNab
55a3e21ac4 Support attributes on let statements 2019-01-26 21:35:03 +00:00
DJMcNab
7a76433c45 Struct literals should not be a BlockLike::Block 2019-01-26 18:45:29 +00:00
Aleksey Kladov
6f862a6704 ⬆️ rowan
The new rowan uses arena allocator for red nodes which helps
slightly (5% on std completion test) with performance but should help
quite a bit with avoiding memory fragmentation.
2019-01-26 19:39:31 +03:00
Jeremy Kolb
a892067951 Make doc comments optional 2019-01-26 10:35:23 -05:00
Jeremy Kolb
e9e0ea0398 Do not unconditionally trim comments 2019-01-26 09:55:30 -05:00
Jeremy Kolb
8c08b6825e Preserve indentation in doc comments 2019-01-26 09:50:17 -05:00
bors[bot]
2acaa92c93 Merge #660
660: Support macro calls in type position r=matklad a=regiontog

A [playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=fdc6dd4ddaece92a72fa2a292b75e27c) demonstrating the syntax in question.

Co-authored-by: Erlend Tobiassen <erlend.tobiassen@gmail.com>
2019-01-26 10:23:28 +00:00
Erlend Tobiassen
e28bd099d6
Support macro calls in type position 2019-01-25 23:56:31 +01:00
Aleksey Kladov
23172a116c rename POS_FIELD -> POS_FIELD_DEF
to match NAMED_FIELD_DEF
2019-01-26 00:24:12 +03:00
Jeremy A. Kolb
7a0bc2dd64 Add docs to struct fields 2019-01-25 14:29:56 -05:00
bors[bot]
675943712c Merge #630
630: Fill in DocumentSymbol::detail r=matklad a=hban

Closes: #516

I just pulled type text from the syntax node and "formatted" is bit. VS Code can't really handle multi-line symbol detail (it's will crop it when rendering), so that formatting will just collapse all white-space to singe space. It isn't pretty, but maybe there's a better way.

Issue also mentions "need to be done for `NavigationTarget` to `SymbolInformation`", but `SymbolInformation` doesn't have detail field on it?

Co-authored-by: Hrvoje Ban <hban@users.noreply.github.com>
2019-01-25 07:13:16 +00:00
bors[bot]
1d4b421aad Merge #633
633: use ToOwned trait instead of inherent method r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-01-24 23:10:09 +00:00
Aleksey Kladov
2e354f480b use ToOwned trait instead of inherent method 2019-01-25 02:09:31 +03:00
bors[bot]
c42db0bbd7 Merge #623
623: WIP: module id is not def id r=matklad a=matklad

This achieves two things:

* makes module_tree & item_map per crate, not per source_root
* begins the refactoring to remove universal `DefId` in favor of having separate ids for each kind of `Def`. Currently, only modules get a differnt ID though. 

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-01-24 22:56:13 +00:00
Aleksey Kladov
0f2f3a21e7 Migrate trait & type to new ids 2019-01-25 01:31:32 +03:00
DJMcNab
107d6a0a16 Reformat 2019-01-24 22:01:49 +00:00
Daniel McNab
82dfb00157
Apply suggestions from code review
Co-Authored-By: DJMcNab <36049421+DJMcNab@users.noreply.github.com>
2019-01-24 21:41:02 +00:00
DJMcNab
f0e5a314b0 Dedupe PATH_FIRST in ATOM_EXPR_FIRST 2019-01-24 21:31:43 +00:00
DJMcNab
4899e7be76 Support universal function call syntax in function calls 2019-01-24 21:19:16 +00:00
Hrvoje Ban
4eff8ddb8b Fill in DocumentSymbol::detail 2019-01-24 19:05:26 +01:00
Aleksey Kladov
566c8e321e migrate enums to new id 2019-01-24 18:56:38 +03:00
Aleksey Kladov
a00570d7a3 minor rename 2019-01-24 13:40:36 +03:00
Jeremy A. Kolb
6a6ce2bc95 Make EnumVariant a DocCommentsOwner 2019-01-23 16:23:21 -05:00
Josh Robson Chase
2ffea72f74 More correct raw ident handling 2019-01-23 13:57:17 -05:00
Josh Robson Chase
3b70acad01 Use IDENT for both raw and normal idents 2019-01-23 13:19:49 -05:00
Josh Robson Chase
1cd6d6539a Add raw idents to lexer and parser 2019-01-23 13:17:41 -05:00
Aleksey Kladov
d4ed25d86f introduced better typed AstPtr 2019-01-23 18:26:02 +03:00
Aleksey Kladov
7b901f86cd move SyntaxPtr to ra_syntax 2019-01-23 17:37:10 +03:00
gfreezy
13d2fd32ab fix completion bugs 2019-01-23 15:43:47 +08:00
Aleksey Kladov
7b28a15202 ⬆️ rowan 2019-01-22 23:37:03 +03:00
Erlend Tobiassen
c550c6759d
Add test for placeholder parameters in trait fn defs 2019-01-22 18:46:15 +01:00
Erlend Tobiassen
234b65fd61 Allow placeholder parameters in trait fn defs 2019-01-22 18:33:53 +01:00
Erlend Tobiassen
84f888e93d No need for is_type_start 2019-01-22 14:46:06 +01:00
Erlend Tobiassen
9f3d133813 Prefer TYPE_FIRST 2019-01-22 14:36:57 +01:00
Erlend Tobiassen
8198cde13b
Update tests after allowing where predicate to accept types 2019-01-22 14:32:23 +01:00
Erlend Tobiassen
2b22f5fb43 Optimistically bail out of where clause loop if not at start of a type or lifetime 2019-01-22 13:17:10 +01:00
Erlend Tobiassen
1aba42128f Don't leave a marker hanging without completing it. 2019-01-22 01:25:00 +01:00
Erlend Tobiassen
1059ec74e2 Allow types to the left of : in where predicates. 2019-01-22 01:11:35 +01:00
Florian Diebold
5862542ded Add AST/HIR for type args in path segments 2019-01-19 16:02:06 +01:00
Marcus Klaas de Vries
fa43ef30f4 Change parsing of struct field patterns 2019-01-19 15:37:26 +03:00
Marcus Klaas de Vries
bcbfa2cc11 Finish move of StructField for pattern type inference 2019-01-19 15:37:26 +03:00
Marcus Klaas de Vries
f9a6050034 Move parsing of field pattern lists to the parser (where it belongs) 2019-01-19 15:37:26 +03:00
Marcus Klaas de Vries
d48d5b8b6c Add initial (flawed) implementation of binding annotations 2019-01-19 15:37:26 +03:00
Marcus Klaas de Vries
ac216880f5 Implement unlabeled struct field pattern inference 2019-01-19 15:37:25 +03:00
Marcus Klaas de Vries
ab5deb7811 Create struct patterns up to the hir level 2019-01-19 15:37:25 +03:00
Marcus Klaas de Vries
afaa26636e Add additional pattern variants 2019-01-19 15:37:25 +03:00
Aleksey Kladov
b82fe73d1a make token set a const-fn 2019-01-19 15:36:58 +03:00
Hirokazu Hata
4729a1b054 Update ARRAY_EXPR grammar 2019-01-16 23:22:14 +09:00
bors[bot]
d75a0368f5 Merge #536
536: Introduce variable semicolon block expr r=matklad a=yerke

Fix for https://github.com/rust-analyzer/rust-analyzer/issues/504

Feels a bit hacky...

Co-authored-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
2019-01-16 06:20:09 +00:00
Yerkebulan Tulibergenov
5e35f191fc add has_semi to ExprStmt 2019-01-15 20:26:46 -08:00
Aleksey Kladov
dd45697e53 update salsa 2019-01-15 15:06:45 +03:00
Marcus Klaas de Vries
d67eabb512 Fix type inference for raw (byte) strings 2019-01-14 20:56:14 +01:00
Marcus Klaas de Vries
a9a6a50c75 Fixup tests 2019-01-14 19:30:21 +01:00
Marcus Klaas de Vries
606d66a714 Start moving literal interpretation to the AST (WIP) 2019-01-14 13:56:43 +01:00
Marcus Klaas de Vries
5f5dc20d85 Try implementing integer type inference (WIP) 2019-01-14 13:52:57 +01:00
Marcus Klaas de Vries
a6146d35b1 Implement type inference for literals (WIP) 2019-01-14 13:52:55 +01:00
Hirokazu Hata
6efda8f6ce Update TUPLE_EXPR grammar 2019-01-13 21:04:03 +09:00
Aleksey Kladov
8e554ea5fa support ref-patterns 2019-01-13 13:36:06 +03:00
DJMcNab
0b9e462ab0 Fix handling of attributes in positional field lists 2019-01-12 15:42:12 +00:00
Aleksey Kladov
2d3940d0ab rename TreePtr -> TreeArc
This is much clearer about the semantics
2019-01-11 19:59:06 +03:00
Aleksey Kladov
66d7adf1cb force serde in ra_syntax 2019-01-11 13:21:18 +03:00
DJMcNab
afdb569902 Fix handling of where clauses in tuple structs 2019-01-10 18:21:01 +00:00
Aleksey Kladov
d18d8399f5 fuzz-lockfile 2019-01-09 01:58:25 +03:00
Aleksey Kladov
921689b70d kill text utils 2019-01-08 22:03:13 +03:00
Aleksey Kladov
f553837c1c upstream text-utils to text_unit 2019-01-08 21:50:04 +03:00
Aleksey Kladov
0c88360eb4 add comment 2019-01-08 21:01:41 +03:00
Aleksey Kladov
702bdacb03 move node at offset to aglo already 2019-01-08 21:01:41 +03:00
Aleksey Kladov
96236a9be5 assist to convert if-let to match 2019-01-08 14:21:29 +03:00
Aleksey Kladov
fa6e0b0d38 itroduce trait for ast tokens 2019-01-08 12:23:10 +03:00
Aleksey Kladov
da0b348ae9 migrate ra_hir to rowan 2.0 2019-01-08 11:28:42 +03:00
Aleksey Kladov
fe53b28250 migrate ra_db to new rowan 2019-01-08 11:20:15 +03:00
Aleksey Kladov
b73c51ff9b wrap TreePtr 2019-01-08 11:20:15 +03:00
Aleksey Kladov
5618c8ade1 regenerate 2019-01-08 11:20:15 +03:00
Aleksey Kladov
d91a98ec84 switch ra_syntax to new rowan API 2019-01-08 11:20:15 +03:00
Aleksey Kladov
55272f2023 update rowan 2019-01-08 11:20:15 +03:00
Marcus Klaas de Vries
7b0eaef580 Implement type inference for more binary operators
Mostly just for primitive numeric types such as u32 and f64. Not
yet a general solution using trait resolution.
2019-01-07 20:11:31 +01:00
Marcus Klaas de Vries
3238c06a5a Add remaining binary operations to AST 2019-01-07 19:04:25 +01:00
bors[bot]
31c1999505 Merge #440
440: Implement type inference for boolean operators r=flodiebold a=marcusklaas

Tried implementing the easiest part of https://github.com/rust-analyzer/rust-analyzer/issues/390. Hope this is somewhat close to what the intent of the issue was. Found it surprisingly easy to find my way around the repository - it's well organized!

Very grateful for any pointers.

Co-authored-by: Marcus Klaas de Vries <mail@marcusklaas.nl>
2019-01-06 21:28:36 +00:00
Marcus Klaas de Vries
82d9a77dad Touch up type inference for boolean operators
Also try to infer its subexpressions and set type expectations
whenever possible.
2019-01-06 22:17:54 +01:00
Florian Diebold
8e3e5ab2c8 Make FnScopes use hir::Expr
This was a bit complicated. I've added a wrapper type for now that does the
LocalSyntaxPtr <-> ExprId translation; we might want to get rid of that or give
it a nicer interface.
2019-01-06 00:29:36 +01:00
Florian Diebold
136aba1cf3 Add HIR Expr machinery 2019-01-05 22:41:12 +01:00
Marcus Klaas de Vries
4fc233a02e Implement type inference for boolean operators 2019-01-05 21:28:30 +01:00
Aleksey Kladov
79fd6b5c88 change visibility can change pub to pub(crate) 2019-01-05 15:28:07 +03:00
Aleksey Kladov
ea3504057e split import assist 2019-01-05 13:56:33 +03:00
Florian Diebold
bb029cd29b Rename traits::impl_item -> impl_block as well, as well as the tests 2019-01-04 19:15:15 +01:00
Florian Diebold
111126ed3c Type the self parameter 2019-01-04 19:10:50 +01:00
Florian Diebold
ae9530addc Add HIR for impl blocks
Since we need to be able to go from def to containing impl block, as well as the
other direction, and to find all impls for a certain type, a design similar to
the one for modules, where we collect all impls for the whole crate and keep
them in an arena, seemed fitting. The ImplBlock type, which provides the public
interface, then consists only of an Arc to the arena containing all impls, and
the index into it.
2019-01-04 19:10:47 +01:00
Florian Diebold
fe6c4115f6 Rename ImplItem to ImplBlock
rustc uses the name ImplItem for items in impls, not the impl {} block itself,
which could lead to confusion.
2019-01-04 18:28:36 +01:00
csmoe
a0ef196d04 add mod doc comments test in ast 2019-01-04 21:51:45 +08:00
csmoe
f604ff5b2f parse doc comment for items 2019-01-04 21:29:00 +08:00
csmoe
8a6d6ac132 add mod doc comment test 2019-01-04 21:28:09 +08:00
bors[bot]
6295bbe6ec Merge #391
391: docing parser methods r=csmoe a=csmoe



Co-authored-by: csmoe <csmoe@msn.com>
2019-01-04 04:36:40 +00:00
csmoe
58139c558a consume trivias for type/const def 2019-01-04 12:22:57 +08:00
csmoe
df591a1e48 doc parsing events 2019-01-04 12:21:47 +08:00
Aleksey Kladov
a4635a199b more enterprisey assists API 2019-01-03 18:59:17 +03:00
Aleksey Kladov
0a80d9685a visibility owner 2019-01-03 15:21:31 +03:00
Aleksey Kladov
756e878158 add items from macros to modules 2019-01-01 22:15:35 +03:00
Aleksey Kladov
7dc45745a3 save top-level macros in module items 2019-01-01 22:15:35 +03:00