Commit Graph

5580 Commits

Author SHA1 Message Date
Edwin Cheng
c46768d13d Add basic bultin macro infrastructure 2019-11-11 14:13:31 +08:00
bors[bot]
defc7ad772
Merge #2197
2197: Remove typed macro parsing API r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-09 10:16:48 +00: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
bors[bot]
23939cabcc
Merge #2196
2196: Touch up nameres doc comment r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-08 21:24:02 +00: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
bors[bot]
ee798a02b3
Merge #2194
2194: Update crates r=matklad a=kjeremy

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

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-11-07 18:28:10 +00: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
bors[bot]
2a8d48d8a9
Merge #2193
2193: cargo xtask format with rust 1.39 r=matklad a=kjeremy

Needed to pass tests on latest stable

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-11-07 14:57:30 +00:00
kjeremy
e670a99413 cargo xtask format with 1.39 2019-11-07 09:44:45 -05:00
bors[bot]
14e19c0df1
Merge #2179
2179: Use HirDatabase to compute `is_deprecated` r=matklad a=martskins

This PR fixes #2167 by introducing `attributes_query` and adding `fn attrs(&self, def: crate::AttrDef) -> Option<Arc<[Attr]>>;`  to the `DefDatabase` trait.

I'm a little concerned about the two spots in `attributes_query` where code is repeated, but I couldn't figure out a way to avoid that, so.. I welcome suggestions 😄 



Co-authored-by: Martin Asquino <martin.asquino@gmail.com>
2019-11-06 21:11:42 +00:00
bors[bot]
ef988492ee
Merge #2191
2191: Cleanup complete_postfix r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-06 11:50:34 +00:00
Aleksey Kladov
b5349af05f Cleanup complete_postfix 2019-11-06 14:50:03 +03:00
bors[bot]
d222608a45
Merge #2188
2188: Ignore line-endings when checking generated files for freshness r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-06 09:41:33 +00:00
Aleksey Kladov
5efd99a6e0 Ignore line-endings when checking generated files for freshness
closes #2184
2019-11-06 12:40:28 +03:00
bors[bot]
4fbb36db9b
Merge #2187
2187: Update smallvec to avoid UB and cc while we're at it r=kjeremy a=kjeremy

See: https://github.com/servo/rust-smallvec/releases/tag/v0.6.13

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-11-05 20:05:49 +00:00
kjeremy
8a2f16133f Update smallvec to avoid UB and cc while we're at it 2019-11-05 15:04:00 -05:00
bors[bot]
ac7daf9cb9
Merge #2185
2185: Bump psm, console, indicatif r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-11-05 15:47:50 +00:00
kjeremy
49aea4202b Bump psm, console, indicatif 2019-11-05 10:38:50 -05:00
Edwin Cheng
568f3cff41 Fix formatting 2019-11-05 09:43:59 +08:00
Martin Asquino
cb3767f28a HirDatabase stored attributes 2019-11-04 18:16:35 -03:00
bors[bot]
38f2bd21fb
Merge #2177
2177: Reduce visibility r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-04 20:37:59 +00:00
Aleksey Kladov
93d9e8a06f Reduce visibility 2019-11-04 23:37:35 +03:00
bors[bot]
c08cff4fd6
Merge #2176
2176: Move Namespace enum closer to usage r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-04 20:03:11 +00:00
Aleksey Kladov
739babc391 Move Namespace enum closer to usage 2019-11-04 23:02:35 +03:00
bors[bot]
9c93fbf346
Merge #2175
2175: Appease the linter by dummy doc comments r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-04 19:35:43 +00:00
Aleksey Kladov
50364bd478 Appease the linter by dummy doc comments 2019-11-04 22:33:21 +03:00
Aleksey Kladov
fd7819c3c0 Simplify 2019-11-04 22:29:51 +03:00
Aleksey Kladov
42370610ce Restore assists tests 2019-11-04 22:28:47 +03:00
Aleksey Kladov
74d827bb80 Rename MockDatabase -> TestDB
Actually working rename is sooo useful!
2019-11-04 22:21:15 +03:00
Edwin Cheng
2a76bb5a0b Refactor a bit 2019-11-05 03:20:54 +08:00
Aleksey Kladov
7649a8ebbe remove dead code 2019-11-04 22:19:06 +03:00
Aleksey Kladov
24894aca31 Remove more duplication in test fixtures 2019-11-04 22:12:49 +03:00
Aleksey Kladov
dcdcc9e4c8 Remove some duplicated test functions 2019-11-04 22:04:51 +03:00
bors[bot]
7c0d7d3838
Merge #2174
2174: Reduce visibility r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-11-04 18:42:55 +00:00
Aleksey Kladov
d04ecc8419 Reduce visibility 2019-11-04 21:42:25 +03:00
Edwin Cheng
604bdc6ffe Use macro_rules shift to map text ranges 2019-11-05 02:09:16 +08:00
Edwin Cheng
7e28924012 Use ? and destructing to simplifed long code 2019-11-05 01:38:20 +08:00
Edwin Cheng
e6709f64af Rename and fix typos 2019-11-05 01:38:20 +08:00
Edwin Cheng
d8b7ba201e Add note for recurseive macro generated code 2019-11-05 01:38:20 +08:00
Edwin Cheng
1630a34c3f Add tests 2019-11-05 01:38:20 +08:00
Edwin Cheng
e8741b9d75 Use new expansion feature in goto_definition 2019-11-05 01:38:20 +08:00