aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src
Commit message (Collapse)AuthorAgeFilesLines
* Merge #4947bors[bot]2020-06-201-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4947: Replace `impls_in_trait` query with smarter use of `CrateImplDefs` r=matklad a=jonas-schievink `impls_in_trait` was allocating a whopping ~400 MB of RAM when running analysis-stats on r-a itself. Remove it, instead adding a query that computes a summary `CrateImplDefs` map for all transitive dependencies. This can probably still be made more efficient, but this already reduces the peak memory usage by 25% without much performance impact on analysis-stats. **Before**: ``` Total: 34.962107188s, 2083mb allocated 2141mb resident 422mb ImplsForTraitQuery (deps) 250mb CrateDefMapQueryQuery 147mb MacroArgQuery 140mb TraitSolveQuery (deps) 68mb InferQueryQuery (deps) 62mb ImplDatumQuery (deps) ``` **After**: ``` Total: 35.261100358s, 1520mb allocated 1569mb resident 250mb CrateDefMapQueryQuery 147mb MacroArgQuery 144mb TraitSolveQuery (deps) 68mb InferQueryQuery (deps) 61mb ImplDatumQuery (deps) 45mb BodyQuery 45mb ImplDatumQuery ``` Co-authored-by: Jonas Schievink <[email protected]>
| * Replace `impls_in_trait` with `CrateImplDefs`Jonas Schievink2020-06-191-1/+1
| |
* | Don't panic on crates depending on themselvesFlorian Diebold2020-06-191-1/+1
|/ | | | Fixes #3883.
* SimplifyAleksey Kladov2020-06-182-8/+4
|
* Anchor file-system operations to the file, and not to the source root.Aleksey Kladov2020-06-163-8/+6
| | | | | | | | | | | | | | | | Anchoring to the SourceRoot wont' work if the path is absolute: #[path = "/tmp/foo.rs"] mod foo; Anchoring to a file will. However, we *should* anchor, instead of just producing an abs path. I can imagine a situation where, for example, rust-analyzer processes crates from different machines (or, for example, from in-memory git branch), where the same absolute path in different crates might refer to different files in the end!
* Deprecate hir::Path::from_astAleksey Kladov2020-06-151-1/+1
|
* find_path: return shorter paths for external itemsJonas Schievink2020-06-122-21/+77
| | | | | If a containing module is already in scope, there's no need to use the full path to the item.
* Make known paths use `core` instead of `std`Jonas Schievink2020-06-112-11/+11
|
* Merge #4843bors[bot]2020-06-114-22/+33
|\ | | | | | | | | | | | | | | | | | | | | 4843: Don't guess macro expansion crate r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * Don't guess macro expansion crateAleksey Kladov2020-06-113-21/+31
| |
| * Make relevant_crates return a SetAleksey Kladov2020-06-111-1/+2
| |
* | ImportMap: use IndexMap internallyJonas Schievink2020-06-101-9/+12
| | | | | | | | | | It iterates in insertion order, which makes the ordering more predictable.
* | Respect casing when searching for importsJonas Schievink2020-06-101-5/+55
| |
* | Limit import map queriesJonas Schievink2020-06-101-1/+41
| |
* | Clean up import_map.rsJonas Schievink2020-06-101-25/+20
| |
* | Add an FST index to `ImportMap`Jonas Schievink2020-06-101-3/+250
|/
* Merge #4760bors[bot]2020-06-051-11/+1
|\ | | | | | | | | | | | | | | | | | | | | 4760: Minimize FileLoader interface r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * Minimize FileLoader interfaceAleksey Kladov2020-06-051-11/+1
| |
| |
| \
*-. \ Merge #4729 #4748bors[bot]2020-06-057-100/+498
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4729: Hover actions r=matklad a=vsrs This PR adds a `hoverActions` LSP extension and a `Go to Implementations` action as an example: ![hover_actions_impl](https://user-images.githubusercontent.com/62505555/83335732-6d9de280-a2b7-11ea-8cc3-75253d062fe0.gif) 4748: Add an `ImportMap` and use it to resolve item paths in `find_path` r=matklad a=jonas-schievink Removes the "go faster" queries I added in https://github.com/rust-analyzer/rust-analyzer/pull/4501 and https://github.com/rust-analyzer/rust-analyzer/pull/4506. I've checked this PR on the rustc code base and the assists are still fast. This should fix https://github.com/rust-analyzer/rust-analyzer/issues/4515. Note that this does introduce a change in behavior: We now always refer to items defined in external crates using paths through the external crate. Previously we could also use a local path (if for example the extern crate was reexported locally), as seen in the changed test. If that is undesired I can fix that, but the test didn't say why the previous behavior would be preferable. Co-authored-by: vsrs <[email protected]> Co-authored-by: Jonas Schievink <[email protected]> Co-authored-by: Jonas Schievink <[email protected]>
| | * Clarify when we visit modules multiple timesJonas Schievink2020-06-051-1/+3
| | |
| | * impl Debug for ImportMapJonas Schievink2020-06-051-19/+23
| | |
| | * Reorder importsJonas Schievink2020-06-053-5/+7
| | |
| | * Make `find_path_inner` private againJonas Schievink2020-06-051-1/+1
| | |
| | * defining_crate -> krateJonas Schievink2020-06-052-2/+3
| | |
| | * Fix wrong commentJonas Schievink2020-06-051-1/+1
| | |
| | * Use `ImportMap` in `find_path`, remove old queriesJonas Schievink2020-06-043-97/+140
| | |
| | * Add an ImportMapJonas Schievink2020-06-046-12/+358
| |/
* | More direct signature for resolve_pathAleksey Kladov2020-06-052-3/+3
| |
* | Rename resolve_relative_path -> resolve_pathAleksey Kladov2020-06-052-7/+3
|/ | | | For things like `concant!(env!("OUT_DIR"))`, we need to support abs paths
* Fix type inference failure when built with log/kv_unstableDavid Tolnay2020-06-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This code is broken by an `impl From<kv::Error> for fmt::Error` in the log crate when building in a codebase that has the log/kv_unstable feature enabled. $ cargo check --manifest-path crates/ra_hir_def/Cargo.toml Checking ra_hir_def v0.1.0 Finished dev [unoptimized] target(s) in 0.75s $ cargo check --manifest-path crates/ra_hir_def/Cargo.toml --features log/kv_unstable Checking ra_hir_def v0.1.0 error[E0282]: type annotations needed for the closure `fn(&str) -> std::result::Result<(), _>` --> crates/ra_hir_def/src/path.rs:278:17 | 278 | f.write_str("::")?; | ^^^^^^^^^^^^^^^^^^ cannot infer type | help: give this closure an explicit return type without `_` placeholders | 276 | let mut add_segment = |s| -> std::result::Result<(), _> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* Consolidate documentation expansion and mergingAaron Loucks2020-06-031-0/+7
| | | | | | Removes the duplicated `expand_doc_attrs` and `merge_doc_comments_and_attrs` functions from `ra_ide` and exposes the same functionality via `ra_hir::Documentation::from_ast`.
* Add basic hover and completion doc tests for macro generated itemsAaron Loucks2020-06-031-1/+1
|
* Enable hover and autocomplete docs on macro generated itemsAaron Loucks2020-06-032-3/+48
|
* Add highlight support for unsafe fn calls and raw ptr derefPaul Daniel Faria2020-06-021-1/+5
|
* fmtrobojumper2020-05-312-11/+21
|
* correctly infer labelled breaksrobojumper2020-05-313-19/+60
|
* Support raw_ref_op's raw reference operatorrobojumper2020-05-283-4/+34
|
* Pass trivially copy types as copykjeremy2020-05-261-1/+1
|
* Fix some clippy perf warningsJeremy Kolb2020-05-251-1/+1
|
* Merge pull request #4548 from bnjjj/fix_4464Aleksey Kladov2020-05-242-2/+2
|\ | | | | add support of feature flag for runnables
| * add support of feature flag for runnables #4464Benjamin Coenen2020-05-2114-112/+111
| |\ | | | | | | | | | Signed-off-by: Benjamin Coenen <[email protected]>
| * | add support of feature flag for runnables #4464Benjamin Coenen2020-05-212-2/+2
| | | | | | | | | | | | Signed-off-by: Benjamin Coenen <[email protected]>
* | | Provide Chalk well-known traitsFlorian Diebold2020-05-221-4/+8
| |/ |/|
* | Make `find_path_inner` a queryJonas Schievink2020-05-202-4/+7
| | | | | | | | | | This eliminates any remaining performance problems in the "Implement default members" assist (at least that I've found).
* | Switch to new magic marksAleksey Kladov2020-05-2013-79/+61
| |
* | Cleanup query fn namingAleksey Kladov2020-05-192-3/+5
| |
* | Move public API to the topAleksey Kladov2020-05-191-9/+9
| |
* | SimplifyAleksey Kladov2020-05-191-7/+3
| |
* | Cleanup importsAleksey Kladov2020-05-191-3/+5
| |
* | Merge #4501bors[bot]2020-05-182-5/+18
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | 4501: Querify `importable_locations_in_crate` r=jonas-schievink a=jonas-schievink This brings the time needed to compute the `add_missing_impl_members` assist down from ~5 minutes to 20 seconds on my test workload (which is editing within an impl of a MIR [`MutVisitor`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/visit/trait.MutVisitor.html)) cc #4498 Co-authored-by: Jonas Schievink <[email protected]>