Commit message (Collapse) | Author | Age | Files | Lines | ||
---|---|---|---|---|---|---|
... | ||||||
* | Merge #2479 | bors[bot] | 2019-12-05 | 3 | -5/+9 | |
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]> | |||||
| * | Add expansion infrastructure for derive macros | Florian Diebold | 2019-12-05 | 3 | -5/+9 | |
| | | ||||||
* | | Reduce copy-paste | Aleksey Kladov | 2019-12-05 | 1 | -20/+30 | |
| | | ||||||
* | | Introduce ChildFromSource | Aleksey Kladov | 2019-12-05 | 1 | -101/+40 | |
|/ | ||||||
* | One pub function less is good! | ice1000 | 2019-12-05 | 1 | -5/+4 | |
| | ||||||
* | No block at the moment | ice1000 | 2019-12-04 | 1 | -1/+1 | |
| | ||||||
* | Remove almost unused `ModuleSource::new` | ice1000 | 2019-12-04 | 1 | -1/+1 | |
| | ||||||
* | Confluent `ModuleSource` usage | ice1000 | 2019-12-04 | 1 | -5/+1 | |
| | ||||||
* | Add `ModuleSource::Block` | ice1000 | 2019-12-04 | 5 | -69/+15 | |
| | ||||||
* | Replace `ra_hir_expand::either` with crate | ice1000 | 2019-12-03 | 5 | -12/+17 | |
| | ||||||
* | Add BuiltinShadowMode | Edwin Cheng | 2019-11-30 | 1 | -1/+1 | |
| | ||||||
* | Move source-related traits to a separate module | Aleksey Kladov | 2019-11-28 | 1 | -1/+4 | |
| | ||||||
* | Use InFile for AstId | Aleksey Kladov | 2019-11-28 | 1 | -1/+1 | |
| | ||||||
* | Rename Source -> InFile | Aleksey Kladov | 2019-11-28 | 5 | -67/+67 | |
| | ||||||
* | Use Name::missing consistently | Aleksey Kladov | 2019-11-27 | 1 | -10/+7 | |
| | ||||||
* | Minimize API | Aleksey Kladov | 2019-11-27 | 1 | -8/+1 | |
| | ||||||
* | Reformat | Aleksey Kladov | 2019-11-27 | 1 | -6/+5 | |
| | ||||||
* | Rename module_id -> local_id | Aleksey Kladov | 2019-11-27 | 3 | -16/+16 | |
| | ||||||
* | prune deps | Aleksey Kladov | 2019-11-27 | 1 | -20/+0 | |
| | ||||||
* | Move Ty | Aleksey Kladov | 2019-11-27 | 28 | -12229/+46 | |
| | ||||||
* | Decouple | Aleksey Kladov | 2019-11-27 | 1 | -20/+15 | |
| | ||||||
* | Remove TypableDef | Aleksey Kladov | 2019-11-27 | 4 | -98/+7 | |
| | ||||||
* | Cleanup imports | Aleksey Kladov | 2019-11-27 | 2 | -3/+3 | |
| | ||||||
* | Use Id for variats | Aleksey Kladov | 2019-11-27 | 7 | -52/+60 | |
| | ||||||
* | More decoupling | Aleksey Kladov | 2019-11-27 | 4 | -33/+27 | |
| | ||||||
* | Decouple more | Aleksey Kladov | 2019-11-27 | 5 | -40/+41 | |
| | ||||||
* | Decouple | Aleksey Kladov | 2019-11-27 | 2 | -24/+32 | |
| | ||||||
* | Decouple | Aleksey Kladov | 2019-11-27 | 4 | -49/+61 | |
| | ||||||
* | Cleanup imports | Aleksey Kladov | 2019-11-27 | 5 | -14/+20 | |
| | ||||||
* | Decouple | Aleksey Kladov | 2019-11-27 | 4 | -11/+24 | |
| | ||||||
* | Decouple | Aleksey Kladov | 2019-11-27 | 3 | -19/+29 | |
| | ||||||
* | Crate -> CrateId | Aleksey Kladov | 2019-11-27 | 4 | -35/+37 | |
| | ||||||
* | Cleanup | Aleksey Kladov | 2019-11-26 | 4 | -74/+82 | |
| | ||||||
* | Decouple | Aleksey Kladov | 2019-11-26 | 5 | -45/+42 | |
| | ||||||
* | Merge #2420 | bors[bot] | 2019-11-26 | 3 | -7/+8 | |
|\ | | | | | | | | | | | | | | | 2420: Remove last traces of adt from Ty r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]> | |||||
| * | Remove last traces of adt from Ty | Aleksey Kladov | 2019-11-26 | 3 | -6/+7 | |
| | | ||||||
| * | More precise NameKind::Self | Aleksey Kladov | 2019-11-26 | 1 | -1/+1 | |
| | | ||||||
* | | Merge #2418 | bors[bot] | 2019-11-26 | 1 | -4/+2 | |
|\ \ | |/ |/| | | | | | | | | | | | 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 <[email protected]> | |||||
| * | Hide MacroCallLoc | Edwin Cheng | 2019-11-26 | 1 | -4/+2 | |
| | | ||||||
* | | Remove ns-polymorphic type_for_def | Aleksey Kladov | 2019-11-26 | 8 | -164/+127 | |
| | | ||||||
* | | Cleanup imports | Aleksey Kladov | 2019-11-26 | 2 | -6/+7 | |
| | | ||||||
* | | Reduce visibility | Aleksey Kladov | 2019-11-26 | 2 | -4/+5 | |
| | | ||||||
* | | Use TraitId in TraitRef | Aleksey Kladov | 2019-11-26 | 6 | -68/+68 | |
| | | ||||||
* | | Remove another helper | Aleksey Kladov | 2019-11-26 | 3 | -25/+27 | |
| | | ||||||
* | | Doc | Aleksey Kladov | 2019-11-26 | 1 | -0/+3 | |
| | | ||||||
* | | Remove assoc_type_by_name helper | Aleksey Kladov | 2019-11-26 | 5 | -39/+34 | |
| | | ||||||
* | | Store names in TraitData | Aleksey Kladov | 2019-11-26 | 2 | -8/+5 | |
| | | ||||||
* | | Detangle ty from traits a bit | Aleksey Kladov | 2019-11-26 | 5 | -49/+63 | |
|/ | ||||||
* | Merge #2406 | bors[bot] | 2019-11-26 | 1 | -5/+6 | |
|\ | | | | | | | | | | | | | | | 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 <[email protected]> | |||||
| * | Remove dbg! | Edwin Cheng | 2019-11-26 | 1 | -2/+0 | |
| | |