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
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
Aleksey Kladov
8e65b77387
Dedupe from_source impls
2019-12-12 15:50:16 +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
Aleksey Kladov
7b0644d81e
Switch to the new location for impls
2019-12-12 14:25:34 +01:00
Aleksey Kladov
d89996fd5b
Build correct SourceAnalyzer for traits
2019-12-10 13:52:04 +01: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
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
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
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
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
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
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
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
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
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
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
7702f690a9
One pub function less is good!
2019-12-05 08:28:31 -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
009437f5d9
Replace ra_hir_expand::either
with crate
2019-12-03 11:07:56 -05:00
Edwin Cheng
bb601e7eaf
Add BuiltinShadowMode
2019-11-30 23:29:21 +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
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
27b362b059
Reformat
2019-11-27 21:44:38 +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
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
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
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]
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
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
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
Aleksey Kladov
d06904e90c
Switch to variant-granularity field type inference
2019-11-25 00:12:36 +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
e48430cbae
Simplify
2019-11-24 20:53:42 +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
Aleksey Kladov
434f108ada
Simplify
2019-11-24 19:01:19 +03:00
Aleksey Kladov
f5e0a31eaf
Cleanup nameres
2019-11-24 18:05:12 +03:00
Aleksey Kladov
99af523b68
Cleanup
2019-11-24 17:36:06 +03:00
Aleksey Kladov
151180057b
Simplify
2019-11-24 15:20:59 +03: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
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
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
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
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
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
78f3b0627c
Move FunctionData to hir_def
2019-11-22 17:18:04 +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]
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
Edwin Cheng
59e7234546
Add to_macro_file_kind
2019-11-22 02:38:14 +08:00
Aleksey Kladov
952405cb41
reformat
2019-11-21 16:31:48 +03:00