10798: ide: show go to for function hover return type r=Veykril a=jhgg
I've found myself wanting this... adds to the hover quick go-to for a function's return type:
![image](https://user-images.githubusercontent.com/5489149/142375722-4a385216-494b-45a4-be1c-59664213b8d6.png)
This is particularly useful when you are hovering over a function in a long chain, like:
```rust
foo.bar().b$0az().some_trait_fn();
```
where `baz`'s return type is not immediately obvious, but the chain is not long enough to trigger chain inlay hints...
i guess I could just select `foo.bar().baz()` too to get the types too...
Co-authored-by: Jake Heinz <jh@discordapp.com>
10796: ide: display static values in hover r=Veykril a=jhgg
Continuation from #10785 - does the same thing, but for `static`'s as well.
Co-authored-by: Jake Heinz <jh@discordapp.com>
10795: Remove unwrap in doc path resolution r=Veykril a=udoprog
I keep hitting this constantly in my project, and I haven't dug very deep into the root cause. But seeing as the project otherwise compiles it appears to be something unsupported is being incorrectly parsed in rust-analyzer which for other cases is handled by returning `None`.
Co-authored-by: John-John Tedro <udoprog@tedro.se>
10799: fix: Fix proc macro ABI version checks r=lnicola a=lnicola
If I'm reading this right, we used to pick `Abi1_55` for `1.54` and `Abi_1_58` for `1.57`.
CC `@alexjg` (just in case I'm misinterpreting the code), CC #10772.
bors r+
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
10785: ide: show const value in hover r=jhgg a=jhgg
fixes#10783
I think my original attempt was incorrect, because it looks like `HirDisplay` is used in more places than just the hover.
So, I've attempted it again in 312eafe, this time specifically just rendering the value in `hover::render`
pictoral:
![image](https://user-images.githubusercontent.com/5489149/142163890-b6aa2ab4-7bd0-4dd3-b35d-5eaa83fffb7f.png)
Co-authored-by: Jake Heinz <jh@discordapp.com>
Co-authored-by: Jake <jh@discordapp.com>
10789: internal: Check for derive attributes by item path, not `derive` identifier r=Veykril a=Veykril
Prior we only checked if an attribute is the exact `derive` identifier and nothing else to collect derive attributes. That means when we encounter the following:
```rs
#[::core::macros::builtin::derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ModPath {
pub kind: PathKind,
segments: Vec<Name>,
}
```
We won't actually expand the derive attributes, but instead we just expand the `derive` attribute with our dummy identity expander.
The changes here make it so we actually lookup the attribute path, check if it is the derive attribute and then collect the derives.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
10786: minor: remove duplicate calls r=Veykril a=XFFXFF
`scopes.set_scope(*expr, scope)` is duplicate, because we always call it in `compute_expr_scopes` add6cccd4c/crates/hir_def/src/body/scope.rs (L175-L180)
Co-authored-by: zhoufan <1247714429@qq.com>
10781: internal: Do not use reference search in `runnables::related_tests` r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
10778: internal: Skip test/bench attr expansion in resolution instead of collection r=Veykril a=Veykril
This way we skip any path resolving to the test and bench attributes instead of just the lone identifiers(which could very well point to non-builtin attributes).
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
10777: internal: Allow disabling perf access via `RA_DISABLE_PERF` r=lnicola a=jonas-schievink
https://github.com/rr-debugger/rr does not support the perf-specific ioctls, so add a way to avoid them.
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
10769: Add proc macro ABI for rustc 1.58 r=lnicola a=alexjg
This fixes#10766.
I do have some concerns here. The proc macro server API has added three methods to `TokenStream` which I don't really know how to implement in `RustcServer`. Namely `expand_expr`, `before`, and `after`. You'll see that these are currently `unimplemented!` in `crates/proc_macro_server/src/abis/abi_1_58/rustc_server.rs`. I don't have the expertise to fill in the blanks here, it may be necessary to pull in someone who knows a bit more about the proc macro crate.
I think this will only be a problem when actually attempting to expand a macro, so this is probably strictly better than not including the updated ABI at all.
Co-authored-by: Alex Good <alex@memoryandthought.me>
Revert "Fix `impl_trait` function to emit correct ast"
This reverts commit 55a4813151.
Fix `impl_def_from_trait`
It now generates the correct `ast::Impl` using
`generate_trait_impl_text` and parses it to form the right node (copied
from the private fn 'make::ast_from_text').