Commit Graph

1239 Commits

Author SHA1 Message Date
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
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
c46768d13d Add basic bultin macro infrastructure 2019-11-11 14:13:31 +08:00
Aleksey Kladov
6294fd5ec9 Unfork struct and union ids 2019-11-09 15:34:00 +03: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
Martin Asquino
cb3767f28a HirDatabase stored attributes 2019-11-04 18:16:35 -03:00
Aleksey Kladov
739babc391 Move Namespace enum closer to usage 2019-11-04 23:02:35 +03: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
74d827bb80 Rename MockDatabase -> TestDB
Actually working rename is sooo useful!
2019-11-04 22:21:15 +03: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
Aleksey Kladov
38b941db13 Cleanup unused marks 2019-11-04 13:29:07 +03:00
Aleksey Kladov
dfdb6321ac Use new text DSL instead of crate_graph! macro 2019-11-04 13:25:42 +03:00
Aleksey Kladov
3603d02134 Reexport relative_path from ra_db 2019-11-04 01:14:17 +03:00
Aleksey Kladov
8922a44395 Add small module-level docs 2019-11-04 00:23:14 +03:00
Aleksey Kladov
f0eb9cc6e6 Remove last traces of nameres from hir 2019-11-03 23:49:44 +03:00
Aleksey Kladov
6fba51c5fc move crate_def_map tests to hir_def 2019-11-03 23:35:48 +03:00
Aleksey Kladov
ba2efca2bb Move CrateDefMap to hir_def 2019-11-03 18:04:06 +03:00
Aleksey Kladov
13735d91a7 Move diagnostics to hir_expand 2019-11-02 23:42:38 +03:00
Aleksey Kladov
b8533413cf Move Source to hir_expand 2019-11-02 23:11:27 +03:00
Florian Diebold
c5e44b2084 Upgrade Chalk 2019-11-02 15:32:08 +01:00
Florian Diebold
8952380884 Change SourceAnalyzer method resoltion API 2019-11-01 20:01:21 +01:00
Florian Diebold
b29092ade3 Various review fixes 2019-11-01 19:57:08 +01:00
Florian Diebold
dc4066ebed Add some doc comments 2019-11-01 19:57:08 +01:00
Florian Diebold
79cb0a0dab Complete trait assoc items 2019-11-01 19:57:08 +01:00
Florian Diebold
b0bf1deb7c Refactor a bit 2019-11-01 19:57:08 +01:00
Florian Diebold
f4181deb0d Don't do autoderef for path resolution 2019-11-01 19:57:08 +01:00
Florian Diebold
1173c3dab5 Refactor to unify with method resolution 2019-11-01 19:57:08 +01:00
Florian Diebold
c7cedea270 Record assoc item resolution 2019-11-01 19:57:08 +01:00
Florian Diebold
7b7133ec58 Insert type vars before doing assoc item resolution 2019-11-01 19:57:08 +01:00
Florian Diebold
44279ef1df Add another unrelated, currently not working test 2019-11-01 19:57:08 +01:00
Florian Diebold
b634ba41e0 Get trait assoc item resolution mostly working 2019-11-01 19:57:08 +01:00
kjeremy
c46be83a34 Fixes #2143 2019-10-31 13:29:56 -04:00
Aleksey Kladov
09f9733ca6 move struct & enum data to hir_def 2019-10-31 16:40:36 +03:00
Aleksey Kladov
1602db7d7d add ModuleDefId to hir_def 2019-10-31 11:23:30 +03:00
Aleksey Kladov
b20d37cb49 move builtin types to hir_def 2019-10-31 10:51:54 +03:00
Aleksey Kladov
6f4d5f7339 move mod_resolution to hir_def 2019-10-31 10:31:29 +03:00
kjeremy
b205a0ced3 source_binder => match_ast! 2019-10-30 16:08:27 -04:00
Aleksey Kladov
ab559f170e move hygiene to hir_expand 2019-10-30 19:10:53 +03:00
Aleksey Kladov
872ac566bf push name down to hir_expand 2019-10-30 18:56:20 +03:00
Aleksey Kladov
b05d6e53fb push either to hir_expand 2019-10-30 18:50:10 +03:00
Aleksey Kladov
0bc7d28518 refactor $crate handling
Introduce proper hygiene module, which should grow quite a bit
eventually.
2019-10-30 18:41:50 +03:00
Aleksey Kladov
e34e71c62d remove forward pointer for attrs 2019-10-30 18:06:08 +03:00
Aleksey Kladov
c1ed9ccc4e fix compilation 2019-10-30 18:04:24 +03:00
Aleksey Kladov
e5300ad3ba remove forward pointer for type_ref 2019-10-30 17:43:14 +03:00
Aleksey Kladov
e564334320 remove forward pointer to Path 2019-10-30 17:43:14 +03:00
Aleksey Kladov
f8ddef875a remove forward pointer for name 2019-10-30 17:43:14 +03:00
Aleksey Kladov
16e620c052 move raw_items to hir_def 2019-10-30 17:43:11 +03:00
Aleksey Kladov
c9cd6aa370 Move ids to hir_def crate 2019-10-30 13:11:38 +03:00
Aleksey Kladov
a136cc0653 introduce ra_hir_def 2019-10-30 12:27:54 +03:00
Aleksey Kladov
56bc874f1d move ty interning to ty 2019-10-30 11:18:38 +03:00
bors[bot]
e38cdf6e56
Merge #2114
2114: Move macro expansion to a separate crate r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-29 13:19:45 +00:00
Aleksey Kladov
bca708ba4c cleanup 2019-10-29 16:19:08 +03:00
Aleksey Kladov
7de6eaa58a remove not that useful indirection 2019-10-29 16:01:14 +03:00
Aleksey Kladov
b8b7969bfb remove empty module 2019-10-29 15:53:25 +03:00
Aleksey Kladov
2a5254c106 reduce visibility 2019-10-29 15:25:46 +03:00
Aleksey Kladov
6bf7faf315 flatten hir_expand 2019-10-29 15:11:42 +03:00
Florian Diebold
632a22ae62 Upgrade Chalk, make use of TypeName::Error variant 2019-10-29 13:01:33 +01:00
Aleksey Kladov
5b803055b7 rename hir_def -> hir_expand 2019-10-29 14:59:55 +03:00
Aleksey Kladov
5413875644 move expansion-related code to a separate crate 2019-10-29 14:55:39 +03:00
Aleksey Kladov
77f90caf2d start ra_hir_def crate 2019-10-29 11:15:51 +03:00
Aleksey Kladov
54d3e47318 weaken requirements of AstDef 2019-10-28 20:29:57 +03:00
Aleksey Kladov
8464c45086 remove relative_path_buf workaround
The upstream problem was fixed with the change to 1.0
2019-10-27 12:36:40 +03:00
Florian Diebold
b342ee5616 Upgrade Chalk (without using its dyn/impl Trait support) 2019-10-26 15:11:39 +02:00
Laurențiu Nicola
27a0cb3025 Specify working chalk revisions in manifest 2019-10-25 13:33:14 +03:00
kjeremy
64c1dd10b8 bump insta 2019-10-24 10:35:22 -04:00
Aleksey Kladov
68ea9bd1bf restore assert 2019-10-23 11:31:16 +03:00
Ekaterina Babshukova
55e1910d00 classify module from declaration 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
835173d065 replace trait by a bunch of functions 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
121aa35f12 return Declaration from classify_name_ref 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
0b5d0a41fd replace a chain of if let by macro 2019-10-22 23:47:31 +03:00
Ekaterina Babshukova
11577288c2 initial classify_name 2019-10-22 23:47:31 +03:00
kjeremy
c3045c68a9 relative-path 1.0 2019-10-17 13:08:33 -04:00
Laurențiu Nicola
a6b980d6d4 Bump deps 2019-10-17 18:08:11 +03:00
Aleksey Kladov
260ae2dbc9 minor cleanup 2019-10-16 13:26:02 +03:00
bors[bot]
8e3864fd58
Merge #2008
2008: Prepare SourceDatabase API for lazy file loading r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-14 13:26:42 +00:00
Aleksey Kladov
abf2179c0b Prepare SourceDatabase API for lazy file loading 2019-10-14 16:23:55 +03:00
bors[bot]
e182825170
Merge #2006
2006: Improvements around `Arc<[T]>` r=matklad a=sinkuu

