Commit graph

20104 commits

Author SHA1 Message Date
bors[bot] 806d7d725d
Merge #10828
10828: doc: document absence of stability guarantees r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-11-22 10:07:23 +00:00
Aleksey Kladov d9dc925c2e doc: document absence of stability guarantees 2021-11-22 13:06:37 +03:00
bors[bot] 183ef048f6
Merge #10823
10823: fix: better `Fn` traits formatting r=jonas-schievink a=veber-alex

This makes it so formatting `Fn` traits properly handles:

1. An `Fn` trait with only a single argument -> removes the trailing comma.
2. An `Fn` trait which returns nothing (an empty tuple) -> don't show `-> ()` as the return type.

before:
![before](https://user-images.githubusercontent.com/29788806/142745038-44ac68ce-de42-4396-a809-ffdb883be699.png)

after:
![after](https://user-images.githubusercontent.com/29788806/142745040-485feaa2-cc21-4a05-9576-5410ea355029.png)




Co-authored-by: Alex Veber <alexveber@gmail.com>
2021-11-21 20:01:07 +00:00
Jake Heinz 03eb9f3abb project_model: print full cargo command if it fails to run 2021-11-21 01:18:42 +00:00
Alex Veber 24f816c481 fix: better Fn traits formatting 2021-11-21 02:39:22 +02:00
bors[bot] 4566414789
Merge #10810
10810: feat: Add toggle to disable cache priming r=jonas-schievink a=lnicola

Even if it doesn't prevent the rest of the features from working, cache priming tends to be quite CPU-intensive and can make people think that the load times are worse than they actually are.

It's also less useful in Code and `rust-tools` because the inlay hints and semantic highlighting trigger quite a bit of computation assuming you have a file open in the editor.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-11-20 20:24:31 +00:00
bors[bot] c9c6fa8f56
Merge #10821
10821: fix: wrap `inline_call` and `inline_into_callers` if it inlines into the left side of a binary expression r=Veykril a=rainy-me

close #10359

Co-authored-by: rainy-me <github@yue.coffee>
2021-11-20 17:25:17 +00:00
rainy-me ebffaa4274 fix: check inline left of binary_expression 2021-11-21 01:48:04 +09:00
bors[bot] 55b7a06888
Merge #10820
10820: minor: Move incorrect case diagnostic things into their module r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-20 16:26:50 +00:00
Lukas Wirth 69782f55de Move incorrect case diagnostic things into their module 2021-11-20 17:25:57 +01:00
bors[bot] f2707bce36
Merge #10819
10819: internal: Replace some `Vec` occurences with `Box`  r=Veykril a=Veykril

Shaves off ~15mb from self analysis

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-20 15:40:56 +00:00
Lukas Wirth 91def936bc Replace Vec with Box in Path.generic_args field 2021-11-20 16:37:41 +01:00
Lukas Wirth ceaec9d866 internal: Replace Vec with Box in hir Pat 2021-11-20 16:17:30 +01:00
Lukas Wirth cc327774b7 internal: Replace Vec with Box in hir Expr 2021-11-20 16:00:45 +01:00
bors[bot] 5f5c84d921
Merge #10817
10817: ide: hover omits unnamed where preds r=Veykril a=jhgg

fixes #10800

Co-authored-by: Jake Heinz <jh@discordapp.com>
2021-11-20 12:01:22 +00:00
Jake Heinz 7cbc6ae920 ide: hover omits unnamed where preds 2021-11-20 11:45:12 +00:00
bors[bot] 14dff25107
Merge #10812
10812: feat: Format `Fn` traits using parentheses r=jonas-schievink a=jonas-schievink

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/8157

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-11-19 20:02:26 +00:00
Jonas Schievink 9f4c26e780 Format Fn traits using parentheses 2021-11-19 19:58:00 +01:00
Laurențiu Nicola a68ce62f6a Add toggle to disable cache priming 2021-11-19 19:30:11 +02:00
bors[bot] cf2ddb935e
Merge #10808
10808: fix: show custom check-command r=Veykril a=Florian-Schoenherr

just realized this is a lot cleaner and actually shows something on a custom command,
also debugged it this time.

Co-authored-by: Florian-Schoenherr <65456722+Florian-Schoenherr@users.noreply.github.com>
2021-11-19 15:35:09 +00:00
Florian-Schoenherr 7e25f1b7e2
fix: show custom check-command 2021-11-19 16:22:39 +01:00
iDawer 601413df8f Use mutable syntax trees in merge_imports, split_imports 2021-11-19 20:02:27 +05:00
bors[bot] 4c20d6879f
Merge #10807
10807: fix: Diagnose invalid derive attribute input r=Veykril a=Veykril

Doesn't yet diagnose incorrect syntax between the `(`, `)` braces as we discard those problems currently.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-19 12:20:13 +00:00
Lukas Wirth ea03defeac fix: Diagnose invalid derive attribute input 2021-11-19 13:17:35 +01:00
bors[bot] a60e009b48
Merge #10806
10806: fix: inlay param hint hiding heurstic is case unsensitive r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-19 11:46:49 +00:00
Lukas Wirth cd290b427c fix: inlay param hint hiding heurstic is case unsensitive 2021-11-19 12:46:17 +01:00
bors[bot] 2fafe0e37c
Merge #10804
10804: fix: Diagnose using `derive` on non-adt items r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-19 11:34:22 +00:00
Lukas Wirth 6757910934 fix: Diagnose using derive on non-adt items 2021-11-19 12:10:55 +01:00
bors[bot] 2507442382
Merge #10805
10805: ide: dedupe or merge hover actions r=Veykril a=jhgg

fixes #10780 

Co-authored-by: Jake Heinz <jh@discordapp.com>
2021-11-19 10:59:49 +00:00
Jake Heinz c28dc00b39 ide: dedupe or merge hover actions 2021-11-19 05:36:07 +00:00
bors[bot] f0da9406bc
Merge #10803
10803: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-18 20:45:20 +00:00
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