Commit Graph

5996 Commits

Author SHA1 Message Date
Aleksey Kladov
ca1af86e7b Use GenericParam in ScopeDef 2019-11-21 14:22:30 +03:00
Aleksey Kladov
1312c57d34 Move ScopeDef 2019-11-21 14:21:26 +03:00
Aleksey Kladov
061e6c77b5 Decouple 2019-11-21 14:13:49 +03:00
Aleksey Kladov
621cf06156 Decouple 2019-11-21 13:48:05 +03:00
Aleksey Kladov
24964ca58e Move expr resolver to resolve 2019-11-21 13:28:04 +03:00
Aleksey Kladov
0102fb4133 Decouple Resolver 2019-11-21 13:25:03 +03:00
bors[bot]
612a72fc4e
Merge #2336
2336: Remove npm.cmd r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-20 20:28:00 +00:00
Aleksey Kladov
ad2b6cad48 Remove npm.cmd
I *think* this is more correct
2019-11-20 23:27:03 +03:00
bors[bot]
a025303ca6
Merge #2334
2334: Add rust-analyzer-expand-macro function for Emacs r=flodiebold a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-11-20 19:45:57 +00:00
Florian Diebold
c079d9b63b Add rust-analyzer-expand-macro function for Emacs 2019-11-20 20:45:25 +01:00
bors[bot]
2cb2fb1a48
Merge #2332
2332: Add HasResolver trait r=matklad a=matklad

bors merge

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-20 19:23:31 +00:00
Aleksey Kladov
63f327be67 Alternative quite tests alias 2019-11-20 22:22:32 +03:00
Aleksey Kladov
1cead41510 Simplify 2019-11-20 22:22:32 +03:00
Aleksey Kladov
6241cf9a59 Add HasResolver trait 2019-11-20 22:22:32 +03:00
bors[bot]
6983afdea9
Merge #2330
2330: Remove hir/adt.rs r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-20 18:38:00 +00:00
Aleksey Kladov
7c275a7ed2 Remove hir/adt.rs 2019-11-20 21:34:12 +03:00
bors[bot]
5aec3e4a7b
Merge #2329
2329: fix 2190; add test for "replace if let with match" r=matklad a=fkohlgrueber

Fixes #2190.

Check that the expression doesn't contain newlines only for "replace if let with match". For "join lines", enclosing blocks for multiline expressions should be removed. 

Co-authored-by: Felix Kohlgrüber <felix.kohlgrueber@gmail.com>
2019-11-20 18:16:35 +00:00
Felix Kohlgrüber
bcb2ea912b fix 2190; add test for "replace if let with match" 2019-11-20 19:01:06 +01:00
Aleksey Kladov
12ec946216 Simplify generic params 2019-11-20 20:50:34 +03:00
bors[bot]
7a5fd1f3f3
Merge #2328
2328: Move generic_params query to HIR r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-20 17:39:00 +00:00
Aleksey Kladov
cb642fc578 Move generic_params query to HIR 2019-11-20 20:38:37 +03:00
bors[bot]
c51dcb1c4b
Merge #2327
2327: Move constants to new ID r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-20 15:45:22 +00:00
Aleksey Kladov
111891dc2d Move constants to new ID
This allows us to get rid of trait item index
2019-11-20 18:41:23 +03:00
Aleksey Kladov
ee95a35664 Don't duplicate ContainerId type 2019-11-20 17:50:02 +03:00
Aleksey Kladov
64c21ed195 Switch type aliases to new sources 2019-11-20 17:43:03 +03:00
bors[bot]
b7a36b5443
Merge #2326
2326: Remove duplicate tests r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-20 13:43:34 +00:00
Aleksey Kladov
3888487ca8 Remove duplicate tests 2019-11-20 16:40:25 +03:00
bors[bot]
4ef9cab41a
Merge #2318
2318: Fix panic when use `Expand Macro` on `assert_eq` r=matklad a=edwin0cheng

