11513: internal: Expand the derive attribute into a pseudo expansion r=Veykril a=Veykril
Quoting my comment:
> We generate a very specific expansion here, as we do not actually expand the `#[derive]` attribute
> itself in name res, but we do want to expand it to something for the IDE layer, so that the input
> derive attributes can be downmapped, and resolved as proper paths.
> This is basically a hack, that simplifies the hacks we need in a lot of ide layer places to
> somewhat inconsistently resolve derive attributes.
>
> As such, we expand `#[derive(Foo, bar::Bar)]` into
> ```
> #[Foo]
> #[bar::Bar]
> ();
> ```
> which allows fallback path resolution in hir::Semantics to properly identify our derives.
> Since we do not expand the attribute in nameres though, we keep the original item.
>
> The ideal expansion here would be for the `#[derive]` to re-emit the annotated item and somehow
> use the input paths in its output as well.
> But that would bring two problems with it, for one every derive would duplicate the item token tree
> wasting a lot of memory, and it would also require some way to use a path in a way that makes it
> always resolve as a derive without nameres recollecting them.
> So this hacky approach is a lot more friendly for us, though it does require a bit of support in
> [`hir::Semantics`] to make this work.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
11525: fix(assist): Drop generic args in path before insert use in `replace_qualified_name_with_use` r=Veykril a=tysg
Fixes#11505. also removed an unnecessary `clone_for_update` call.
Co-authored-by: Tianyi Song <42670338+tysg@users.noreply.github.com>
11524: doc: state that only the latest stable toolchain is supported r=lnicola a=jtroo
This closes#11226. The content seemed to make more sense in the
installation section as opposed to the Troubleshooting section.
Co-authored-by: Jan Tache <j.andreitabs@gmail.com>
11490: Correctly fix formatting doc tests with generics r=Veykril a=KarlWithK
Before the doc_test would be outputted like this:
```zsh
"Foo<T, U>::t"
```
However, this would cause problems with shell redirection. I've changed it
so when generics are involved we simply wrap the expression under quotes as so:
```zsh
"\"Foo<T, U>::t\""
```
Note:
At the cost of adding this, I had to allocate a new string via
`format!{}`. However, I argue this is alright as this for just for
outputting the name of the doc test.
The following tests have been changed:
```
runnables::tests::doc_test_type_params
runnables::tests::test_doc_runnables_impl_mod
runnables::tests::test_runnables_doc_test_in_impl
```
Closes https://github.com/rust-analyzer/rust-analyzer/issues/11489
Co-authored-by: KarlWithK <jocelinc60@outlook.com>
Co-authored-by: SeniorMars <jocelinc60@outlook.com>
11481: Display parameter names when hovering over a function pointer r=Veykril a=Vannevelj
Implements #11474
The idea is pretty straightforward: previously we constructed the hover based on just the parameter types, now we pass in the parameter names as well. I went for a quick-hit approach here but I expect someone will be able to point me to a better way of resolving the identifier.
I haven't figured out yet how to actually run my rust-analyzer locally so I can see it in action but the unit test indicates it should work.
Co-authored-by: Jeroen Vannevel <jer_vannevel@outlook.com>
11424: Pass required features to cargo when using run action r=Veykril a=WaffleLapkin
When using `F1`->`Rust Analyzer: Run` action on an `example`, pass its `required-features` to `cargo run`. This allows to run examples that were otherwise impossible to run with RA.
Co-authored-by: Maybe Waffle <waffle.lapkin@gmail.com>
11511: internal: Wrap MacroCallKind::Attr attr_args field in an Arc r=Veykril a=Veykril
This is stored in `MacroCallLoc` which is returned from a query, so cloning should be made cheap.
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>