Commit Graph

20023 Commits

Author SHA1 Message Date
Lukas Wirth
966cae384f minor: Simplify 2021-11-18 21:43:54 +01:00
bors[bot]
cfa26c3ac3
Merge #10798
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>
2021-11-18 09:56:44 +00:00
bors[bot]
bf8cf09967
Merge #10796
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>
2021-11-18 09:48:10 +00:00
bors[bot]
b844d453b2
Merge #10795
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>
2021-11-18 09:40:59 +00:00
bors[bot]
8d24f0e60a
Merge #10794
10794: fix: parse the range pat inside the tuple pat r=lnicola a=XFFXFF

fixes #10784 

Co-authored-by: zhoufan <1247714429@qq.com>
2021-11-18 09:33:47 +00:00
bors[bot]
ea01a3aa9f
Merge #10799
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>
2021-11-18 08:38:07 +00:00
Laurențiu Nicola
6196b928a4 Fix proc macro ABI version checks 2021-11-18 10:24:24 +02:00
Jake Heinz
876f44b3ea ide: show go to for function hover return type 2021-11-18 08:00:22 +00:00
Jake Heinz
e8d0989606 ide: display static values in hover 2021-11-18 06:00:51 +00:00
John-John Tedro
76e3feeeb5 Remove unwrap in doc path resolution 2021-11-18 05:20:53 +01:00
bors[bot]
64a73dcfba
Merge #10785
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>
2021-11-18 04:17:16 +00:00
Jake Heinz
aef8882254 more complicated const test 2021-11-18 04:15:02 +00:00
zhoufan
a539b5e693 fix: parse the range pat inside the tuple pat 2021-11-18 11:11:37 +08:00
bors[bot]
fdd49b9713
Merge #10789
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>
2021-11-17 20:11:21 +00:00
Lukas Wirth
f72512f1c6 Simplify 2021-11-17 21:02:33 +01:00
Lukas Wirth
91bbc55eed Check for derive attributes by item path, not derive identifier 2021-11-17 20:46:57 +01:00
Jake
d5de7c21b2
Apply suggestions from code review
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-17 09:53:24 -08:00
bors[bot]
32f425d801
Merge #10787
10787: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-17 14:55:18 +00:00
Lukas Wirth
6e1ecaef4f Simplify 2021-11-17 15:54:38 +01:00
bors[bot]
e051ae8f19
Merge #10786
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>
2021-11-17 10:39:19 +00:00
zhoufan
1f1682ee1e minor: remove duplicate calls 2021-11-17 18:16:25 +08:00
Jake Heinz
312eafe916 maybe this is better?? 2021-11-17 07:02:49 +00:00
Jake Heinz
4fbc4b9356 hir: show const value in hover 2021-11-17 05:49:27 +00:00
bors[bot]
add6cccd4c
Merge #10781
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>
2021-11-16 20:51:09 +00:00
bors[bot]
1c49667c56
Merge #10778
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>
2021-11-16 20:33:58 +00:00
Lukas Wirth
366499c3be Do not use reference search in runnables::related_tests 2021-11-16 21:32:02 +01:00
Lukas Wirth
0ff380fe17 Simplify 2021-11-16 21:26:34 +01:00
Lukas Wirth
b57289c4cb Skip test/bench attr expansion in resolution instead of collection 2021-11-16 20:23:56 +01:00
bors[bot]
b88b01ecec
Merge #10775
10775: minor: Simplify r=lnicola a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-16 18:52:26 +00:00
bors[bot]
bf408ef5fd
Merge #10777
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>
2021-11-16 18:44:04 +00:00
Jonas Schievink
445280a1b1 Allow disabling perf access via RA_DISABLE_PERF 2021-11-16 19:42:19 +01:00
Lukas Wirth
f2f89618b7 minor: Simplify 2021-11-16 19:28:32 +01:00
bors[bot]
9f1e26c3f9
Merge #10776
10776: fix: Remove validation of `super` in use paths r=Veykril a=lnicola

Fixes #10770

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-11-16 18:18:47 +00:00
Laurențiu Nicola
b23bebebc0 Remove validation of super in use paths 2021-11-16 20:02:42 +02:00
bors[bot]
35ed853d84
Merge #10769
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>
2021-11-16 16:40:51 +00:00
Alex Good
abdb2acbe5
Add proc macro ABI for rustc 1.58 2021-11-16 14:14:08 +00:00
bors[bot]
6c7be6cd84
Merge #10734
10734: fix: add generic parameters in convert to manual impl assist r=Veykril a=TheDoctor314

Fixes #10041.

Co-authored-by: TheDoctor314 <64731940+TheDoctor314@users.noreply.github.com>
2021-11-16 11:27:11 +00:00
bors[bot]
7e756acb36
Merge #10774
10774: minor: Lift out FxIndex{Map/Set} types into ide_db r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-16 11:16:50 +00:00
Lukas Wirth
92f7db447c minor: Lift out FxIndex{Map/Set} types into ide_db 2021-11-16 12:15:47 +01:00
bors[bot]
bb98791f51
Merge #10773
10773: fix: Remove faulty logic for ascending test attributes for runnables r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10768
bors r+


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-16 10:52:31 +00:00
Lukas Wirth
d2513deb62 fix: Reimplement mapping out of test/bench attributes for runnables 2021-11-16 11:51:24 +01:00
TheDoctor314
58a24de7d8 Fix impl_def_from_trait
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').
2021-11-15 22:28:22 +05:30
bors[bot]
73668334f0
Merge #10767
10767: minor: Rename intern_macro -> intern_macro_call r=Veykril a=Veykril

We potentially want to intern macro definitions so the names would probably collide
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-14 15:26:58 +00:00
Lukas Wirth
5c0b895f69 Rename intern_macro -> intern_macro_call 2021-11-14 16:25:47 +01:00
bors[bot]
4b9b714b5c
Merge #10759
10759: make `add_missing_match_arms` applicable at the end of the match r=Veykril a=rainy-me

close #10740

Co-authored-by: rainy-me <github@yue.coffee>
2021-11-14 12:05:17 +00:00
rainy-me
1f3da38d94 adjust test case and stop deleting newline 2021-11-14 20:56:28 +09:00
bors[bot]
212095a07d
Merge #10762
10762: Fix: trigger flyimport on enum variants r=lnicola a=XFFXFF

fixes #10749 

Co-authored-by: zhoufan <1247714429@qq.com>
2021-11-14 09:20:59 +00:00
zhoufan
5666046ec9 fix: flyimport triggers on enum variant declarations 2021-11-14 12:16:21 +08:00
bors[bot]
766b52b598
Merge #10761
10761: inlay hints: add the option to always show constructor inlay hints r=Veykril a=jhgg

This PR adds a config to *disable* the functionality in #10441 - _and makes that functionality disabled by default._

I actually *really* like inlay hints always showing up, and it helps a lot as a teaching tool too, and also it's quite reassuring to know that r-a indeed understands the code I've written. This PR adds the option `rust-analyzer.inlayHints.hideNamedConstructorHints` (i can also invert this to be `rust-analyzer.inlayHints.showNamedConstructorHints`, just let me know.)




Co-authored-by: Jake Heinz <jh@discordapp.com>
2021-11-13 23:42:16 +00:00
Jake Heinz
520ff62f4e flip the default 2021-11-13 23:39:34 +00:00