The cause of this [bug](https://github.com/rust-analyzer/rust-analyzer/pull/2291#issuecomment-555651542) is, when calling `SourceAnalyzer::expand` when an `ast::MacroCall` which is outside of `SourceAnalyzer::node`. 

Note that if we use a node in `SourceAnalyzer::new` with a `MacroFile` file id, the resolver inside `SourceAnalyzer` still will not work properly. Another PR will need to fix it.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-20 13:36:19 +00:00
Edwin Cheng
0a9c80053f Fix expand macro 2019-11-20 21:33:01 +08:00
bors[bot]
b568bcfe6d
Merge #2325
2325: Next gen IDs for functions r=matklad a=matklad

The current system with AstIds has two primaraly drawbacks:

* It is possible to manufacture IDs out of thin air.
  For example, it's possible to create IDs for items which are not
  considered in CrateDefMap due to cfg. Or it is possible to mixup
  structs and unions, because they share ID space.

* Getting the ID of a parent requires a secondary index.

Instead, the plan is to pursue the more traditional approach, where
each items stores the id of the parent declaration. This makes
`FromSource` more awkward, but also more correct: now, to get from an
AST to HIR, we first do this recursively for the parent item, and the
just search the children of the parent for the matching def

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-20 13:23:38 +00:00
Aleksey Kladov
cebeedc66f Next gen IDs for functions
The current system with AstIds has two primaraly drawbacks:

* It is possible to manufacture IDs out of thin air.
  For example, it's possible to create IDs for items which are not
  considered in CrateDefMap due to cfg. Or it is possible to mixup
  structs and unions, because they share ID space.

* Getting the ID of a parent requires a secondary index.

Instead, the plan is to pursue the more traditional approach, where
each items stores the id of the parent declaration. This makes
`FromSource` more awkward, but also more correct: now, to get from an
AST to HIR, we first do this recursively for the parent item, and the
just search the children of the parent for the matching def
2019-11-20 16:22:58 +03:00
bors[bot]
2d47f380ba
Merge #2324
2324: Move traits to hir_def r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-20 11:27:10 +00:00
Aleksey Kladov
06fa3d8389 Move traits to hir_def 2019-11-20 14:22:38 +03:00
bors[bot]
3d56e3d855
Merge #2323
2323: Rename with_ast -> with_value r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-20 10:10:03 +00:00
Aleksey Kladov
51baaf298d Rename with_ast -> with_value 2019-11-20 13:09:21 +03:00
bors[bot]
fa50b16cb2
Merge #2322
2322: Move Generics to hir_def r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-20 09:35:50 +00:00
Aleksey Kladov
e1a6e38767 Move Generics to hir_def 2019-11-20 12:34:48 +03:00
bors[bot]
d24e8f9ea4
Merge #2321
2321: Allow non-path default type parameters r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-20 08:47:42 +00:00
Aleksey Kladov
0e771915fa Allow non-path default type parameters 2019-11-20 11:46:44 +03:00
bors[bot]
4340d9b0e4
Merge #2320
2320: Cleanup imports r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-20 06:51:40 +00:00
Aleksey Kladov
7020167aa2 Cleanup imports 2019-11-20 09:47:14 +03:00
bors[bot]
4dae39a609
Merge #2319
2319: Rename Source::ast -> Source::value r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-20 06:44:37 +00:00
Aleksey Kladov
36e3fc9d54 Rename Source::ast -> Source::value 2019-11-20 09:42:30 +03:00
Aleksey Kladov
e975f6364c add ws 2019-11-20 09:20:53 +03:00
Aleksey Kladov
eec68e6f45
Merge pull request #2297 from kiljacken/master
Add fancy truncation of type hints.
2019-11-20 08:38:25 +03:00
bors[bot]
0e61ba3750
Merge #2314
2314: ⬆️ rowan r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-19 18:14:00 +00:00
Aleksey Kladov
83a8430e0a ⬆️ rowan 2019-11-19 21:13:36 +03:00
bors[bot]
545c21923e
Merge #2291
2291: Show expanded macro in vscode r=matklad a=edwin0cheng

*Edited*

![new_screen_shot](https://user-images.githubusercontent.com/11014119/69169852-00550c00-0b34-11ea-9c40-8ecebdca0621.gif)



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-19 17:53:27 +00:00
Edwin Cheng
1d56b80250 Minor fix for outpu text formating 2019-11-20 01:22:28 +08:00
Edwin Cheng
e290171397 Add shot doc for expand_macro module 2019-11-20 01:12:56 +08:00