Commit graph

4589 commits

Author SHA1 Message Date
bors[bot]
f51a3fed9f
Merge #2580
2580: Fix highlighting token names r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-17 13:46:12 +00:00
Aleksey Kladov
1c8467e20a Fix highlighting token names 2019-12-17 14:45:46 +01:00
bors[bot]
4a58522119
Merge #2562
2562: Fix NavigationTarget ranges r=matklad a=edwin0cheng

Fix the issue described in https://github.com/rust-analyzer/rust-analyzer/pull/2544#issuecomment-565572553

This PR change the order for finding `full_range` of `focus_range` in following orders:
1. map both ranges to macro_call
2. map focus range to a token inside macro call, and full range to the whole of macro call
3. map both ranges to the whole of macro call

And fix the corresponding tests and make these tests easily to follow.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-17 13:37:32 +00:00
Aleksey Kladov
3e2f4e4293 Improve recovery for incomplete lambdas 2019-12-17 12:11:01 +01:00
Florian Diebold
91853590a9 Add test mark 2019-12-15 21:06:08 +01:00
Florian Diebold
6e1c2d0df8 Handle impl Trait more correctly
When calling a function, argument-position impl Trait is transparent; same for
return-position impl Trait when inside the function. So in these cases, we need
to represent that type not by `Ty::Opaque`, but by a type variable that can be
unified with whatever flows into there.
2019-12-15 18:56:38 +01:00
Florian Diebold
ac961b2614 Add test for unifying impl Trait 2019-12-15 17:45:32 +01:00
Omer Ben-Amram
6fba427bf3 remove unnecessary turbofish. 2019-12-15 18:15:24 +02:00
Omer Ben-Amram
40116af598 cfg gated tests that only work on windows. 2019-12-15 17:54:24 +02:00
Omer Ben-Amram
2e2fae32df improved path checking to consider only paths that may contain a windows drive. 2019-12-15 17:46:00 +02:00
Omer Ben-Amram
ebf302d261 move import inside cfg block 2019-12-15 17:03:39 +02:00
Omer Ben-Amram
324cbe839f Lowercase drive letters on windows before sending to extension. 2019-12-15 16:51:57 +02:00
Omer Ben-Amram
9a6d496497 use a module instead of prefixed consts. 2019-12-15 13:18:37 +02:00
Omer Ben-Amram
50ecb1e19b introduce named constants for highlighting tag names. 2019-12-15 12:39:31 +02:00
bors[bot]
3e8f9eb6c4
Merge #2559
2559: Add some granularity to syntax highlighting. r=matklad a=omerbenamram

Hi,

I wanted to start using `rust-analyzer` a bit more frequently - one of the main blockers for me so far was the highlighting.

I just discovered it's possible to override the default colors with `ralsp.<something>` setting without waiting for #2061!

However, the current implementation was lumping a bunch of different tokens into `type` and `literal`.
The golden standard IMO is what Clion is currently doing (and is my current daily driver for rust).

Clion allows users to control the coloring for specific literal kinds, and the default is to distinguish between them (numerics get a different color from strings, and special colors for bytestrings).

I've also splitted the builtin types, which are also allowed to be highlighted speratly.
My goal is to match the default experience I'm getting with clion.
The only blockers now I think is that `rust-analyzer` doesn't corrently infer types in some situations, so the highlighting information is incorrect in those cases.

