aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_expand
Commit message (Collapse)AuthorAgeFilesLines
* Support `#[register_attr]` and `#[register_tool]`Jonas Schievink2021-05-201-0/+2
|
* Track in-scope derive helpers during nameresJonas Schievink2021-05-191-1/+1
|
* Clarify field nameJonas Schievink2021-05-194-6/+6
|
* Simplify eager macro representationJonas Schievink2021-05-197-264/+156
|
* Implement `concat_idents`Edwin Cheng2021-05-132-0/+36
|
* Remove delimiters from proc macro inputJonas Schievink2021-05-122-1/+14
|
* Revert "Strip delimiter from fn-like proc macro input"Jonas Schievink2021-05-112-33/+2
| | | | This reverts commit bda68e23328ca62a71da348a13c4d13cc8f991f3.
* Strip delimiter from fn-like proc macro inputJonas Schievink2021-05-112-2/+33
|
* Rewrite `#[derive]` removal to be based on ASTJonas Schievink2021-05-104-107/+112
|
* Move `AttrId` back into `hir_def`Jonas Schievink2021-05-102-6/+3
|
* Merge #8776bors[bot]2021-05-094-63/+84
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 8776: fix: fix unnecessary recomputations due to macros r=jonas-schievink a=jonas-schievink This computes a macro's fragment kind eagerly (when the calling file is still available in parsed form) and stores it in the `MacroCallLoc`. This means that during expansion we no longer have to reparse the file containing the macro call, avoiding the unnecessary salsa dependencies (https://github.com/rust-analyzer/rust-analyzer/pull/8746#issuecomment-834776349). Marking as draft until I manage to find a test for this problem, since for some reason `typing_inside_a_function_should_not_invalidate_expansions` does not catch this (which might indicate that I misunderstand the problem). I've manually confirmed that this fixes the issue described in https://github.com/rust-analyzer/rust-analyzer/pull/8746#issuecomment-834776349: ``` 7ms - parse_query @ FileId(179) 12ms - SourceBinder::to_module_def 12ms - crate_def_map:wait 5ms - item_tree_query (1 calls) 7ms - ??? ``` Co-authored-by: Jonas Schievink <[email protected]>
| * Precompute macro fragment kindJonas Schievink2021-05-094-63/+84
| |
* | Escape characters in builtin macros correctlyEdwin Cheng2021-05-092-4/+4
|/
* Merge #8280bors[bot]2021-05-061-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | 8280: Borrow text of immutable syntax node r=iDawer a=iDawer In https://github.com/rust-analyzer/rowan/pull/101 `rowan::SyntaxNode::green` returns `Cow<'_, GreenNodeData>`. It returns borrow of green node of immutable syntax tree node. Using this we can return borrowed text from `ast::Name::text`. ~~However now it allocates in case of mutable syntax trees.~~ (see next comment) The idea comes from https://github.com/rust-analyzer/rowan/pull/100#issuecomment-809330325 Co-authored-by: Dawer <[email protected]>
| * Fix buildDawer2021-05-061-1/+1
| |
* | Don't store call-site text offsets in hygiene infoJonas Schievink2021-05-061-22/+35
|/
* Document expansion queriesAleksey Kladov2021-05-041-0/+21
|
* simplify macro expansion codeAleksey Kladov2021-05-041-27/+17
| | | | | Using `Option` arguments such that you always pass `None` or `Some` at the call site is a code smell.
* make illegal states unrepresentableAleksey Kladov2021-05-043-49/+48
| | | | only declarative macros have def-site token map
* CleanupsAleksey Kladov2021-05-041-139/+134
|
* Merge #8727bors[bot]2021-05-041-11/+11
|\ | | | | | | | | | | | | | | | | 8727: minor: use standard import style r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * minor: use standard import styleAleksey Kladov2021-05-041-11/+11
| |
* | Merge #8726bors[bot]2021-05-041-3/+3
|\| | | | | | | | | | | | | | | | | 8726: internal: reduce visibility r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * internal: reduce visibilityAleksey Kladov2021-05-041-3/+3
| |
* | minor: unconfuse myself about macro def vs macro rulesAleksey Kladov2021-05-041-0/+5
|/
* Merge #8586bors[bot]2021-04-191-9/+9
|\ | | | | | | | | | | | | | | 8586: Replace SyntaxRewriter usage with ted in eager::eager_macro_recur r=Veykril a=Veykril Co-authored-by: Lukas Wirth <[email protected]>
| * Remove SyntaxRewriter usage in eager::eager_macro_recurLukas Wirth2021-04-191-9/+9
| |
* | Merge #8462bors[bot]2021-04-192-0/+2
|\ \ | |/ |/| | | | | | | | | | | 8462: Expand macros at type position r=jonas-schievink a=cynecx Co-authored-by: cynecx <[email protected]>
| * hir_ty: Expand macros at type positioncynecx2021-04-172-0/+2
| |
* | Expand `global_asm!` to nothingJonas Schievink2021-04-182-0/+11
|/
* Support macros in pattern positionJonas Schievink2021-04-111-0/+1
|
* Revert "Rewrite `#[derive]` removal to be based on AST"Jonas Schievink2021-04-104-92/+105
| | | | This reverts commit 7e78aebc8fbbb4043d62949681e4d700f1a2ec46.
* Revert "Use `pub(crate)`"Jonas Schievink2021-04-101-5/+1
| | | | This reverts commit c51213c2e7de21b7e68e6773ca3be0cdfc7c18af.
* Revert "Use `name![derive]`"Jonas Schievink2021-04-101-6/+2
| | | | This reverts commit d6187de4cd34a1288c7820c5477b81b1e9b692a9.
* Use `name![derive]`Jonas Schievink2021-04-091-2/+6
|
* Use `pub(crate)`Jonas Schievink2021-04-091-1/+5
|
* Rewrite `#[derive]` removal to be based on ASTJonas Schievink2021-04-094-105/+92
|
* Store `#[derive]` attribute ID along macro invocJonas Schievink2021-04-092-3/+7
|
* Add `AttrId` to track attribute sourcesJonas Schievink2021-04-091-0/+3
|
* Use named fields in `MacroCallKind`Jonas Schievink2021-04-084-16/+18
|
* Update `OUT_DIR` diagnostic to match settingJonas Schievink2021-04-071-1/+1
|
* Make `ast_to_token_tree` infallibleJonas Schievink2021-04-043-13/+7
| | | | It could never return `None`, so reflect that in the return type
* Implement edition-dependent builtin `panic!` macroJonas Schievink2021-04-033-2/+26
|
* internal: document semantics for missing namesAleksey Kladov2021-03-311-0/+9
|
* Basic Support Macro 2.0Edwin Cheng2021-03-273-23/+41
|
* Merge #8201bors[bot]2021-03-271-17/+42
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 8201: Fix recursive macro statements expansion r=edwin0cheng a=edwin0cheng This PR attempts to properly handle macro statement expansion by implementing the following: 1. Merge macro expanded statements to parent scope statements. 2. Add a new hir `Expr::MacroStmts` for handle tail expression infer. PS : The scope of macro expanded statements are so strange that it took more time than I thought to understand and implement it :( Fixes #8171 Co-authored-by: Edwin Cheng <[email protected]>
| * Fix recursive macro statement expansionEdwin Cheng2021-03-251-17/+42
| |
* | syntax: return owned string instead of leaking stringcynecx2021-03-261-2/+2
|/
* Merge #8134bors[bot]2021-03-213-26/+76
|\ | | | | | | | | | | | | | | 8134: Correct the paths of submodules from the include! macro r=edwin0cheng a=sticnarf This PR should fix #7846. It mostly follows the instructions from @edwin0cheng in that issue. Co-authored-by: Yilin Chen <[email protected]>
| * use the included file as the source of expanded include macroYilin Chen2021-03-213-26/+76
| | | | | | | | Signed-off-by: Yilin Chen <[email protected]>