aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src
Commit message (Collapse)AuthorAgeFilesLines
* Fixed typos in code commentsVincent Esche2021-01-094-8/+8
|
* Merge #7145bors[bot]2021-01-081-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-071-1/+1
| |
* | Add fix to wrap return expression in SomePhil Ellison2021-01-071-0/+1
| |
* | Change <|> to $0 - RebaseKevaundray Wedderburn2021-01-073-41/+41
| |
* | Emit diagnostics for unresolved item-level macrosJonas Schievink2021-01-051-1/+32
| |
* | Merge #7168bors[bot]2021-01-051-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 7168: Rename expr -> tail_expr r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | Rename expr -> tail_exprAleksey Kladov2021-01-051-1/+1
| | |
* | | Merge #7140bors[bot]2021-01-052-113/+177
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7140: Store trait associated items in fst r=matklad a=SomeoneToIgnore Store imported traits' associated function/methods and constants into `ImportMap.fst` and pefrorm the imports search on them. This is a first step towards trait autoimport during completion functionality, the way I see it, after this PR, only a few major things are left to be done: * store all traits' assoc items into fst, not only the ones in scope, as we do now. Any code pointers on how to do this are welcome 😄 * adjust a few modules in completions crate (`dot.rs`, `qualified_path.rs` at least) to query the import map, reusing the `import_assets` logic heavily == With the current import and autoimport implementations, it looks like for a single query, we're either interested in either associated items lookup or in all other `fst` contents lookup, but never both simultaneously. I would rather not split `fst` in two but add another `Query` parameter to separate those, but let me know if you have any ideas. Co-authored-by: Kirill Bulatov <[email protected]>
| * | Move the test markKirill Bulatov2021-01-051-2/+4
| | |
| * | Small helpersKirill Bulatov2021-01-041-0/+4
| | |
| * | Code review fixesKirill Bulatov2021-01-041-30/+30
| | |
| * | Do not collect trait type aliasesKirill Bulatov2021-01-041-5/+6
| | |
| * | SimplifyKirill Bulatov2021-01-042-27/+37
| | |
| * | Properly check assoc items lookupKirill Bulatov2021-01-042-46/+73
| | |
| * | Add associated data into fstKirill Bulatov2021-01-041-49/+45
| | |
| * | Add a basic test for the trait fuzzy importKirill Bulatov2021-01-041-0/+24
| | |
* | | Introduce new queries to computeDaniel Frampton2021-01-052-12/+55
|/ / | | | | | | | | | | | | | | 1) the set of attributes for all variants of an enum, and 2) the set of attributes for all fields of a variant. This avoids the current n^2 behavior when rendering completion for variants, which prevents completion for enums with large numbers of variants.
* | Merge #7113bors[bot]2021-01-031-0/+4
|\ \ | |/ |/| | | | | | | | | | | | | | | 7113: Manual updates r=matklad a=tekul Add some details on how to build the manual and some clarification on how to deal with "proc macro2 warnings. For context, this arose from [this question](https://users.rust-lang.org/t/how-to-disable-rust-analyzer-proc-macro-warnings-in-neovim/53150) on users.rust-lang.org. Co-authored-by: Luke Taylor <[email protected]>
| * Expand doc on dealing with "proc macro not expanded"Luke Taylor2021-01-011-0/+4
| | | | | | | | | | | | Added the error message to the doc for the UnresolvedProcMacro diagnostic, explaining that either enabling the procMacro setting or disabling this diagnostic should make the warnings go away.
* | Revert "Proper handling $crate and local_inner_macros"Jonas Schievink2021-01-031-1/+1
| |
* | Merge #7128bors[bot]2021-01-032-2/+41
|\ \ | | | | | | | | | | | | | | | | | | | | | 7128: Implement HasAttrs for GenericParam r=matklad a=Veykril Co-authored-by: Lukas Wirth <[email protected]>
| * | Impl HasAttrs for GenericParamLukas Wirth2021-01-012-2/+41
| | |
* | | Use fully qualified `Itertools::intersperse` call to silence nightly ↵cynecx2021-01-021-8/+7
| | | | | | | | | | | | warnings about a potential name collision due to recent libstd api additions
* | | Merge #7133bors[bot]2021-01-021-1/+1
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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]>
| * | Introduce HygieneFrames for proper token hygineeEdwin Cheng2021-01-021-1/+1
| |/
* | Merge #7080bors[bot]2021-01-015-14/+68
|\ \ | |/ |/| | | | | | | | | | | 7080: Implement ConstParams for HIR r=Veykril a=Veykril r? @flodiebold Co-authored-by: Lukas Wirth <[email protected]>
| * Add ConstParams to the HIRLukas Wirth2021-01-015-14/+68
| |
* | Remove some unneeded string allocationsLukas Wirth2020-12-311-1/+1
| |
* | SimplifyAleksey Kladov2020-12-301-2/+4
| |
* | Avoid a couple of allocationsLaurențiu Nicola2020-12-292-14/+15
| |
* | Better display methods in expect testsKirill Bulatov2020-12-281-15/+31
| |
* | Add testsKirill Bulatov2020-12-281-2/+71
| |
* | Add docs and optimisationsKirill Bulatov2020-12-281-4/+13
| |
* | Better query api and fuzzy searchKirill Bulatov2020-12-281-33/+40
| |
* | Draft the module exclusion in modulesKirill Bulatov2020-12-281-34/+62
|/
* Fixed old failed test due to new fixesEdwin Cheng2020-12-281-2/+2
|
* Merge #7021bors[bot]2020-12-243-52/+78
|\ | | | | | | | | | | | | | | 7021: Track labels in the HIR r=matklad a=Veykril Groundwork for #6966 Co-authored-by: Lukas Wirth <[email protected]>
| * Track labels in the HIRLukas Wirth2020-12-243-52/+78
| |
* | Implement const block inferenceLukas Wirth2020-12-232-1/+11
| |
* | Implement const pat inferenceLukas Wirth2020-12-232-4/+16
|/
* Merge #7010bors[bot]2020-12-231-1/+3
|\ | | | | | | | | | | | | | | | | | | | | | | 7010: Update ungrammar for const block patterns r=matklad a=Veykril Fixes #6848 Adds const blocks and const block patterns to the AST and parses them. Blocked on https://github.com/rust-analyzer/ungrammar/pull/17/, will merge that PR there once this one gets the OK so I can remove the local ungrammar dependency path and fix the Cargo.lock. Co-authored-by: Lukas Wirth <[email protected]>
| * Update ungrammar for const block patternsLukas Wirth2020-12-231-1/+3
| |
* | Don't think that /submod.rs is /mod.rsAleksey Kladov2020-12-231-1/+1
|/
* Merge #6921bors[bot]2020-12-201-6/+31
|\ | | | | | | | | | | | | | | 6921: Higher-ranked trait bounds for where clauses r=flodiebold a=Veykril There is a slight problem with this which is also noted in a FIXME now but `LifetimeParameters` of these ForLifetime where clauses allocate the lifetimes in the corresponding arena as if they were lifetimes of the item itself and not just the clause they belong to. I wasn't entirely sure what I could do about this but given nothing really uses lifetimes like that currently I figured it might be fine? Open to suggestions for that problem. Co-authored-by: Lukas Wirth <[email protected]>
| * Higher-ranked trait bounds for where clausesLukas Wirth2020-12-171-6/+31
| |
* | Add API for mapping `Attr` back to its syntax nodeJonas Schievink2020-12-191-23/+55
| |
* | Make `RawAttrs` crate-privateJonas Schievink2020-12-191-2/+2
| | | | | | | | There should be no need to use this from outside
* | Remove `Attrs::merge`Jonas Schievink2020-12-191-12/+0
| | | | | | | | Only the `RawAttrs` version of this is in use
* | Remove resolved FIXMEJonas Schievink2020-12-191-1/+0
| |