This is what it looks like so far (with colors overriden to match clion's theme):
![image](https://user-images.githubusercontent.com/2467993/70848219-ccd97900-1e76-11ea-89e1-2e467cfcc9fb.png)

If there are any other changes you feel is necessary let me know.

I did leave the default colors to match the current behavior, since I'm not familiar with the colors for this theme, I added some random (different) colors in the test to check that it indeed was working.



Co-authored-by: Omer Ben-Amram <omerbenamram@gmail.com>
2019-12-15 09:00:11 +00:00
Omer Ben-Amram
feb5a4a8b8 fixed rainbow-highlighting test 2019-12-15 10:20:22 +02:00
Edwin Cheng
3ba4b3c554 Use simpler logic on original_range 2019-12-15 02:34:16 +08:00
bors[bot]
d6223253b6
Merge #2561
2561: Split generic and non-generic paths r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-14 18:16:48 +00:00
Aleksey Kladov
2619950b3b Use different types for path with and without generics 2019-12-14 19:15:40 +01:00
Edwin Cheng
b53587c7bd Re-export Origin to replace ExpansionOrigin 2019-12-15 01:46:39 +08:00
Edwin Cheng
61360fdfec Fix original_source find order 2019-12-15 01:24:51 +08:00
bors[bot]
202ad1e2d9
Merge #2552
2552: fix goto definition when inbetween tokens r=matklad a=succcubbus

fixes both goto_definition and goto_type_definition.
before, when running goto between some non-trivia token and an
identifier, goto would be attempted for the non-trivia token.
but this does not make sense for e.g. L_PAREN or COLONCOLON only for
IDENTs.

this resulted in goto actions not working when running them on the first
character of some identifier e.g. for `module::<|>method()` or
`method(<|>parameter)`.

now only IDENTs will be searched for in goto actions, though i'm not sure
if this is correct or if goto should also work for some other token types.  

Co-authored-by: succcubbus <16743652+succcubbus@users.noreply.github.com>
2019-12-14 17:20:18 +00:00
Aleksey Kladov
f720855e1e Use all-features by default 2019-12-14 17:05:12 +01:00
Omer Ben-Amram
5e4e713fc9 Merge branch 'refs/heads/master' into feature/granular-scopes 2019-12-14 17:29:30 +02:00
bors[bot]
77db617765
Merge #2554
2554: Add macros for known names and paths r=matklad a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-12-14 14:08:08 +00:00
bors[bot]
7238037de4
Merge #2548
2548: Support setting cargo features and resolve `default` features by default r=matklad a=oxalica

Fixes #2524 


Co-authored-by: oxalica <oxalicc@pm.me>
2019-12-14 11:57:49 +00:00
Omer Ben-Amram
083010f633 removed type.alias 2019-12-14 13:29:42 +02:00
Omer Ben-Amram
67641d3f5f added decorations 2019-12-14 13:24:07 +02:00
kjeremy
03fe6b38b8 Remove some unwraps in add_new 2019-12-13 18:28:01 -05:00
Florian Diebold
f02fcc1644 Use path macro 2019-12-13 22:33:38 +01:00
Florian Diebold
6911bc89a7 Rename N! to name! 2019-12-13 22:33:38 +01:00
Florian Diebold
259c42f00e Add macros for known names and paths 2019-12-13 22:33:37 +01:00
kjeremy
a234b5a3ca LSP 3.15 supports the deprecated tag on completions 2019-12-13 16:08:47 -05:00
succcubbus
c82529a97f for goto and hover pick the token based on a priority 2019-12-13 22:00:05 +01:00
succcubbus
4f7da04c67 add tests for goto on tuple fields 2019-12-13 21:59:25 +01:00
succcubbus
6c133017a8 try both surrounding tokens for hover 2019-12-13 21:10:25 +01:00
bors[bot]
9c9f4635b4
Merge #2550
2550: Infer - and ! using std::ops::{Neg, Not} r=flodiebold a=kiljacken

Found some low hanging fruit while taking a cursory look at index inferring.

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2019-12-13 19:49:01 +00:00
succcubbus
6c42eb1930 add failing test 2019-12-13 19:54:07 +01:00
succcubbus
f54fef85aa use find() instead of filter().next() 2019-12-13 19:54:02 +01:00
succcubbus
4df741ecb2 fix goto definition when inbetween tokens
fixes both goto_definition and goto_type_definition.
before, when running goto between some non-trivia token and an
identifier, goto would be attempted for the non-trivia token.
but this does not make sense for e.g. L_PAREN or COLONCOLON only for
IDENTs. now only IDENTs will be searched for in goto actions.
2019-12-13 19:20:02 +01:00
Omer Ben-Amram
30672c420e scopes resolution is more granular 2019-12-13 19:03:48 +02:00
Edwin Cheng
98f98cbb54 Refactor tt::Delimiter 2019-12-13 21:53:34 +08:00
Emil Lauridsen
7705209051 Correctly infer - and ! using std::ops::{Neg,Not} 2019-12-13 12:45:38 +01:00
Emil Lauridsen
95dc2de8e9 Add helper for resolving associated type of trait in infer 2019-12-13 12:45:37 +01:00
bors[bot]
16cf6bcf4b
Merge #2544
2544: Map first and last tokens in original_range r=matklad a=edwin0cheng

This PR try to fix the first part of the `original_range` : Try to map the first token and last token of a `SyntaxNode` , If success, return the union range of mapped tokens. 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-13 10:21:19 +00:00
oxalica
af4eb26645
Support setting cargo features 2019-12-13 18:16:34 +08:00
Edwin Cheng
47f2b5d0d9 Map first and last node in original_range 2019-12-13 02:39:14 +08:00
Aleksey Kladov
332f2205b0 Correct obsolete comment 2019-12-12 17:17:57 +01:00
Aleksey Kladov
125559c14b Move use tree lowering to a separate module 2019-12-12 17:15:57 +01:00
bors[bot]
254c8efc5b
Merge #2540
2540: Dedupe from_source impls r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-12 14:51:02 +00:00
Aleksey Kladov
8e65b77387 Dedupe from_source impls 2019-12-12 15:50:16 +01:00
bors[bot]
c213c3b36b
Merge #2539
2539: Remove old location infra r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-12 14:20:02 +00:00
Aleksey Kladov
7a255a2f93 Remove old location infra 2019-12-12 15:19:07 +01:00
Aleksey Kladov
56710f119b Move enum&union to new loc 2019-12-12 15:11:57 +01:00
Aleksey Kladov
f135a8ea55 Move structs to new loc 2019-12-12 14:58:04 +01:00
Aleksey Kladov
63c192b34a Simplify from_source 2019-12-12 14:48:33 +01:00
Aleksey Kladov
82e9b24558 Move traits to the new loc 2019-12-12 14:36:14 +01:00
bors[bot]
d8dba7fbe5
Merge #2537
2537: Switch to the new location for impls r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-12 13:25:59 +00:00
Aleksey Kladov
7b0644d81e Switch to the new location for impls 2019-12-12 14:25:34 +01:00
bors[bot]
b2638fcd2c
Merge #2536
2536: Avoid recompiling serde r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-12 13:12:02 +00:00
Aleksey Kladov
b0739d5a26 Avoid recompiling serde 2019-12-12 14:11:06 +01:00
Jeremy Kolb
b4c8e5b9e9 Do not trigger signature help on close 2019-12-12 07:55:05 -05:00
Aleksey Kladov
6c6e6978eb Update lsp-types more 2019-12-11 18:34:36 +01:00
Aleksey Kladov
b0a4765059 Revert "Revert "Support LSP 3.15""
This reverts commit 1e0bf205ef.
2019-12-11 18:34:01 +01:00
Aleksey Kladov
1e0bf205ef Revert "Support LSP 3.15"
This reverts commit 712700d8e0.
2019-12-11 18:27:34 +01:00
Jeremy Kolb
fcccf8ec59 Support LSP 3.15
This merely upgrades our protocol support. It does not add any of the new features.
2019-12-11 09:11:55 -05:00
Gabriel Luo
20ccabc01d Fixed #2250
Tuple in type annotation expands correctly;
Expansion will prefer the following delimiter when possible. 
New regression tests added to verify the consistency between tuple expansion in type annotation and tuple expansion in rvalue.
2019-12-10 22:18:05 -05:00
Aleksey Kladov
d89996fd5b Build correct SourceAnalyzer for traits 2019-12-10 13:52:04 +01:00
Laurențiu Nicola
16df4d8fcb chore: bump deps and use mainline chalk 2019-12-09 22:35:47 +02:00
Aleksey Kladov
b683cbd93d Report correct original range in goto_definition 2019-12-09 19:46:35 +01:00
Aleksey Kladov
5a012fb9fd Implement ra_lsp_server --version 2019-12-09 16:11:46 +01:00
bors[bot]
6b1c2ee168
Merge #2500 #2505 #2506
2500: Fix format_args expansion & go to definition r=matklad a=flodiebold

The expansion of format_args wasn't yet correct enough to type-check. Also make macros in statement position expand to expressions for now, since it's not handled correctly in HIR lowering yet. This finally fixes go to definition within print macros, I think 🙂 

2505: Remove more dead code r=matklad a=matklad



2506: Remove one more Ty r=matklad a=matklad



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-08 16:53:21 +00:00
Aleksey Kladov
61c3887b70 Remove one more Ty 2019-12-08 17:50:43 +01:00
Aleksey Kladov
a1639d0d1e Remove more dead code 2019-12-08 17:45:14 +01:00
Aleksey Kladov
6805bb01e2 Cleanup module structure 2019-12-08 17:45:14 +01:00
bors[bot]
d0ad30ad97
Merge #2501 #2502 #2503
2501: Fix coercion from &Foo to an inference variable in a reference r=matklad a=flodiebold

We didn't try to unify within the reference, but we should.

2502: Delay legacy macro expansion r=matklad a=edwin0cheng

This PR make the following changes:

* Delay legacy macro expansion such that we concentrated all item collecting macro expansion in one place.
* Add `MacroDirective` to replace 3-tuples 
* After this refactoring, no macro is expanded recursively, hence we can remove the `MacroStackMonitor` and we handle the expansion limit by the fix-point loop count. 

2503: Code: check whether the LSP binary is in PATH r=matklad a=lnicola

I'm not really sure about the TS changes. I just made a couple of functions async and it seems to work.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2019-12-08 16:44:29 +00:00
Edwin Cheng
3a95d01d0c Delay legacy macro expansion 2019-12-08 20:33:42 +08:00
Florian Diebold
d0c9bb0abf Fix coercion from &Foo to an inference variable in a reference
We didn't try to unify within the reference, but we should.
2019-12-08 13:06:59 +01:00
Florian Diebold
5e096def15 Expand macros in blocks to expressions for now
Expanding to statements isn't handled properly yet and breaks things.
2019-12-08 13:03:13 +01:00
Florian Diebold
2223620313 Fix range in goto_through_format test 2019-12-08 13:02:52 +01:00
Florian Diebold
91f28e43a2 Fix expansion of format_args 2019-12-08 13:02:52 +01:00
bors[bot]
596e6db46c
Merge #2499
2499: Remove ty from code_model r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-08 11:52:43 +00:00
Aleksey Kladov
e2cc552076 Remove dead code 2019-12-08 12:51:25 +01:00
Aleksey Kladov
b37c6a746b Remove ty from code_model 2019-12-08 12:44:14 +01:00
Aleksey Kladov
b77d7c24aa Remove bodies from code_model 2019-12-08 12:27:21 +01:00
Aleksey Kladov
b017bae837 remove infer method from CodeModel 2019-12-08 12:26:53 +01:00
bors[bot]
7a6b6ed0a5
Merge #2498
2498: Drop some unused methods r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-08 11:24:44 +00:00
Aleksey Kladov
7aacf9a197 Drop some unused methods 2019-12-08 12:24:21 +01:00
Aleksey Kladov
200bda3daf Cleanup Field ty 2019-12-08 12:16:57 +01:00
Aleksey Kladov
08d3166c8b Cleanup Crate API 2019-12-08 12:02:53 +01:00
bors[bot]
b236f6aa49
Merge #2466
2466: Handle partial resolve cases r=matklad a=edwin0cheng

Another try to fix #2443 :

We resolve all imports every time in `DefCollector::collect` loop even it is resolved previously.  
This is because other unresolved imports and macros will bring in another `PerNs`, so we can only assume that it has been partially resolved.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-08 10:44:30 +00:00
Edwin Cheng
509fedd9d2 Remove MacroFileKind 2019-12-08 16:16:52 +08:00
Aleksey Kladov
6e2e60cbc9 Discover type parameters in more cases 2019-12-07 21:55:02 +01:00
Aleksey Kladov
88c5b1282a Rename GenericParam -> TypeParam
We don't have LifetimeParam yet, but they are planned!
2019-12-07 20:25:48 +01:00
Aleksey Kladov
f4f8b81474 Get the right analyzer for impls 2019-12-07 20:05:08 +01:00
Aleksey Kladov
7d2080a031 Classify name works for TypeParams 2019-12-07 19:52:09 +01:00
Aleksey Kladov
d1a01aa2f8 Gotodef for TypeParameters 2019-12-07 19:44:43 +01:00
Aleksey Kladov
1692f07393 ToNav for GenericParam 2019-12-07 19:44:43 +01:00
Aleksey Kladov
dda9587e75 Track source of type parameters 2019-12-07 19:44:43 +01:00
Aleksey Kladov
d75f768c13 Minor 2019-12-07 19:44:43 +01:00
Aleksey Kladov
decc4cb084 Show type hints for & patterns 2019-12-07 19:15:52 +01:00
Aleksey Kladov
6bd9fb8525
Merge pull request #2491 from matklad/skip-heavy-tests-by-default
Skip slow tests by default
2019-12-07 13:46:02 +01:00
Aleksey Kladov
8ec5f2fcdc Skip slow tests by default 2019-12-07 13:19:42 +01:00
Aleksey Kladov
29b5e1ec2a Reformat 2019-12-07 13:19:21 +01:00
Aleksey Kladov
d6c2b92409 Refactor parameter count tracking 2019-12-07 13:13:00 +01:00
Aleksey Kladov
8e9837df21 Remove idx and parent generics from generics
This makes `hir_def::GenericParams` flatter. The logic for
re-numbering the params is moved to hir instead.
2019-12-07 13:05:56 +01:00
Aleksey Kladov
30fefcc08c Store GenericParams in arena 2019-12-07 13:05:56 +01:00
Edwin Cheng
51f4fb448f Refactor resolve_imports logic 2019-12-07 19:24:15 +08:00
Florian Diebold
de08d30b80 Get rid of unwraps in add_new
Probably fixes #2464.
2019-12-07 11:54:26 +01:00
Edwin Cheng
e5997e1746 Push glob_imports only if non-exists 2019-12-07 09:50:21 +08:00
bors[bot]
431836f4a0
Merge #2489
2489: Implement `format_args` r=flodiebold a=flodiebold

This fixes a huge amount of type mismatches (because every format call was a type mismatch so far); I also hoped to get go to def working within `format!` etc., and the test says it should, but in practice it still doesn't seem to...

Also remove the `len` parameter from `Name::new_inline_ascii`, which I'm assuming was only there because of `const fn` limitations?

cc @edwin0cheng 

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-12-06 20:59:51 +00:00
Florian Diebold
b2c01f446e Implement ancestors_with_macros in a better way 2019-12-06 21:53:31 +01:00
bors[bot]
f18b7e18c4
Merge #2484
2484: DynMap r=matklad a=matklad

Implement a `DynMap` a semi-dynamic, semi-static map, which helps to thread heterogeneously typed info in a uniform way. Totally inspired by df3bee3038/compiler/frontend/src/org/jetbrains/kotlin/resolve/BindingContext.java. 

@flodiebold wdyt? Seems like a potentially useful pattern for various source-map-like things.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-06 20:28:28 +00:00
Aleksey Kladov
8c86963d47 DynMap
This might, or might not help us to reduce boilerplate associated with
plumbing values from analysis to the IDE layer
2019-12-06 21:28:05 +01:00
Florian Diebold
c80dc0ad3a Make the goto_through_format test actually fail :( 2019-12-06 21:25:22 +01:00
Florian Diebold
4a99ef5c39 Builtin macros only use caller tokens 2019-12-06 21:25:22 +01:00
Florian Diebold
a565072dde Try to make go to definition work in format!
SourceAnalyzer didn't work properly within expression macro expansions because
it didn't find the enclosing function. Fix this by going up the expansion chain
to find ancestors. This makes the test work, but apparently in real usage it's
still not working.
2019-12-06 21:25:22 +01:00
Florian Diebold
eae425b10f Implement format_args more properly 2019-12-06 21:25:22 +01:00
Florian Diebold
3a5aa03e66 Remove unnecessary len parameter for Name::new_inline_ascii
I assume it was previously required because `len` was not const, but that
doesn't seem to be a problem anymore.
2019-12-06 21:25:22 +01:00
Florian Diebold
c5ffb0dc81 Add stub implementation of format_args{_nl} macros
Just enough to fix the huge amount of type mismatches they cause.
2019-12-06 21:25:22 +01:00
bors[bot]
d3702c02cd
Merge #2481
2481: Remove obsolete comment r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-06 20:03:44 +00:00
Edwin Cheng
76ff5b7c15 Add tests 2019-12-06 23:48:45 +08:00
Florian Diebold
f86fe3d891 Don't unify within a reference
If we are expecting a `&Foo` and get a `&something`, when checking the
`something`, we are *expecting* a `Foo`, but we shouldn't try to unify whatever
we get with that expectation, because it could actually be a `&Foo`, and `&&Foo`
coerces to `&Foo`. So this fixes quite a few false type mismatches.
2019-12-06 15:15:26 +01:00
Aleksey Kladov
b84ce79f91 Simplify test 2019-12-05 21:17:17 +01:00
bors[bot]
6e10a9f578
Merge #2479
2479: Add expansion infrastructure for derive macros r=matklad a=flodiebold

I thought I'd experiment a bit with attribute macro/derive expansion, and here's what I've got so far. It has dummy implementations of the Copy / Clone derives, to show that the approach works; it doesn't add any attribute macro support, but I think that fits into the architecture.

Basically, during raw item collection, we look at the attributes and generate macro calls for them if necessary. Currently I only do this for derives, and just add the derive macro calls as separate calls next to the item. I think for derives, it's important that they don't obscure the actual item, since they can't actually change it (e.g. sending the item token tree through macro expansion unnecessarily might make completion within it more complicated).

Attribute macros would have to be recognized at that stage and replace the item (i.e., the raw item collector will just emit an attribute macro call, and not the item). I think when we implement this, we should try to recognize known inert attributes, so that we don't do macro expansion unnecessarily; anything that isn't known needs to be treated as a possible attribute macro call (since the raw item collector can't resolve the macro yet).

There's basically no name resolution for attribute macros implemented, I just hardcoded the built-in derives. In the future, the built-ins should work within the normal name resolution infrastructure; the problem there is that the builtin stubs in `std` use macros 2.0, which we don't support yet (and adding support is outside the scope of this).

One aspect that I don't really have a solution for, but I don't know how important it is, is removing the attribute itself from its input. I'm pretty sure rustc leaves out the attribute macro from the input, but to do that, we'd have to create a completely new syntax node. I guess we could do it when / after converting to a token tree.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-12-05 20:00:20 +00:00
Florian Diebold
10697041c1 Implement all the other built-in derives
Since as long as we're not implementing the bodies, they all work the same way.
2019-12-05 19:52:52 +01:00
Florian Diebold
db8a00bd99 Implement derive(Copy, Clone) properly (well, kind of) 2019-12-05 19:29:57 +01:00
Florian Diebold
ab4ecca210 Don't wrap most syntax trees in invisible delimiters when converting to token tree
Otherwise parsing them again doesn't work.
2019-12-05 19:29:39 +01:00
Aleksey Kladov
518b5bf927 Remove obsolete comment 2019-12-05 17:55:38 +01:00
Florian Diebold
18f6a995d0 Add expansion infrastructure for derive macros 2019-12-05 17:23:09 +01:00
Aleksey Kladov
1a567f5ca2 Reduce copy-paste 2019-12-05 16:56:13 +01:00
Aleksey Kladov
0c0ce1ae41 Introduce ChildFromSource 2019-12-05 16:55:54 +01:00
ice1000
d15f300268 Publicize file_id to make test_db compile 2019-12-05 08:37:39 -05:00
ice1000
006a583381 Use placeholder instead of Option 2019-12-05 08:33:29 -05:00
ice1000
7702f690a9 One pub function less is good! 2019-12-05 08:28:31 -05:00
ice1000
762915826a Reduce visibility, use struct instead of tuples 2019-12-05 08:19:27 -05:00
ice1000
088f50c0ab No block at the moment 2019-12-04 18:30:42 -05:00
ice1000
032eb3d68e Remove almost unused ModuleSource::new 2019-12-04 18:30:42 -05:00
ice1000
5c5f90ba57 Confluent ModuleSource usage 2019-12-04 18:30:42 -05:00
ice1000
38853459e3 Add ModuleSource::Block 2019-12-04 18:30:42 -05:00
ice1000
7cbedc50bc Fix test compilation 2019-12-04 18:30:42 -05:00
ice1000
1bb59a7d08 Three-state enum for module origin 2019-12-04 18:30:42 -05:00
Vincent Rouillé
b437dca4bd
Run rustfmt with respect to Cargo.toml edition 2019-12-04 23:05:01 +01:00
Aleksey Kladov
193b1a7437 ⬆️ rowan 2019-12-04 17:15:55 +01:00
bors[bot]
c6e4cadfce
Merge #2471
2471: Add `ModuleItemsOwner` to `Block` r=matklad a=ice1000

As title

Co-authored-by: ice1000 <ice1000kotlin@foxmail.com>
2019-12-03 17:24:16 +00:00
ice1000
379482068d Add ModuleItemsOwner to Block 2019-12-03 12:07:39 -05:00
Florian Diebold
9747156f6c Split up ty tests a bit 2019-12-03 18:00:29 +01:00
ice1000
009437f5d9 Replace ra_hir_expand::either with crate 2019-12-03 11:07:56 -05:00
Florian Diebold
e4add45951 Fix #2467
The stand-alone `unify` requires that the type doesn't contain any type
variables. So we can't share the code here for now (without more refactoring)...
2019-12-03 15:01:23 +01:00
bors[bot]
ba4f7fa02f
Merge #2465
2465: Extract built-in trait implementations to separate module r=matklad a=flodiebold

This untangles the builtin logic from the Chalk translation.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-12-03 13:43:05 +00:00
Florian Diebold
18f25acb89 Make unify pub(crate) 2019-12-03 13:58:02 +01:00
Florian Diebold
176207f1e8 Extract built-in trait implementations to separate module
This untangles the builtin logic from the Chalk translation.
2019-12-03 12:30:50 +01:00
Florian Diebold
a5a07bde04 Add tests for checking the impl self type 2019-12-02 19:33:13 +01:00
Florian Diebold
cfa50df33e Refactor a bit 2019-12-02 19:33:13 +01:00
Florian Diebold
456d52fdfa Check receiver type properly 2019-12-02 19:33:13 +01:00
Florian Diebold
599dab5982 Extract unification code to unify module 2019-12-02 19:33:13 +01:00
Florian Diebold
cbf262a1bc Change order of calls to get method candidate order correct 2019-12-02 19:33:13 +01:00
bors[bot]
3376c08052
Merge #2018
2018: assists: add assist for custom implementation for derived trait r=matklad a=paulolieuthier

Please, tell me if something could be more idiomatic or efficient.

Fixes #1256.

Co-authored-by: Paulo Lieuthier <paulolieuthier@gmail.com>
2019-12-02 15:52:11 +00:00
bors[bot]
ec164fbb68
Merge #2455
2455: Add BuiltinShadowMode r=flodiebold a=edwin0cheng

This PR try to fix #1905 by introduce an `BuiltinShadowMode` in name resolving functions. 

cc @flodiebold 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-01 11:13:25 +00:00
Edwin Cheng
cfc6e9e366 Remove some empty lines 2019-12-01 12:17:52 +08:00
Edwin Cheng
13c54685ff Use index instead of peekable 2019-12-01 12:14:35 +08:00
Edwin Cheng
5f11117733 Fix comment 2019-12-01 12:14:12 +08:00
bors[bot]
780f476b4f
Merge #2451
2451: Use env_logger instead of flexi_logger r=matklad a=AlexanderEkdahl

This fixes https://github.com/rust-analyzer/rust-analyzer/issues/2335

- By default only `error` will be printed. From what I can tell this matches the current behaviour. Configured through `RUST_LOG`.
- I looked through the optional dependencies for `env_logger`and I have only enabled `human_time`. Without this feature no timestamp will be shown for log messages.
- `RA_LOG_DIR` feature is removed

This PR adds 2 new dependencies(`env_logger` and `human_time`) and removes 6 dependencies.

Co-authored-by: Alexander Ekdahl <alexander@ekdahl.io>
2019-11-30 19:19:28 +00:00
Edwin Cheng
bb601e7eaf Add BuiltinShadowMode 2019-11-30 23:29:21 +08:00
Florian Diebold
1c622e9fed Add cycle recovery for type aliases 2019-11-30 12:57:32 +01:00
Florian Diebold
3ca40f7c08 Add cycle recovery for generic predicates 2019-11-30 12:57:32 +01:00
Florian Diebold
cf6809645e Handle cycles in impl types better
- impl Trait<Self> for S is allowed
 - impl Trait for S<Self> is an invalid cycle, but we can add cycle recovery for
   it in Salsa now
2019-11-30 12:57:32 +01:00
bors[bot]
7cecd0f331
Merge #2449
2449: Only allow renames to valid identifiers r=matklad a=detrumi

Implements #2121 

Co-authored-by: Wilco Kusee <wilcokusee@gmail.com>
2019-11-30 10:43:35 +00:00
Alexander Ekdahl
3fe539ce51 Remove log dependency from ra_cli 2019-11-29 19:40:59 -05:00
Alexander Ekdahl
eb4e70fc67 Remove flexi_logger from ra_lsp_server 2019-11-29 19:35:03 -05:00
Alexander Ekdahl
9c01c0dcb5 Use env_logger in ra_cli 2019-11-29 19:20:48 -05:00
Wilco Kusee
b3856568af
Push identifier check to rename function 2019-11-29 16:06:20 +01:00
Wilco Kusee
645df2b5f5
Test rename for various identifiers 2019-11-29 16:03:39 +01:00
Wilco Kusee
be9ba2b392
Move identifier check to analysis 2019-11-29 15:52:12 +01:00
Wilco Kusee
f081c9d94d
Also allow renaming to underscore 2019-11-29 15:27:22 +01:00
Wilco Kusee
9c764cb966
Only allow renames to valid identifiers 2019-11-29 15:14:53 +01:00
oxalica
2cb684bbce
Reduce variants of Expr 2019-11-29 14:49:12 +08:00
Paulo Lieuthier
5b2d52c8df docs: describe new feature 'add custom impl for derived trait' 2019-11-28 17:36:40 -03:00
Paulo Lieuthier
439080f027 assists: add assist for custom implementation for derived trait 2019-11-28 16:56:06 -03:00
oxalica
4992d2bf79
Infer range types 2019-11-29 03:10:16 +08:00
Aleksey Kladov
8f1f5a783a Move source-related traits to a separate module 2019-11-28 19:05:21 +03:00
Aleksey Kladov
e823c578c9 Use InFile for AstId 2019-11-28 16:02:38 +03:00
Aleksey Kladov
ccd1b0800a Rename Source -> InFile 2019-11-28 12:50:26 +03:00
Edwin Cheng
89fbd0db02 Derive Hash for TokenTrees 2019-11-28 13:41:58 +08:00
Aleksey Kladov
1d14fd1737 Use Name::missing consistently 2019-11-27 23:22:20 +03:00
Aleksey Kladov
04735abfae Minimize API 2019-11-27 22:21:01 +03:00
Aleksey Kladov
8d34696826 Memoize impl resolutions 2019-11-27 22:12:09 +03:00
Aleksey Kladov
27b362b059 Reformat 2019-11-27 21:44:38 +03:00
Aleksey Kladov
757e593b25 rename ra_ide_api -> ra_ide 2019-11-27 21:35:06 +03:00
Aleksey Kladov
d9a36a736b Rename module_id -> local_id 2019-11-27 21:31:51 +03:00
Aleksey Kladov
47ec2ceb12 prune deps 2019-11-27 21:26:49 +03:00
Aleksey Kladov
a87579500a Move Ty 2019-11-27 21:16:00 +03:00
Aleksey Kladov
3686530815 Decouple 2019-11-27 16:48:48 +03:00
Aleksey Kladov
12501fcdd0 Remove TypableDef 2019-11-27 16:39:58 +03:00
Aleksey Kladov
d6e8f27488 Cleanup imports 2019-11-27 16:29:11 +03:00
Aleksey Kladov
9fa46ff5c6 Use Id for variats 2019-11-27 16:25:01 +03:00
Aleksey Kladov
17680f6060 More decoupling 2019-11-27 16:02:33 +03:00
Aleksey Kladov
d569869f7a Decouple more 2019-11-27 15:56:20 +03:00
Aleksey Kladov
1fe9656ba4 Decouple 2019-11-27 12:47:18 +03:00
Aleksey Kladov
825049bc62 Decouple 2019-11-27 12:34:26 +03:00
Aleksey Kladov
e91ebfc752 Cleanup imports 2019-11-27 12:13:07 +03:00
Aleksey Kladov
3a0929fca7 Decouple 2019-11-27 12:02:54 +03:00
Aleksey Kladov
a306531e6a Decouple 2019-11-27 11:40:10 +03:00
Aleksey Kladov
aa45561183 Crate -> CrateId 2019-11-27 09:42:55 +03:00
bors[bot]
d652e1e67f
Merge #2422
2422: Use a simple progress bar instead of indicatif r=maklad a=edwin0cheng

![pb](https://user-images.githubusercontent.com/11014119/69669230-6a3d5a80-10cc-11ea-8ad7-4dccb10349c9.gif)


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-26 21:02:32 +00:00
Edwin Cheng
f0aaf3b296 Fill all last text to space and return the cursor 2019-11-27 05:01:13 +08:00
Edwin Cheng
27943bead6 Remove progress bar and add a true counter 2019-11-27 04:34:06 +08:00
Edwin Cheng
97f6f141ee Remove commented code 2019-11-27 04:16:03 +08:00
Edwin Cheng
5b49ad5bd5 Use a simple progress bar instead of indicatif 2019-11-27 04:09:30 +08:00
Aleksey Kladov
bed6869865 Cleanup 2019-11-26 22:56:07 +03:00
Aleksey Kladov
cace49e9a7 Decouple 2019-11-26 22:31:04 +03:00
bors[bot]
d770f22c53
Merge #2420
2420: Remove last traces of adt from Ty r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-26 18:42:52 +00:00
bors[bot]
3206b83a70
Merge #2418
2418: Hide MacroCallLoc outside hir_expand  r=matklad a=edwin0cheng

This PR refactor `MacroCallLoc` such that it  be hided to become implementation details of hir_expand. 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-26 18:34:15 +00:00
Aleksey Kladov
936c6950e7 Remove last traces of adt from Ty 2019-11-26 21:32:39 +03:00
Aleksey Kladov
882fe0a47e More precise NameKind::Self 2019-11-26 21:32:39 +03:00
bors[bot]
141fca6006
Merge #2419
2419: Remove ns-polymorphic type_for_def r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-26 18:07:21 +00:00
Aleksey Kladov
4e415a269e Remove ns-polymorphic type_for_def 2019-11-26 21:04:24 +03:00
Edwin Cheng
447268ceac Hide MacroCallLoc 2019-11-27 01:33:08 +08:00
Aleksey Kladov
6fb4871f31 Add note 2019-11-26 19:30:57 +03:00
Aleksey Kladov
475367d08a Cleanup imports 2019-11-26 18:07:40 +03:00
Aleksey Kladov
b60b26b8ab Reduce visibility 2019-11-26 18:02:50 +03:00
Aleksey Kladov
72d8e7e69a Use TraitId in TraitRef 2019-11-26 18:01:34 +03:00
Aleksey Kladov
24b1e79af5 Remove another helper 2019-11-26 17:45:06 +03:00
Aleksey Kladov
25b32f9d68 Doc 2019-11-26 17:44:43 +03:00
Aleksey Kladov
d118997b93 Remove assoc_type_by_name helper 2019-11-26 17:44:43 +03:00
Aleksey Kladov
9bc8f1f4f8 Store names in TraitData 2019-11-26 17:44:43 +03:00
Aleksey Kladov
4a0792362e Detangle ty from traits a bit 2019-11-26 17:44:43 +03:00
bors[bot]
4d753fa6f5
Merge #2412
2412: Fix stale crates that snuck in r=kjeremy a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-11-26 13:26:23 +00:00
Jeremy Kolb
b81548c73a Fix stale crates that snuck in 2019-11-26 08:20:40 -05:00
bors[bot]
4822d26540
Merge #2406
2406: Add hygiene information to SourceAnalyzer r=matklad a=edwin0cheng

This should fix https://github.com/rust-analyzer/rust-analyzer/pull/2392#issuecomment-557964686

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-26 13:18:03 +00:00
Edwin Cheng
0623164c1d Remove dbg! 2019-11-26 21:13:36 +08:00
bors[bot]
36dca8de93
Merge #2410
2410: Introduce hir_ty r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-26 12:42:15 +00:00
Aleksey Kladov
4e17718a9a Doc primitives 2019-11-26 15:41:48 +03:00
Aleksey Kladov
45d05ed783 id-ify impls_in_crate_query 2019-11-26 15:36:25 +03:00
Jeremy Kolb
8b1f2cd14e Update parking_lot and smallvec to drop some dependencies 2019-11-26 07:29:28 -05:00
Aleksey Kladov
4c43631829 Introduce hir_ty 2019-11-26 15:06:06 +03:00
Aleksey Kladov
a443b5033c Id-ify Ty::Adt 2019-11-26 14:29:12 +03:00
Aleksey Kladov
e5eadb3390 Introduce hir::Type
It should provide a convenient API over more low-level Ty
2019-11-26 14:02:57 +03:00
Aleksey Kladov
0a7ef09331 Use chalk fork to paper over #2052 2019-11-26 11:46:09 +03:00
Aleksey Kladov
131c2da6bf ⬆️ salsa 2019-11-26 11:29:20 +03:00
Edwin Cheng
245a9b165a Add hygiene information to SourceAnalyzer 2019-11-26 15:05:53 +08:00
Aleksey Kladov
1a0da6d4da Use TypeAliasId in Ty, pt 2 2019-11-25 18:58:17 +03:00
Aleksey Kladov
6d2ec8765d Use TypeAliasId in Ty, pt 1 2019-11-25 18:44:36 +03:00
Aleksey Kladov
3e32ac4f86 More ids in Ty 2019-11-25 18:31:48 +03:00
Aleksey Kladov
1455663ea1 Fixme for union fields 2019-11-25 17:50:49 +03:00
Aleksey Kladov
5fd68b5929 Fix hir for ast::UnionDef 2019-11-25 17:50:49 +03:00
Aleksey Kladov
e1c0bdaf75 Introduce dedicated AST node for union
Although structs and unions have the same syntax and differ only in
the keyword, re-using the single syntax node for both of them leads to
confusion in practice, and propagates further down the hir in an
upleasent way.

Moreover, static and consts also share syntax, but we use different
nodes for them.
2019-11-25 17:50:49 +03:00
bors[bot]
be00d74c7b
Merge #2388
2388: Show missing struct fields in the error message r=matklad a=Frizi

This provides the most interesting information about the "missing structure fields" error directly to the user.

Co-authored-by: Frizi <frizi09@gmail.com>
2019-11-25 13:42:36 +00:00
Aleksey Kladov
78791d6fac Use ids for Callable 2019-11-25 16:26:52 +03:00
Aleksey Kladov
9047a4ad46 Use more IDs 2019-11-25 16:16:41 +03:00
Aleksey Kladov
5f39c5794e Use GenericDefIdMore 2019-11-25 15:54:03 +03:00
Aleksey Kladov
c2a16632d0 Use GenericDefId more 2019-11-25 15:39:12 +03:00
Aleksey Kladov
8c3e372835 Remove Resolver from autoderef
Resolver holds onto too much context, including local scopes. Let's
try to pass in only what is necessary -- the trait environment.
2019-11-25 13:10:26 +03:00
Aleksey Kladov
bd53bd80bf Push resolver up 2019-11-25 12:45:45 +03:00
bors[bot]
e00e6554dd
Merge #2362
2362: Expand compile_error! r=edwin0cheng a=kjeremy

Does not validate that the input is a string literal. I thought that I could `match_ast!` against the `macro_args` but that did not work. Even if it had I am not sure which error would be appropriate.

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-11-25 04:51:42 +00:00
bors[bot]
a888441c47
Merge #2392
2392: Fix panic during the expansion of `column!` r=edwin0cheng a=marcogroppo

Fixes #2379. Well, this isn't the "proper" fix but it doesn't hurt, IMHO.

The problem is that `to_col_number`, called by `column_expand`, receives a position number that isn't included in the text range of the file. My (very limited) understanding is that the text is the one of the original file, while `pos` is relative to something else, probably the text of the macro. Notice that in this case the `column!` expansion seems to be triggered by `assert_eq!`, so we're in the middle of another expansion. This PR simply avoids the panic by checking the length of the text.

r? @edwin0cheng 


Co-authored-by: Marco Groppo <marco.groppo@gmail.com>
2019-11-25 02:42:17 +00:00
Jeremy Kolb
67d3600f59 Expand compile_error! 2019-11-24 19:01:51 -05:00
Marco Groppo
ceb13a0494 Fix panic during the expansion of column! 2019-11-24 23:49:58 +01:00
bors[bot]
f7f9757b6b
Merge #2396
2396: Switch to variant-granularity field type inference r=flodiebold a=matklad

r? @flodiebold 

Previously, we had a `ty` query for each field. This PR switcthes to a query per struct, which returns an `ArenaMap` with `Ty`s. 

I don't know which approach is better. What is bugging me about the original approach is that, if we do all queries on the "leaf" defs, in practice we get a ton of queries which repeatedly reach into the parent definition to compute module, resolver, etc. This *seems* wasteful (but I don't think this is really what causes any perf problems for us). 

At the same time, I've been looking at Kotlin, and they seem to use the general pattern of analyzing the *parent* definition, and storing info about children into a `BindingContext`. 

I don't really which way is preferable. I think I want to try this approach, where query granularity generally mirrors the data granularity. The primary motivation for me here is probably just hope that we can avoid adding a ton of helpers to a `StructField`, and maybe in general avoid the need to switch to a global `StructField`, using `LocalStructFieldId` most of the time internally. 

For external API (ie, for `ra_ide_api`), I think we should continue with fine-grained `StructField::ty` approach, which internally fetches the table for the whole struct and indexes into it.

In terms of actual memory savings, the results are as follows:

```
This PR:
   142kb FieldTypesQuery (deps)
    38kb FieldTypesQuery

Status Quo:
   208kb TypeForFieldQuery (deps)
    18kb TypeForFieldQuery
```

Note how the table itself occupies more than twice as much space! I don't have an explanation for this: a plausible hypothesis is that single-field structs are very common and for them the table is a pessimisation. 

THere's noticiable wallclock time difference.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-24 21:45:26 +00:00
Aleksey Kladov
d06904e90c Switch to variant-granularity field type inference 2019-11-25 00:12:36 +03:00
Aleksey Kladov
a0e1dbb450 Implement HasModule for AdtId 2019-11-24 22:48:37 +03:00
Aleksey Kladov
586acef528 Simplify ADT fields 2019-11-24 22:44:24 +03:00
Aleksey Kladov
191b1d238f Remove impl_block module 2019-11-24 21:17:37 +03:00
Aleksey Kladov
d87c16bea6 hir_def is fully doc'ed! 2019-11-24 21:00:50 +03:00
Aleksey Kladov
e48430cbae Simplify 2019-11-24 20:53:42 +03:00
Aleksey Kladov
d157812cd1 Docs 2019-11-24 20:39:48 +03:00
Aleksey Kladov
63e3ea38d3 Don't redo field resolution in the IDE 2019-11-24 20:06:55 +03:00
Frizi
66f04e6be5 Show missing struct fields in the error message 2019-11-24 17:45:30 +01:00
bors[bot]
ac9ba5eb32
Merge #2387
2387: Simplify r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-24 16:06:58 +00:00
Aleksey Kladov
434f108ada Simplify 2019-11-24 19:01:19 +03:00
bors[bot]
b0581c2403
Merge #2381
2381: Add proc-macro crate type handling r=JasperDeSutter a=JasperDeSutter

Resolves the libproc_macro crate in crates that are the proc-macro type.
This doesn't seem the ideal implementation though, since the compiler still requires you to write `extern crate proc_macro;` (even in 2018 edition).

Co-authored-by: JasperDeSutter <jasper.desutter@gmail.com>
2019-11-24 15:59:47 +00:00
JasperDeSutter
6a8b4f873a add proc-macro crate type handling 2019-11-24 16:55:56 +01:00
Aleksey Kladov
f5e0a31eaf Cleanup nameres 2019-11-24 18:05:12 +03:00
Aleksey Kladov
855a629b14 Use Trace in raw_items 2019-11-24 17:49:49 +03:00
Aleksey Kladov
21cfa6d529 Some docs 2019-11-24 17:36:06 +03:00
Aleksey Kladov
99af523b68 Cleanup 2019-11-24 17:36:06 +03:00
Aleksey Kladov
326f066aa2 Reduce visibility 2019-11-24 17:36:06 +03:00
bors[bot]
5cc634fa60
Merge #2383
2383: Add alloc to the crate graph r=matklad a=marcogroppo

`alloc` has been added to the crate graph.

Completions work, but they are available even when the user has **not** declared an `extern crate alloc`. Is this the correct approach?

Fixes #2376.

Co-authored-by: Marco Groppo <marco.groppo@gmail.com>
2019-11-24 13:26:54 +00:00
Aleksey Kladov
4b74fb1d89 Nicer API for attrs 2019-11-24 16:03:02 +03:00
Aleksey Kladov
1956d57ed4 Slightly reduce code duplication 2019-11-24 15:50:45 +03:00
Aleksey Kladov
8e36cb5860 Simplify 2019-11-24 15:28:45 +03:00
Aleksey Kladov
151180057b Simplify 2019-11-24 15:20:59 +03:00
Marco Groppo
e3f8e7d13d Add alloc to the sysroot 2019-11-24 13:19:47 +01:00
Aleksey Kladov
e0b06cb672 Switch to StaticLoc for statics 2019-11-24 15:18:12 +03:00
Aleksey Kladov
9c766db5ff Remove ids module 2019-11-24 14:25:48 +03:00
Aleksey Kladov
53506a7552 Pull macro up 2019-11-24 14:13:51 +03:00
Aleksey Kladov
f11237561c Cleanup imports 2019-11-24 14:02:08 +03:00
Aleksey Kladov
cfffea6dc8 Push poison_macros down 2019-11-24 13:57:45 +03:00
Aleksey Kladov
f0e0a40a61 Reduce visbility 2019-11-24 13:34:27 +03:00
bors[bot]
ea3124c12a
Merge #2378
2378: Fix panic in batch analysis r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-24 09:12:12 +00:00
Aleksey Kladov
730664f646 Fix panic in batch analysis
Closes #2272
2019-11-24 12:06:00 +03:00
bors[bot]
cf47ea2877
Merge #2365
2365: Make expand-macro more flexible r=matklad a=edwin0cheng

Due to lack of implementation or other types of errors, some macros do not expand correctly in the current situation. The PR attempts to make `expand-macro` more flexible in error situations by ignoring internal failed macro expansion.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-24 08:39:29 +00:00
bors[bot]
7b6aa7c34e
Merge #2343
2343: implement assist invert_if r=matklad a=bravomikekilo

fix [issue 2219 invert if condition](https://github.com/rust-analyzer/rust-analyzer/issues/2219)
I put the assist cursor range to `if` of the if expression, because both condition and body will be replaced. Is there any way to replace them without cover the cursor position?
@matklad 

Co-authored-by: bravomikekilo <bmk1221@126.com>
2019-11-24 08:32:07 +00:00
bors[bot]
f2c36e5a6f
Merge #2360
2360: Refactor builtin macro r=matklad a=edwin0cheng

Refactor builtin macro and add some local tests.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-24 08:17:02 +00:00
bravomikekilo
adac4fc2f2 do refact and fix some issue 2019-11-24 13:14:57 +08:00
Edwin Cheng
16854e28ef Use macro for all the things 2019-11-23 22:48:34 +08:00
Aleksey Kladov
ffc2325d19 Move ModuleSource back to hir 2019-11-23 17:12:49 +03:00
Aleksey Kladov
6bdd5fa461 Privatise nameres 2019-11-23 17:12:49 +03:00
Aleksey Kladov
158b1cb524 Rename CrateModuleId 2019-11-23 17:12:49 +03:00
Edwin Cheng
6940ae9eab Rename BuiltinExpander to BuiltinFnLikeExpander 2019-11-23 21:54:39 +08:00