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
Aleksey Kladov
dd5c2dc5bf
Move ImportId
2019-11-23 16:49:05 +03:00
Aleksey Kladov
338ff052c2
Simplify HasSource
2019-11-23 16:41:04 +03:00
Aleksey Kladov
e5bcb69e4f
Hide ImportId
2019-11-23 16:39:53 +03:00
Aleksey Kladov
3bdb034906
Remove unneded supertrait
2019-11-23 16:30:14 +03:00
Aleksey Kladov
6ec0b181c0
Cleanup imports
2019-11-23 15:48:45 +03:00
Aleksey Kladov
8efc41e7f2
Cleanup imports
2019-11-23 15:33:21 +03:00
Aleksey Kladov
32658a73b4
Note that debugging infra is broken
2019-11-23 14:49:45 +03:00
Aleksey Kladov
fc1e543f7a
Get rid of DefDatabase2
2019-11-23 14:49:45 +03:00
Aleksey Kladov
958862093e
Move docs to hir_def
2019-11-23 14:43:38 +03:00
Aleksey Kladov
8692977d27
Move lang_items to hir_def
2019-11-23 12:58:01 +03:00
Aleksey Kladov
1a99864963
Use attrs rather than syntax for lang items
2019-11-23 12:01:56 +03:00
Aleksey Kladov
552ba868af
Move attrs query to hir_def
2019-11-23 11:14:40 +03:00
Edwin Cheng
9c521f00ff
Improve fail case in expand_macro
2019-11-23 10:33:14 +08:00
Aleksey Kladov
0f415dd4b3
More principled sources for enums and fields
2019-11-22 23:09:17 +03:00
Aleksey Kladov
d8caf56dfc
Uniformalize naming
2019-11-22 21:52:06 +03:00
Edwin Cheng
720ab0bef8
Refactor builtin macro
2019-11-23 01:47:35 +08:00
Edwin Cheng
f4e78a5f4e
Add TestDB
2019-11-23 01:11:33 +08:00
Jeremy Kolb
1ee5592be2
Expand column!()
2019-11-22 11:34:48 -05:00
bors[bot]
506131e3e0
Merge #2357
...
2357: Expand file! to dummy "" r=edwin0cheng a=kjeremy
See https://github.com/rust-analyzer/rust-analyzer/pull/2355#issuecomment-557541873
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-11-22 16:07:37 +00:00
Aleksey Kladov
7469d2b863
Remove TraitData from API
2019-11-22 18:53:39 +03:00
Aleksey Kladov
fe119fef27
Hide data from public API
2019-11-22 18:51:53 +03:00
Aleksey Kladov
d4f4ae0dd8
Move const&static date to hir_def
2019-11-22 18:46:39 +03:00
kjeremy
786544f022
Expand file! to dummy ""
2019-11-22 10:05:04 -05:00
Aleksey Kladov
64df759418
Make ImplData's fields public
2019-11-22 17:42:56 +03:00
Aleksey Kladov
b315f05cf1
Move data to a single file
2019-11-22 17:32:10 +03:00
Aleksey Kladov
78f3b0627c
Move FunctionData to hir_def
2019-11-22 17:18:04 +03:00
Aleksey Kladov
f4b1fb1554
Reorder
2019-11-22 14:12:45 +03:00
Aleksey Kladov
0861ac061e
Cleanup errors
2019-11-22 14:08:18 +03:00
Aleksey Kladov
2c48fa087b
Add support for environment to CrateGraph
2019-11-22 13:57:25 +03:00
bors[bot]
5be7bd605a
Merge #2348 #2352
...
2348: Add support for stringify! builtin macro r=matklad a=piotr-szpetkowski
Refs #2212
First time ever contributing here, hopefully it's ok.
2352: Move TypeAlias to hir_def r=matklad a=matklad
Co-authored-by: Piotr Szpetkowski <piotr.szpetkowski@pyquest.space>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-22 10:14:41 +00:00
Aleksey Kladov
4fc900deb1
Move TypeAlias to hir_def
2019-11-22 13:13:51 +03:00
bors[bot]
5dd44a0820
Merge #2347
...
2347: More correct expand macro r=matklad a=edwin0cheng
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-22 10:00:44 +00:00
bors[bot]
f24aa7a45a
Merge #2351
...
2351: Rename Atts trait r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-22 09:27:13 +00:00
Aleksey Kladov
a87e9145a6
Rename Atts trait
2019-11-22 11:36:14 +03:00
Aleksey Kladov
e42f962766
Encapsulate Attrs
2019-11-22 11:27:47 +03:00
bors[bot]
d59bf33b9e
Merge #2349
...
2349: Ban println in lsp_server r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-22 07:48:02 +00:00
Aleksey Kladov
6fbad0619b
Ban println in lsp_server
2019-11-22 10:46:56 +03:00
Aleksey Kladov
58413b22d7
Don't continue line comments
2019-11-22 10:38:33 +03:00
Piotr Szpetkowski
8ae5d6faf6
Add support for Stringify builtin macro
2019-11-22 07:56:50 +01:00
Edwin Cheng
a92ad59a02
More correct expand macro
2019-11-22 12:04:20 +08:00
bravomikekilo
1ebfa908d5
fix tidy test
2019-11-22 03:18:22 +08:00
bravomikekilo
8a8be06219
initial invert_if
2019-11-22 02:51:40 +08:00
Edwin Cheng
144dc6652c
Fix insert_whitespaces
2019-11-22 02:38:14 +08:00
Edwin Cheng
67a58e4af1
Add test for match_ast
2019-11-22 02:38:14 +08:00
Edwin Cheng
59e7234546
Add to_macro_file_kind
2019-11-22 02:38:14 +08:00
Edwin Cheng
4ff400833f
Add MacroFileKind::Statements
2019-11-22 02:38:14 +08:00
bors[bot]
3f1a0c3c5f
Merge #2341
...
2341: Fix mbe fail to parse TokenTree with endings whitespace r=matklad a=edwin0cheng
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-21 17:56:12 +00:00
Edwin Cheng
bf537eefb5
Fixed mbe trival subtree
2019-11-22 01:02:07 +08:00
Aleksey Kladov
a1346bba5c
Fix test mark placement
2019-11-21 17:09:38 +03:00
Aleksey Kladov
952405cb41
reformat
2019-11-21 16:31:48 +03:00
Aleksey Kladov
4daf931111
Remove old hir::generics module
2019-11-21 16:23:02 +03:00
Aleksey Kladov
4f8f3393bc
Reduce visibility
2019-11-21 16:00:57 +03:00
Aleksey Kladov
36758f2767
Resimplify
2019-11-21 15:56:27 +03:00
Aleksey Kladov
c37d1c5b38
Restore a mark
2019-11-21 15:49:24 +03:00
Aleksey Kladov
6d64798a23
Move resolver to hir_def
2019-11-21 15:39:09 +03:00
Aleksey Kladov
00684d708b
Decouple
2019-11-21 15:24:51 +03:00
Aleksey Kladov
eb53aa37a3
Split internal and user-visible ScopeDef
2019-11-21 15:13:46 +03:00
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]
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
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
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
Aleksey Kladov
cb642fc578
Move generic_params query to HIR
2019-11-20 20:38:37 +03: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
Edwin Cheng
0a9c80053f
Fix expand macro
2019-11-20 21:33:01 +08: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
Aleksey Kladov
06fa3d8389
Move traits to hir_def
2019-11-20 14:22:38 +03:00
Aleksey Kladov
51baaf298d
Rename with_ast -> with_value
2019-11-20 13:09:21 +03:00
Aleksey Kladov
e1a6e38767
Move Generics to hir_def
2019-11-20 12:34:48 +03:00
Aleksey Kladov
0e771915fa
Allow non-path default type parameters
2019-11-20 11:46:44 +03:00
Aleksey Kladov
36e3fc9d54
Rename Source::ast -> Source::value
2019-11-20 09:42:30 +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
Aleksey Kladov
83a8430e0a
⬆️ rowan
2019-11-19 21:13:36 +03:00
Edwin Cheng
e290171397
Add shot doc for expand_macro module
2019-11-20 01:12:56 +08:00
Emil Lauridsen
bf5ac4fe39
Add test for inlay hint truncation
2019-11-19 17:40:38 +01:00
Emil Lauridsen
dadad36bb9
Move type inlay hint truncation to language server
...
This commit implements a general truncation framework for HirFormatter
that keeps track of how much has been output so far. This information
can then be used to perform truncation inside the language server,
instead of relying on the client.
Initial support is implemented for truncating types hints using the
maxInlayHintLength server config option. The existing solution in the
VSCode extension has been removed in favor of letting the server
truncate type hints.
2019-11-19 17:23:50 +01:00
Edwin Cheng
80fe467ce8
Improve insert_whitespaces
2019-11-20 00:12:48 +08:00
Edwin Cheng
4012da07fd
Change return type of expand_macro
2019-11-19 22:56:48 +08:00
Edwin Cheng
94c63d2802
Change to use Expansion::file_id and reordering
2019-11-19 22:56:28 +08:00
Edwin Cheng
ae49a22b5c
Rebase
2019-11-19 21:49:06 +08:00
Edwin Cheng
3ccd05fedc
Add recursive expand in vscode
2019-11-19 21:49:06 +08:00
Edwin Cheng
f24bba74d0
Fixed a bug for string lit in quote
2019-11-19 12:15:20 +08:00
bors[bot]
c24ee09904
Merge #2309
...
2309: Goto type def through macros r=matklad a=kjeremy
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-11-18 20:04:36 +00:00
kjeremy
e939f740b3
Goto type def through macros
2019-11-18 14:57:42 -05:00
bors[bot]
c8fb5b491a
Merge #2307
...
2307: Support hover through macro r=matklad a=kjeremy
Allows hover to work through macros like `match_ast!`.
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-11-18 19:57:06 +00:00
kjeremy
90f6f6080e
Fix test
2019-11-18 14:20:14 -05:00
DJMcNab
27ce1e822b
Remove the custom impl of AttrsOwner for ImplItem
...
The default impl should have the same behaviour, and it can be generated
by codegen.
See also `ModuleItem` and `NominalDef`
2019-11-18 18:13:56 +00:00
kjeremy
b2cc593381
Support hover through macro
2019-11-18 11:58:42 -05:00
kjeremy
a22cb1daa7
Use Source<&ast::Name> in classify_name
2019-11-18 10:47:19 -05:00
Aleksey Kladov
2b6f1ab0e2
Collapse TokenMap and RevTokenMap
2019-11-18 16:08:41 +03:00
Aleksey Kladov
b79d678923
Token-based reverse-mapping
2019-11-18 15:08:39 +03:00
Aleksey Kladov
5e8c22dbf3
More sources
2019-11-18 14:36:11 +03:00
Aleksey Kladov
9fcd98e956
Add ra_ide_api::expand
...
This module should handle all tricky bits with mapping macro-expanded
HirFileId to original files the user actually can see in the editor
2019-11-18 14:23:24 +03:00
Aleksey Kladov
6d8ca870b3
More Source
2019-11-18 14:07:13 +03:00
Aleksey Kladov
9df3d2e775
Publicise GenericParams
...
See https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Exposing.20GenericParam.2Ename
2019-11-18 10:35:33 +03:00
Aleksey Kladov
fd52d721e1
More correct expansion mapping
...
We can't really map arbitrary ranges, we only can map tokens
2019-11-17 20:15:55 +03:00
Aleksey Kladov
c8f858d043
Make shift an implementation detail of mbe
2019-11-17 19:11:43 +03:00
bors[bot]
64dac40a86
Merge #2287
...
2287: Disable doctests r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-17 15:45:30 +00:00
Aleksey Kladov
7e2f4b30db
Disable doctests
2019-11-17 18:35:05 +03:00
Aleksey Kladov
6a70bff451
Don't store shift redundantly
2019-11-17 18:22:34 +03:00
Edwin Cheng
977cf381ce
Add bound check
2019-11-17 13:18:42 +08:00
Aleksey Kladov
5b54a93fe7
Add ast for plain and raw string literals
2019-11-16 22:50:41 +03:00
Aleksey Kladov
42604c673d
Better factoring of macro expansion machinery in goto def
2019-11-16 22:18:07 +03:00
Aleksey Kladov
2eaa8c94a8
Goto definition works inside macros
2019-11-16 17:00:54 +03:00
bors[bot]
786cae520a
Merge #2276
...
2276: Source-ify name_definition r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-16 13:50:34 +00:00
Florian Diebold
ee190388ab
Upgrade Chalk again
2019-11-16 13:25:54 +01:00
Florian Diebold
351c29d859
Fix handling of the binders in dyn/impl Trait
...
We need to be more careful now when substituting bound variables (previously, we
didn't have anything that used bound variables except Chalk, so it was not a
problem).
This is obviously quite ad-hoc; Chalk has more infrastructure for handling this
in a principled way, which we maybe should adopt.
2019-11-16 13:25:54 +01:00
Florian Diebold
9c2a9a9a06
Use Chalk's dyn/impl trait support
2019-11-16 13:11:29 +01:00
Florian Diebold
e21b82e035
Upgrade Chalk
...
Associated type values (in impls) are now a separate entity in Chalk, so we have
to intern separate IDs for them.
2019-11-16 13:11:29 +01:00
Aleksey Kladov
3b7cf9226d
Source-ify name_definition
2019-11-16 13:50:04 +03:00
Aleksey Kladov
272af56a5c
Sourcify classify_name_ref
2019-11-16 13:33:25 +03:00
bors[bot]
d9d99369b2
Merge #2271
...
2271: Force passing Source when creating a SourceAnalyzer r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-15 23:12:59 +00:00
Aleksey Kladov
d898ecb8f2
Force passing Source when creating a SourceAnalyzer
2019-11-16 02:12:35 +03:00
bors[bot]
69f3b01dc5
Merge #2268
...
2268: Handle ast::MacroCall in classify_name and impl FromSource for MacroDef r=matklad a=kjeremy
Fixes #2260
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-11-15 22:36:10 +00:00
Aleksey Kladov
1c819fc8f6
Prepare SourceAnalyzer for macros
2019-11-16 01:31:40 +03:00
Aleksey Kladov
f36ac059f3
Reduce some duplication
2019-11-16 01:14:56 +03:00
kjeremy
06984ed116
Add a test that uses classify_name
2019-11-15 17:13:52 -05:00
Aleksey Kladov
892671926b
Remove wrong clone
2019-11-16 01:00:00 +03:00
kjeremy
60fd260e7f
Handle ast::MacroCall in classify_name and impl FromSource for MacroDef
...
Fixes #2260
2019-11-15 16:47:58 -05:00
Aleksey Kladov
0404e647e6
Prepare SourceAnalyzer for macros
2019-11-16 00:40:54 +03:00
Aleksey Kladov
bd8af6a413
Sourcify some more
2019-11-16 00:05:10 +03:00
bors[bot]
920848940a
Merge #2266
...
2266: Sourcify some things r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-15 20:25:53 +00:00
Aleksey Kladov
4c90b7e2ec
Sourcify some things
...
If we want to support macros properly, we need to get rid of those
FileIds everywhere...
2019-11-15 23:24:56 +03:00
bors[bot]
86469d4195
Merge #2252
...
2252: Fix parsing of "postfix" range expressions. r=matklad a=goffrie
Right now they are handled in `postfix_dot_expr`, but that doesn't allow it to
correctly handle precedence. Integrate it more tightly with the Pratt parser
instead.
Also includes a drive-by fix for parsing `match .. {}`.
Fixes #2242 .
Co-authored-by: Geoffry Song <goffrie@gmail.com>
2019-11-15 20:15:29 +00:00
Geoffry Song
5645c153e0
Attempt to implement typed accessors
2019-11-15 12:05:29 -08:00
Aleksey Kladov
20186cdf89
Fix add-new assist
2019-11-15 22:57:19 +03:00
Aleksey Kladov
b21829f7ed
Remove old impls infrastructure
2019-11-15 21:35:03 +03:00
Aleksey Kladov
ea3540c1a8
Store impls in CrateDefMap
2019-11-15 21:19:32 +03:00
Aleksey Kladov
080dd31f84
Add ImplId
2019-11-15 21:19:32 +03:00
Aleksey Kladov
aeb5e061a8
Reduce visibility
2019-11-15 21:19:32 +03:00
memoryruins
a5f57f98ca
Heed the advice of rustc's into_iter() warning
2019-11-15 07:18:10 -05:00
memoryruins
5476c4faa3
Update smallvec dep to 1.0
2019-11-15 07:18:10 -05:00
Aleksey Kladov
c3f84960aa
Flatten expr module
2019-11-15 14:53:09 +03:00
Aleksey Kladov
2f6c0c314b
Move scope tests to hir_def
2019-11-15 14:47:26 +03:00
Aleksey Kladov
9167da66ac
Reduce visibility
2019-11-15 14:15:04 +03:00
Aleksey Kladov
5766ceab06
Add convenience method for testing
2019-11-15 13:16:30 +03:00
Aleksey Kladov
3564fbb7f5
Auto-upgrade some insta snapshots
2019-11-15 12:56:24 +03:00
Aleksey Kladov
487fc448c3
Reduce visibility
2019-11-15 12:24:30 +03:00
Geoffry Song
a68aefdc46
Move inclusive range check to validation
2019-11-15 01:04:45 -08:00
Aleksey Kladov
b80fa14a85
Use Local more
2019-11-15 12:00:36 +03:00
Geoffry Song
989cebc99c
Fix parsing of "postfix" range expressions.
...
Right now they are handled in `postfix_dot_expr`, but that doesn't allow it to
correctly handle precedence. Integrate it more tightly with the Pratt parser
instead.
Also includes a drive-by fix for parsing `match .. {}`.
Fixes #2242 .
2019-11-15 00:18:28 -08:00
bors[bot]
31d01efb06
Merge #2251
...
2251: Privatize modules r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-15 07:45:57 +00:00
Aleksey Kladov
a28907af8c
Privatize modules
2019-11-15 10:42:54 +03:00
Aleksey Kladov
9c7a2aef30
Refactor Module::from_source to properly descend from root file
2019-11-15 10:26:31 +03:00
bors[bot]
3ad11973ac
Merge #2165
...
2165: ra_assists: Add add_new assist r=matklad a=rep-nop
Adds a new assist to autogenerate a new fn based on the selected struct, excluding tuple structs and unions. The fn will inherit the same visibility as the struct and the assist will attempt to reuse any existing impl blocks that exist at the same level of struct.
Not marking this as closing #1644 since there's a part 2 of adding autocompletion for when someone starts typing `[pub ]fn new(...`
Co-authored-by: Wesley Norris <repnop@outlook.com>
2019-11-15 07:01:19 +00:00
bors[bot]
a6d080608d
Merge #2249
...
2249: Cleanup hover r=matklad a=kjeremy
Take advantage of classify_name to consolidate multiple hover paths. This isn't quite as clean as I want it to be (`no_fallback` bool is wonky). There's a relationship between `HoverResult` being empty and the range that is a little warty.
Also I noticed that HoverResults are always marked as exact and have been for quite a while... maybe that should be removed in another PR.
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-11-15 06:27:59 +00:00
Jeremy Kolb
89647f93c4
Cleanup hover
...
Take advantage of classify_name
2019-11-14 22:53:42 -05:00
kjeremy
50825a41d8
Renormalize line endings
2019-11-14 19:44:37 -05:00
kjeremy
fc9c2915c7
Even if jemalloc feature is used do not use it on msvc
...
Fixes #2233
2019-11-14 11:47:18 -05:00
Aleksey Kladov
1583ab1558
Move body queries to hir_def
2019-11-14 17:37:22 +03:00
Aleksey Kladov
ef02296b9f
Simplify parsing
2019-11-14 17:36:27 +03:00
Aleksey Kladov
f924ae3b86
Move scopes to hir_def
2019-11-14 11:56:13 +03:00
Aleksey Kladov
4efd345b09
Slightly better naming
2019-11-14 11:33:48 +03:00
Aleksey Kladov
da2ca01eba
Handle macro-generated expressions slightly less wrong
2019-11-14 10:30:30 +03:00
Aleksey Kladov
a73b7bb3f6
Move expansion to Expander
2019-11-14 10:04:39 +03:00
Aleksey Kladov
5c720b256f
Move parse_path to Expander
2019-11-14 09:58:39 +03:00
Aleksey Kladov
e7880db1d0
Expansion stack scaffold
2019-11-14 09:57:57 +03:00
Aleksey Kladov
c89010df2d
Add Expader::to_source
2019-11-14 09:57:57 +03:00
Aleksey Kladov
e7e85c60d2
Move original_file to Expander
2019-11-14 09:55:24 +03:00
Aleksey Kladov
8c8ef1432e
Rename MacroResolver -> Expander
2019-11-14 09:38:25 +03:00
Aleksey Kladov
b3175b7077
Move current file to MacroResolver
2019-11-14 09:37:33 +03:00
Aleksey Kladov
debf95eb1b
Reduce visibility
2019-11-14 09:24:39 +03:00
Aleksey Kladov
b8f62095d6
Normalize data
...
No need to store derivable info
2019-11-14 09:09:42 +03:00
Aleksey Kladov
4cea6bb6f1
Make make:: builders slightly more convenient
2019-11-13 11:59:18 +03:00
Aleksey Kladov
e177c65e36
Use strongly-typed ast building for early-return assist
2019-11-13 11:54:21 +03:00
Aleksey Kladov
2a69d584d6
Add a bit of types
2019-11-13 10:54:50 +03:00
Aleksey Kladov
018255efe3
Minor cleanup
2019-11-13 10:32:53 +03:00
Aleksey Kladov
70dd70b1fc
Reduce duplication between uncertain floats & ints
2019-11-13 09:56:33 +03:00
bors[bot]
3322d65add
Merge #2223
...
2223: Move expression lowering to hir_def r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-12 15:53:55 +00:00
Aleksey Kladov
fe5e74e083
Add helpful pointer to module docs
2019-11-12 18:53:26 +03:00
Aleksey Kladov
1c0a3a1a30
Drop obsolete comment
2019-11-12 18:51:37 +03:00
Aleksey Kladov
1a90ad5802
Move expression lowering to hir_def
2019-11-12 18:46:57 +03:00
bors[bot]
2549be750e
Merge #2217
...
2217: Implement FromStr for enum Edition r=matklad a=clemarescx
Just did this as I came across the comment in the code asking for implementing `std::str::FromStr` for `input::Edition`.
Not sure what was meant by "proper error handling" though, `panic!` with a descriptive message might not be it 😅
Co-authored-by: Metabaron <metabaron@tuta.io>
2019-11-12 15:30:36 +00:00
Aleksey Kladov
fe00db72b9
Remove owner from Body
2019-11-12 16:46:27 +03:00
Aleksey Kladov
30bf7e43db
Disallow regressing crate docs
2019-11-12 15:41:02 +03:00
Aleksey Kladov
d09e5a3d9e
Move definition of exprs to hir_def
2019-11-12 15:09:25 +03:00
Metabaron
dae087656a
Fix unused import
2019-11-12 12:01:13 +01:00
Metabaron
53b9c1c8d8
return Error instead of panicking in from_cargo_metadata
2019-11-12 12:01:13 +01:00
Metabaron
b69738590c
Implement FromStr for enum Edition
2019-11-12 12:01:13 +01:00
Aleksey Kladov
f5e1b0f97c
Minor refactoring
2019-11-12 12:07:47 +03:00
Aleksey Kladov
fc055281a5
Minor cleanup
2019-11-12 11:49:16 +03:00
Greg
088e5e1721
fix typo
2019-11-11 22:56:39 -05:00
Greg
eb72156094
Implement postfix completions feature flag
2019-11-11 22:55:10 -05:00
Aleksey Kladov
c5a18c44e5
Introduce hir::GenericParam
...
Unlike existing hir::GenericParams, this is a global ID.
2019-11-11 17:36:27 +03:00
Aleksey Kladov
ff609cc497
Don't reexport generics from HIR
2019-11-11 17:22:06 +03:00
bors[bot]
a599147b42
Merge #2200
...
2200: Add variables to HIR r=matklad a=matklad
Introduce a `hir::Variable`, which should cover locals, parameters and `self`. Unlike `PatId`, variable knows it's owner so it is self-contained, and should be more convenient to use from `ra_ide_api`.
The goal here is to hide more details about `Body` from hir, which should make it easier to move `Body` into `hir_def`. I don't think that `ra_ide_api` intrracts with bodies directly at the moment anyway, but the glue layer is based basically on `ast::BindPat`, which seems pretty brittle.
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-11 11:48:02 +00:00
Aleksey Kladov
8b7f853cc1
Add hir::Local
2019-11-11 14:42:08 +03:00
bors[bot]
ef2a9aedb6
Merge #2205
...
2205: Implement bulitin line! macro r=matklad a=edwin0cheng
This PR implements bulitin macro `line!` and add basic infra-structure for other bulitin macros:
1. Extend `MacroDefId` to support builtin macros
2. Add a `quote!` macro for simple quasi quoting.
Note that for support others builtin macros, eager macro expansion have to be supported first, this PR not try to handle it. :)
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-11 10:53:24 +00:00
Edwin Cheng
4f7df2aac1
Add MacroDefKind
2019-11-11 18:48:16 +08:00
Aleksey Kladov
ef70925f5f
Refactor highlighting to use classify_name
2019-11-11 12:52:14 +03:00
Aleksey Kladov
4deba88c33
Introduce ToNav trait
2019-11-11 12:19:57 +03:00
Aleksey Kladov
5bb92c2d1a
impl fmt::Display for BuiltinType
2019-11-11 11:59:19 +03:00
bors[bot]
113d7e44b7
Merge #2203
...
2203: Hover for builtins r=matklad a=kjeremy
Fixes #2192
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-11-11 08:41:54 +00:00
Aleksey Kladov
1860f9ab43
Forbid visibility qualifiers in traits
2019-11-11 11:26:57 +03:00
Aleksey Kladov
ee876e7881
Make primitive tys public
2019-11-11 09:20:18 +03:00
Edwin Cheng
c4aa8b63bc
Add line macro and tests
2019-11-11 14:15:09 +08:00
Edwin Cheng
1637a8a590
Add quote macro
2019-11-11 14:14:39 +08:00
Edwin Cheng
c46768d13d
Add basic bultin macro infrastructure
2019-11-11 14:13:31 +08:00
Matthias Einwag
d634364462
Overwrite the prelude with one defined in a later dependency
...
This removes the special casing for the "core" prelude.
Whenever a later dependency also exports a prelude, it will replace
the formerly imported prelude. The utilized prelude then depends
purely on import order.
2019-11-10 13:15:47 -08:00
Jeremy Kolb
3188c1451a
Hover for builtins
2019-11-10 13:59:39 -05:00
Matthias Einwag
8baa05666c
Add tests for resolving types in core and std preludes
2019-11-09 17:38:08 -08:00
Matthias Einwag
799903ba16
Resolve core types
...
This adds support for completion and goto definition of
types defined within the "core" crate. The core crate is
added as a dependency to each crate in the project.
The core crate exported it's own prelude. This caused
now all crates to inherit the core crates prelude instead
of the std crates. In order to avoid the problem the
prelude resolution has been changed to overwrite
an already resolved prelude if this was set to a crate
named core - in order to pick a better prelude like std.
Fixes #2199
2019-11-09 15:22:19 -08:00
Wesley Norris
cbc6f94573
Add add_new assist
...
Adds a new assist to autogenerate a new fn based on the selected struct,
excluding tuple structs and unions. The fn will inherit the same
visibility as the struct and the assist will attempt to reuse any
existing impl blocks that exist at the same level of struct.
2019-11-09 10:56:36 -05:00
Aleksey Kladov
6294fd5ec9
Unfork struct and union ids
2019-11-09 15:34:00 +03:00
Aleksey Kladov
70f2a21b55
Remove typed macro parsing API
...
We do type-erasure on every path anyway, so it doesn't make much sense
to duplicate this function for every type
2019-11-09 13:14:10 +03:00
Aleksey Kladov
f6c40c09e0
Minor cleanup
2019-11-09 12:49:35 +03:00
bors[bot]
561bb979ce
Merge #2169
...
2169: MBE: Mapping spans for goto definition r=matklad a=edwin0cheng
Currently, go to definition gives the wrong span in MBE. This PR implement a mapping mechanism to fix it and it could be used for future MBE hygiene implementation.
The basic idea of the mapping is:
1. When expanding the macro, generated 2 `TokenMap` which maps the macro args and macro defs between tokens and input text-ranges.
2. Before converting generated `TokenTree` to `SyntaxNode`, generated a `ExpandedRangeMap` which is a mapping between token and output text-ranges.
3. Using these 3 mappings to construct an `ExpansionInfo` which can map between input text ranges and output text ranges.
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-11-09 09:13:14 +00:00
Edwin Cheng
0a5ec69404
Remove map_ranges in RevTokenMap
2019-11-09 12:00:46 +08:00
Aleksey Kladov
c626a677e8
Touch up nameres doc comment
2019-11-09 00:23:19 +03:00
Aleksey Kladov
657340e078
Reduce visibility
2019-11-09 00:23:11 +03:00
Aleksey Kladov
53945841be
Extract path resolution submodule
2019-11-09 00:17:17 +03:00
Aleksey Kladov
785887b382
Simplify
...
There's only one call-site for the function, so it seems fine to
inline
2019-11-08 23:53:39 +03:00
Aleksey Kladov
dc5e5f610c
Reduce visibility
2019-11-08 23:47:52 +03:00
Edwin Cheng
d01e0abdb5
Refactor and simpfily
2019-11-09 04:26:28 +08:00
Edwin Cheng
62ed93db13
Refactor and add more comments
2019-11-08 10:19:41 +08:00
kjeremy
91b154fa05
Update crates
...
Removes nodrop and extra arrayvec
We have an extra crossbeam-queue and crossbeam-utils left but those should
drop once rayon accepts https://github.com/rayon-rs/rayon/pull/704
2019-11-07 13:05:12 -05:00