aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_expand/src
Commit message (Collapse)AuthorAgeFilesLines
* Merge #9007bors[bot]2021-05-261-1/+1
|\ | | | | | | | | | | | | | | 9007: Internal: `clippy::redundant_clone` fixes r=lnicola a=lnicola bors r+ Co-authored-by: Laurențiu Nicola <[email protected]>
| * clippy::redundant_clone fixesLaurențiu Nicola2021-05-261-1/+1
| |
* | internal: move diagnostics to hirAleksey Kladov2021-05-253-115/+4
|/ | | | | | | | | | | | | | | | | | | | | | | The idea here is to eventually get rid of `dyn Diagnostic` and `DiagnosticSink` infrastructure altogether, and just have a `enum hir::Diagnostic` instead. The problem with `dyn Diagnostic` is that it is defined in the lowest level of the stack (hir_expand), but is used by the highest level (ide). As a first step, we free hir_expand and hir_def from `dyn Diagnostic` and kick the can up to `hir_ty`, as an intermediate state. The plan is then to move DiagnosticSink similarly to the hir crate, and, as final third step, remove its usage from the ide. One currently unsolved problem is testing. You can notice that the test which checks precise diagnostic ranges, unresolved_import_in_use_tree, was moved to the ide layer. Logically, only IDE should have the infra to render a specific range. At the same time, the range is determined with the data produced in hir_def and hir crates, so this layering is rather unfortunate. Working on hir_def shouldn't require compiling `ide` for testing.
* Merge #8977bors[bot]2021-05-243-4/+4
|\ | | | | | | | | | | | | | | 8977: internal: minor `TokenMap` cleanups r=jonas-schievink a=jonas-schievink bors r+ Co-authored-by: Jonas Schievink <[email protected]>
| * Make `TokenTextRange` privateJonas Schievink2021-05-243-4/+4
| |
* | internal: rename hypothetical -> speculativeAleksey Kladov2021-05-241-7/+7
|/ | | | | Lets steal this good naming from Roslyn before I forget about it yet again.
* Add even more docsAleksey Kladov2021-05-221-1/+1
|
* 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
|