aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_expand
Commit message (Collapse)AuthorAgeFilesLines
...
* | Upgrade rowanAleksey Kladov2021-03-161-1/+4
| | | | | | | | Notably, new rowan comes with support for mutable syntax trees.
* | Fix macro expansion for statements w/o semicolonEdwin Cheng2021-03-161-1/+2
|/
* 7709: Updated the implementation.Chetan Khilosiya2021-03-151-0/+2
| | | | | The get function from impl method is updated. and now same method used to get len and is_empty function.
* some clippy::performance fixesMatthias Krüger2021-03-151-1/+1
| | | | | | | use vec![] instead of Vec::new() + push() avoid redundant clones use chars instead of &str for single char patterns in ends_with() and starts_with() allocate some Vecs with capacity to avoid unneccessary resizing
* Merge #7994bors[bot]2021-03-131-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7994: Speed up mbe matching in heavy recursive cases r=edwin0cheng a=edwin0cheng In some cases (e.g. #4186), mbe matching is very slow due to a lot of copy and allocation for bindings, this PR try to solve this problem by introduce a semi "link-list" approach for bindings building. I used this [test case](https://github.com/weiznich/minimal_example_for_rust_81262) (for `features(32-column-tables)`) to run following command to benchmark: ``` time rust-analyzer analysis-stats --load-output-dirs ./ ``` Before this PR : 2 mins After this PR: 3 seconds. However, for 64-column-tables cases, we still need 4 mins to complete. I will try to investigate in the following weeks. bors r+ Co-authored-by: Edwin Cheng <[email protected]>
| * add expand logEdwin Cheng2021-03-131-0/+2
| |
* | Use expect-test for builtin macro/derive testsJonas Schievink2021-03-103-80/+65
| |
* | Implement builtin `cfg!` macroJonas Schievink2021-03-104-2/+19
| |
* | Compilation speedAleksey Kladov2021-03-091-1/+3
|/
* Fix assert split exprs on commaEdwin Cheng2021-02-281-17/+2
|
* Fix builtin macros split exprs on commaEdwin Cheng2021-02-281-20/+25
|
* Address further review commentsMatt Hall2021-02-241-0/+1
| | | | | | * Use known names for iter/iter_mut method (simplifies checking if the method exists * Extract code to check assist with fixtures to function
* Revert "Replace usage of ast::NameOrNameRef with ast::NameLike"Lukas Wirth2021-02-171-10/+3
| | | | This reverts commit e1dbf43cf85f84c3a7e40f9731fc1f7ac96f8979.
* Replace usage of ast::NameOrNameRef with ast::NameLikeLukas Wirth2021-02-171-3/+10
|
* add more countsAleksey Kladov2021-01-271-1/+3
|
* Disallow non-boolean literals in concat!Laurențiu Nicola2021-01-251-2/+4
|
* Unquote strings and handle boolean literals in concat!Laurențiu Nicola2021-01-251-16/+8
|
* Identify methods using functions ids rather than string namesPhil Ellison2021-01-231-0/+3
|
* Merge #7359bors[bot]2021-01-201-6/+14
|\ | | | | | | | | | | | | | | | | | | 7359: ItemTree: store a mapping from blocks to inner items r=jonas-schievink a=jonas-schievink To do name resolution within block expressions, we need to know which inner items are located inside each block expression. This adds such a mapping to `ItemTree`, replacing the previous one, which was seemingly unused other than to access all the inner items. This also assigns `AstId`s to block expressions, which is needed to store the mapping in salsa. Co-authored-by: Jonas Schievink <[email protected]>
| * Record `FileAstId`s for block expressiosnJonas Schievink2021-01-191-6/+14
| | | | | | | | | | Every block expression may contain inner items, so we need to be able to refer to any block expression and use it as a salsa key.
* | .Aleksey Kladov2021-01-192-5/+5
| |
* | :arrow_up: rowanAleksey Kladov2021-01-191-1/+1
|/
* shrink_to_fit `TokenMap`'s backing storageJonas Schievink2021-01-181-0/+2
|
* Merge #7292bors[bot]2021-01-181-2/+2
|\ | | | | | | | | | | | | | | | | | | 7292: Swap assert_eq_text\!(expected, actual) r=matklad a=u5surf Fixes #7283 Swap assert_eq_text parameters in the order (expected, actual) Co-authored-by: yugo-horie <[email protected]>
| * Swap assert_eq_text\!(expected, actual)yugo-horie2021-01-161-2/+2
| |
* | :arrow_up: arenaAleksey Kladov2021-01-171-1/+1
| |
* | Merge #7304bors[bot]2021-01-171-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | 7304: Depend on local copy of la-arena instead of crates.io’s r=lnicola a=arzg This addresses [this comment](https://github.com/rust-analyzer/rust-analyzer/pull/7276#issuecomment-760909936). #7275 and #7276 should start compiling if this is merged. Co-authored-by: Aramis Razzaghipour <[email protected]>
| * | Depend on local copy of la-arena instead of crates.io’sAramis Razzaghipour2021-01-171-1/+1
| | |
* | | When building an item-tree, keep fewer nodes in memoryAleksey Kladov2021-01-161-6/+24
| |/ |/|
* | Remove useless wrapperAleksey Kladov2021-01-152-5/+5
|/
* prepare to publish el libro de arenaAleksey Kladov2021-01-142-2/+2
|
* Fixed typos in code commentsVincent Esche2021-01-091-1/+1
|
* Merge #7145bors[bot]2021-01-082-36/+186
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7145: Proper handling $crate Take 2 [DO NOT MERGE] r=edwin0cheng a=edwin0cheng Similar to previous PR (#7133) , but improved the following things : 1. Instead of storing the whole `ExpansionInfo`, we store a similar but stripped version `HygieneInfo`. 2. Instread of storing the `SyntaxNode` (because every token we are interested are IDENT), we store the `TextRange` only. 3. Because of 2, we now can put it in Salsa. 4. And most important improvement: Instead of computing the whole frames every single time, we compute it recursively through salsa: (Such that in the best scenario, we only need to compute the first layer of frame) ```rust let def_site = db.hygiene_frame(info.def.file_id); let call_site = db.hygiene_frame(info.arg.file_id); HygieneFrame { expansion: Some(info), local_inner, krate, call_site, def_site } ``` The overall speed compared to previous PR is much faster (65s vs 45s) : ``` [WITH old PR] Database loaded 644.86ms, 284mi Crates in this dir: 36 Total modules found: 576 Total declarations: 11153 Total functions: 8715 Item Collection: 15.78s, 91562mi Total expressions: 240721 Expressions of unknown type: 2635 (1%) Expressions of partially unknown type: 2064 (0%) Type mismatches: 865 Inference: 49.84s, 250747mi Total: 65.62s, 342310mi rust-analyzer -q analysis-stats . 66.72s user 0.57s system 99% cpu 1:07.40 total [WITH this PR] Database loaded 665.83ms, 284mi Crates in this dir: 36 Total modules found: 577 Total declarations: 11188 Total functions: 8743 Item Collection: 15.28s, 84919mi Total expressions: 241229 Expressions of unknown type: 2637 (1%) Expressions of partially unknown type: 2064 (0%) Type mismatches: 868 Inference: 30.15s, 135293mi Total: 45.43s, 220213mi rust-analyzer -q analysis-stats . 46.26s user 0.74s system 99% cpu 47.294 total ``` *HOWEVER*, it is still a perf regression (35s vs 45s): ``` [WITHOUT this PR] Database loaded 657.42ms, 284mi Crates in this dir: 36 Total modules found: 577 Total declarations: 11177 Total functions: 8735 Item Collection: 12.87s, 72407mi Total expressions: 239380 Expressions of unknown type: 2643 (1%) Expressions of partially unknown type: 2064 (0%) Type mismatches: 868 Inference: 22.88s, 97889mi Total: 35.74s, 170297mi rust-analyzer -q analysis-stats . 36.71s user 0.63s system 99% cpu 37.498 total ``` Co-authored-by: Edwin Cheng <[email protected]>
| * Proper handling $crate Take 2Edwin Cheng2021-01-072-36/+186
| |
* | Add fix to wrap return expression in SomePhil Ellison2021-01-071-0/+2
| |
* | Change <|> to $0 - RebaseKevaundray Wedderburn2021-01-071-1/+1
| |
* | Refactor TokenBuffer for reduc cloningEdwin Cheng2021-01-041-5/+5
|/
* Revert "Proper handling $crate and local_inner_macros"Jonas Schievink2021-01-032-130/+32
|
* Fixed nested eager macro bugEdwin Cheng2021-01-031-0/+6
|
* Merge #7133bors[bot]2021-01-022-32/+130
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 7133: Proper handling $crate and local_inner_macros r=jonas-schievink a=edwin0cheng This PR introduces `HygineFrames` to store the macro definition/call site hierarchy in hyginee and when resolving `local_inner_macros` and `$crate`, we use the token to look up the corresponding frame and return the correct value. See also: https://rustc-dev-guide.rust-lang.org/macro-expansion.html#hygiene-and-hierarchies fixe #6890 and #6788 r? @jonas-schievink Co-authored-by: Edwin Cheng <[email protected]>
| * Use arena instead of vecEdwin Cheng2021-01-021-22/+16
| |
| * Introduce HygieneFrames for proper token hygineeEdwin Cheng2021-01-022-32/+136
| |
* | Fix infer error of macro invocation in array exprEdwin Cheng2021-01-021-1/+1
|/
* Fix `==` in in format causes mismatched-arg-countEdwin Cheng2020-12-311-1/+2
|
* Pass crate environment to proc macrosJonas Schievink2020-12-272-4/+7
|
* Store invocation site for eager macrosJonas Schievink2020-12-224-28/+27
|
* More accurate `#[derive]` parsingJonas Schievink2020-12-191-0/+1
| | | | This now allows full paths to the derive macro
* Implement `RawAttr::filter`Jonas Schievink2020-12-181-0/+1
|
* Node-ify lifetimesLukas Wirth2020-12-161-3/+2
|
* Make macro def krate mandatoryJonas Schievink2020-12-154-24/+36
| | | | Refactors builtin derive support to go through proper name resolution