6524: Add support for loading rustc private crates r=matklad a=xldenis
This PR presents a solution to the problem of making`rustc_private` crates visible to `rust-analyzer`.
Currently developers add dependencies to those crates behind a `cfg(NOT_A_TARGET)` target to prevent `cargo` from building them.
This solution is unsatisfactory since it requires modifying `Cargo.toml` and causes problems for collaboration or CI.
The proposed solution suggested by @matklad is to allow users to give RA a path where the `rustc` sources could be found and then load that like a normal workspace.
This PR implements this solution by adding a `rustcSource` configuration item and adding the cargo metadata to the crate graph if it is provided.
------
I have no idea how this should be tested, or if this code is generally tested at all. I've locally run the extension with these changes and it correctly loads the relevant crates on a `rustc_private` project of mine.
Co-authored-by: Xavier Denis <xldenis@gmail.com>
6514: Fix extract_struct_from_enum_variant not updating record references r=Veykril a=Veykril
Related to #6510
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
6513: Support qualified function calls in remove_unused_param r=Veykril a=Veykril
Also adds a test to check that it removes unused params across files.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
6472: Add `static` modifier for associated functions r=matklad a=p3achyjr
Adds static semantic token modifier to associated functions, resolves#6194
## Info
- Associated functions are more-or-less equivalent to static methods in other languages. This PR checks, for each function, whether that function has a self_param, and whether it's enclosed in a trait/impl.
## Changes
- Added method ```is_associated``` to code_model::Function. This basically gets the source from the ast, and checks whether the enclosing scope is an impl or trait.
- Added `static` to HighlightModifiers
- Added unit test
## Tests
- Ran ```cargo test```
Co-authored-by: Anatol Liu <axlui@anatols-mbp.lan>
6501: Remove text_edit_builder api from AssistBuilder r=matklad a=Veykril
Also fixes a small bug in `expand_glob_import` in regards to the very nice looking `something::{*}` import when only one item was used. Before it would duplicate the path and just append it, causing the following wrong import `something::something::UsedItem`.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
6477: Add infer_function_return_type assist r=matklad a=Veykril
This adds an assist to insert a functions return type if it hasn't been specified yet by inferring it from the functions tail expression. This assist only becomes active if the cursor is on the tail expression. See https://github.com/rust-analyzer/rust-analyzer/issues/6303#issuecomment-714657326
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>