First commit tries to avoid cloning `Arc<[T]>` to a temporary `Vec` for mutating it, if there are no other strong references. Second commit utilizes [`FromIterator for Arc<[T]>`](https://doc.rust-lang.org/std/sync/struct.Arc.html#impl-FromIterator%3CT%3E) instead of `.collect::<Vec<_>>().into()` to avoid allocation in `From<Vec<T>> for Arc<[T]>`.

Co-authored-by: Shotaro Yamada <sinkuu@sinkuu.xyz>
2019-10-14 13:14:18 +00:00
Aleksey Kladov
1555a1aa0d remove one more dependency on source roots 2019-10-14 15:15:47 +03:00
Shotaro Yamada
3a55b5bf01 make_mut_slice 2019-10-14 19:50:12 +09:00
Shotaro Yamada
b462eb96b8 import make_mut_arc_slice 2019-10-14 17:21:38 +09:00
Shotaro Yamada
965ca0d271 .collect() directly into Arc<[T]> 2019-10-14 14:25:05 +09:00
Shotaro Yamada
f8d4cdc170 Avoid cloning Arc<[T]> into a vec if possible 2019-10-14 14:25:05 +09:00
Florian Diebold
2955fbc7e1 Split up infer.rs further
- coercion logic goes to `coerce.rs`
 - expression inference goes to `expr.rs`
 - pattern inference goes to `pat.rs`
2019-10-12 18:41:11 +02:00
bors[bot]
0896ca04c4
Merge #1989
1989: Chalk update to simplified IR r=flodiebold a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-10-11 11:12:27 +00:00
bors[bot]
f70c54ccfb
Merge #1994
1994: remove last traces of source roots from hir r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-10-11 07:49:39 +00:00
Aleksey Kladov
e44c7ce200 remove last traces of source roots from hir 2019-10-11 10:48:46 +03:00
Shotaro Yamada
0d0a444d43 Remove as_original_file 2019-10-11 06:53:43 +09:00
kjeremy
4ba2c5b2de Chalk update to simplified IR 2019-10-10 14:51:50 -04:00
Aleksey Kladov
29e83988be don't special case macro_use 2019-10-10 17:48:30 +03:00
Aleksey Kladov
89826a50fc don't special case path attr 2019-10-10 17:42:29 +03:00
Aleksey Kladov
b36b8970cc simplify a bit 2019-10-10 17:23:01 +03:00
Aleksey Kladov
5140283277 simplify some tests 2019-10-10 14:51:35 +03:00
Aleksey Kladov
ce0d4a3b1d Refactor and fix some more edge cases around name resolution 2019-10-10 14:46:14 +03:00
Ekaterina Babshukova
aa2f58550a add module methods 2019-10-09 14:59:47 +03:00
Aleksey Kladov
d9f83d9b16 add <> for type aliases as well 2019-10-09 11:53:32 +03:00