]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoMerge #9840
bors[bot] [Tue, 10 Aug 2021 11:57:20 +0000 (11:57 +0000)]
Merge #9840

9840: minor: reword a bit r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agominor: reword a bit
Aleksey Kladov [Tue, 10 Aug 2021 11:56:55 +0000 (14:56 +0300)]
minor: reword a bit

2 years agoMerge #9838
bors[bot] [Tue, 10 Aug 2021 11:34:47 +0000 (11:34 +0000)]
Merge #9838

9838: internal: document codebase stance on using functional combinators r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: document codebase stance on using functional combinators
Aleksey Kladov [Tue, 10 Aug 2021 11:34:05 +0000 (14:34 +0300)]
internal: document codebase stance on using functional combinators

2 years agoMerge #9837
bors[bot] [Tue, 10 Aug 2021 11:24:08 +0000 (11:24 +0000)]
Merge #9837

9837: feat: Implement `bool_then_to_if` assist r=Veykril a=Veykril

Other half of https://github.com/rust-analyzer/rust-analyzer/issues/8413

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoImplement `bool_then_to_if` assist
Lukas Wirth [Tue, 10 Aug 2021 11:03:12 +0000 (13:03 +0200)]
Implement `bool_then_to_if` assist

2 years agoMerge #9835
bors[bot] [Tue, 10 Aug 2021 10:59:49 +0000 (10:59 +0000)]
Merge #9835

9835: feat: Generate default trait fn impl when generating `Hash`. r=Veykril a=yoshuawuyts

Implements a default trait function body when generating the `Hash` trait for a type. Thanks!

r? `@Veykril`

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2 years agoimpl gen hash for structs
Yoshua Wuyts [Tue, 10 Aug 2021 10:13:30 +0000 (12:13 +0200)]
impl gen hash for structs

2 years agoimpl gen hash for enums
Yoshua Wuyts [Tue, 10 Aug 2021 09:59:41 +0000 (11:59 +0200)]
impl gen hash for enums

2 years agoMerge #9830
bors[bot] [Tue, 10 Aug 2021 10:27:55 +0000 (10:27 +0000)]
Merge #9830

9830: Enable more assists to generate default trait body impls r=Veykril a=yoshuawuyts

Enable more assists to benefit from trait body generation. Follow-up to #9825 and #9814.

__edit:__ I'd like to move the existing tests to this new file too, but I'll do that in a follow-up PR.

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2 years agoimplement feedback from review
Yoshua Wuyts [Tue, 10 Aug 2021 10:21:48 +0000 (12:21 +0200)]
implement feedback from review

2 years agoMerge #9834
bors[bot] [Tue, 10 Aug 2021 09:50:42 +0000 (09:50 +0000)]
Merge #9834

9834: internal: unify subcommand handling between ra and xtask r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: unify subcommand handling between ra and xtask
Aleksey Kladov [Tue, 10 Aug 2021 09:49:55 +0000 (12:49 +0300)]
internal: unify subcommand handling between ra and xtask

2 years agointernal: prepare to use standard .run pattern for subcommands
Aleksey Kladov [Tue, 10 Aug 2021 09:25:47 +0000 (12:25 +0300)]
internal: prepare to use standard .run pattern for subcommands

2 years agoMerge #9832
bors[bot] [Tue, 10 Aug 2021 09:21:32 +0000 (09:21 +0000)]
Merge #9832

9832: vscode extension: use esbuild instead of rollup. r=matklad a=yaymukund

This shaves a couple seconds off our build & trims npm dependencies. I tested it using VSCode's "Install [Extension] from VSIX" option and it seems to work. Note that it changes the root of the package from `out/src/main â†’ out/main`.

Fell out of the discussion in #9179

Co-authored-by: Mukund Lakshman <yaymukund@gmail.com>
2 years agovscode extension: use esbuild instead of rollup.
Mukund Lakshman [Tue, 10 Aug 2021 06:56:34 +0000 (07:56 +0100)]
vscode extension: use esbuild instead of rollup.

2 years agoMerge #9833
bors[bot] [Tue, 10 Aug 2021 09:13:38 +0000 (09:13 +0000)]
Merge #9833

9833: [semantic-highlighting] functions that consume  are marked as HlMod::Consuming r=matklad a=jhgg

Does as the PR title says, functions that *consume* self, are marked as *consuming*.

Co-authored-by: Jake Heinz <jh@discordapp.com>
2 years agoAdd trait codegen to `add_missing_impl_members` assist
Yoshua Wuyts [Mon, 9 Aug 2021 21:26:28 +0000 (23:26 +0200)]
Add trait codegen to `add_missing_impl_members` assist

2 years ago[semantic-highlighting] functions that consume are marked as HlMod::Consuming
Jake Heinz [Tue, 10 Aug 2021 07:31:30 +0000 (07:31 +0000)]
[semantic-highlighting] functions that consume  are marked as HlMod::Consuming

2 years agomove trait body gen code to utils
Yoshua Wuyts [Mon, 9 Aug 2021 19:47:44 +0000 (21:47 +0200)]
move trait body gen code to utils

2 years agoMerge #9804
bors[bot] [Mon, 9 Aug 2021 17:09:13 +0000 (17:09 +0000)]
Merge #9804

9804: Generate method from call r=matklad a=mahdi-frms

Needs a bit of refactoring. Tests also should be added.

Co-authored-by: mahdi-frms <mahdif1380@outlook.com>
2 years agoMerge #9825
bors[bot] [Mon, 9 Aug 2021 16:59:10 +0000 (16:59 +0000)]
Merge #9825

9825: Generate default impl when converting #[derive(Default)] to manual impl r=Veykril a=yoshuawuyts

Similar to https://github.com/rust-analyzer/rust-analyzer/pull/9814, but for `#[derive(Default)]`. Thanks!

## Follow-up steps
I've added the tests inside `handlers/replace_derive_with_manual_impl.rs` again, but I'm planning a follow-up PR to extract these to `utils/` so we can share them between assists - and maybe even add another assist just for the purpose of testing these impls (e.g. `generate_default_trait_body`).

The step after _that_ is likely to fill out the remaining traits, so we can make it so whenever RA auto-completes a trait which also can be derived, we provide a default function body.

Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
2 years agorefactor method generation assist
mahdi-frms [Mon, 9 Aug 2021 16:07:07 +0000 (20:37 +0430)]
refactor method generation assist

2 years agomethod gen assist usable in all of expression
mahdi-frms [Mon, 9 Aug 2021 14:51:15 +0000 (19:21 +0430)]
method gen assist usable in all of expression

2 years agoadd test for method generation assist
mahdi-frms [Mon, 9 Aug 2021 14:25:10 +0000 (18:55 +0430)]
add test for method generation assist

2 years agoOne assist for function and method generation
mahdi-frms [Sun, 8 Aug 2021 13:14:05 +0000 (17:44 +0430)]
One assist for function and method generation

2 years agomethod generation assist: store owned ast nodes
mahdi-frms [Sun, 8 Aug 2021 12:51:34 +0000 (17:21 +0430)]
method generation assist: store owned ast nodes

2 years agogenerate method adds pub keyword
mahdi-frms [Sat, 7 Aug 2021 09:29:33 +0000 (13:59 +0430)]
generate method adds pub keyword

2 years agogenerate method assist uses existing impl blocks
mahdi-frms [Sat, 7 Aug 2021 06:59:49 +0000 (11:29 +0430)]
generate method assist uses existing impl blocks

2 years agorefactor: use single next space
mahdi-frms [Thu, 5 Aug 2021 12:18:51 +0000 (16:48 +0430)]
refactor: use single next space

2 years agorefactor: use single fn_args
mahdi-frms [Thu, 5 Aug 2021 12:07:00 +0000 (16:37 +0430)]
refactor: use single fn_args

2 years agogenerate method assist
mahdi-frms [Thu, 5 Aug 2021 09:30:08 +0000 (14:00 +0430)]
generate method assist

2 years agomove code around
Yoshua Wuyts [Mon, 9 Aug 2021 16:27:01 +0000 (18:27 +0200)]
move code around

2 years agoMerge #9827
bors[bot] [Mon, 9 Aug 2021 16:26:24 +0000 (16:26 +0000)]
Merge #9827

9827: internal: remove client-side support for latest requests r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: remove client-side support for latest requests
Aleksey Kladov [Mon, 9 Aug 2021 16:24:43 +0000 (19:24 +0300)]
internal: remove client-side support for latest requests

Companion for #9826

2 years agoMerge #9826
bors[bot] [Mon, 9 Aug 2021 16:04:03 +0000 (16:04 +0000)]
Merge #9826

9826: internal: drop latest requests tracking r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agointernal: drop latest requests tracking
Aleksey Kladov [Mon, 9 Aug 2021 15:56:19 +0000 (18:56 +0300)]
internal: drop latest requests tracking

From the dawn of time, when dinosaurs roamed the and we didn't have
hierarchical profiling, there was the `latest_requests` infra we used to
track the time of ten last requests.

Today, no one is actually using it and, what's more, it itself became
pretty useless -- LSP grew way more chatty, and 10 requests don't really
paint any kind of picture.

Personally, it's been years since I last looked at latest requests in
the status output.

So, let's remove a tiny bit of state from the big ball of complexity
that is `GlobalState` and `main_loop`!

2 years agoAdd gen default for tuple structs
Yoshua Wuyts [Mon, 9 Aug 2021 15:28:06 +0000 (17:28 +0200)]
Add gen default for tuple structs

2 years agoAdd default body when implementing Default by hand
Yoshua Wuyts [Mon, 9 Aug 2021 15:12:18 +0000 (17:12 +0200)]
Add default body when implementing Default by hand

2 years agoMerge #9823
bors[bot] [Mon, 9 Aug 2021 13:16:43 +0000 (13:16 +0000)]
Merge #9823

9823: fix: avoid pathological macro expansions  r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agofix: avoid pathological macro expansions
Aleksey Kladov [Mon, 9 Aug 2021 13:06:49 +0000 (16:06 +0300)]
fix: avoid pathological macro expansions

Today, rust-analyzer (and rustc, and bat, and IntelliJ) fail badly on
some kinds of maliciously constructed code, like a deep sequence of
nested parenthesis.

"Who writes 100k nested parenthesis" you'd ask?

Well, in a language with macros, a run-away macro expansion might do
that (see the added tests)! Such expansion can be broad, rather than
deep, so it bypasses recursion check at the macro-expansion layer, but
triggers deep recursion in parser.

In the ideal world, the parser would just handle deeply nested structs
gracefully. We'll get there some day, but at the moment, let's try to be
simple, and just avoid expanding macros with unbalanced parenthesis in
the first place.

closes #9358

2 years agointernal: remove useless helpers
Aleksey Kladov [Mon, 9 Aug 2021 12:41:19 +0000 (15:41 +0300)]
internal: remove useless helpers

We generally avoid "syntax only" helper wrappers, which don't do much:
they make code easier to write, but harder to read. They also make
investigations harder, as "find_usages" needs to be invoked both for the
wrapped and unwrapped APIs

2 years agoMerge #9821
bors[bot] [Mon, 9 Aug 2021 11:06:58 +0000 (11:06 +0000)]
Merge #9821

9821: minor: Fix typo in reference modifier description r=lnicola a=lnicola

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoFix typo in reference modifier description
Laurențiu Nicola [Mon, 9 Aug 2021 11:06:14 +0000 (14:06 +0300)]
Fix typo in reference modifier description

2 years agoMerge #9735
bors[bot] [Mon, 9 Aug 2021 10:21:14 +0000 (10:21 +0000)]
Merge #9735

9735: Add assist to sort members alphabetically. r=matklad a=vsrs

Supports traits, impls, structs, unions and enums (including inner struct variants). Does not support modules yet.

```rust
en┃um Animal {
  Dog(String, f64),
  Cat { weight: f64, name: String },
}
```
->
```rust
enum Animal {
  Cat { weight: f64, name: String },
  Dog(String, f64),
}
```
---
```rust
enum Animal {
  Dog(String, f64),
  Cat {┃ weight: f64, name: String },
}
```
->
```rust
enum Animal {
  Dog(String, f64),
  Cat { name: String, weight: f64 },
}
```
---
More samples in docs https://github.com/vsrs/rust-analyzer/blob/0b7835619a3ec7fdc5c11e6ab001ad452314a3f2/crates/ide_assists/src/handlers/sort_items.rs#L12-L83.

Relates #6110

Co-authored-by: vsrs <vit@conrlab.com>
2 years agoMerge #9820
bors[bot] [Mon, 9 Aug 2021 10:13:23 +0000 (10:13 +0000)]
Merge #9820

9820: minor: as per code-styple, add invariant comment r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agominor: as per code-styple, add invariant comment
Aleksey Kladov [Mon, 9 Aug 2021 10:13:02 +0000 (13:13 +0300)]
minor: as per code-styple, add invariant comment

2 years agoMerge #9814
bors[bot] [Sun, 8 Aug 2021 22:30:37 +0000 (22:30 +0000)]
Merge #9814

9814: Generate default impl when converting `#[derive(Debug)]` to manual impl r=yoshuawuyts a=yoshuawuyts

This patch makes it so when you convert `#[derive(Debug)]` to a manual impl, a default body is provided that's equivalent to the original output of `#[derive(Debug)]`. This should make it drastically easier to write custom `Debug` impls, especially when all you want to do is quickly omit a single field which is `!Debug`.

This is implemented for enums, record structs, tuple structs, empty structs - and it sets us up to implement variations on this in the future for other traits (like `PartialEq` and `Hash`).

Thanks!

## Codegen diff
This is the difference in codegen for record structs with this patch:
```diff
struct Foo {
    bar: String,
}

impl fmt::Debug for Foo {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        todo!();
+        f.debug_struct("Foo").field("bar", &self.bar).finish()
    }
}
```

Co-authored-by: Irina Shestak <shestak.irina@gmail.com>
Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
Co-authored-by: Yoshua Wuyts <yoshuawuyts+github@gmail.com>
2 years agoRemove unwraps
Yoshua Wuyts [Sun, 8 Aug 2021 22:29:38 +0000 (00:29 +0200)]
Remove unwraps

2 years agoUpdate crates/test_utils/src/minicore.rs
Yoshua Wuyts [Sun, 8 Aug 2021 22:00:09 +0000 (00:00 +0200)]
Update crates/test_utils/src/minicore.rs

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoMerge #9816
bors[bot] [Sun, 8 Aug 2021 18:42:19 +0000 (18:42 +0000)]
Merge #9816

9816: feat: Implement if_to_bool_then assist r=Veykril a=Veykril

One half of https://github.com/rust-analyzer/rust-analyzer/issues/8413

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoUse minicore
Yoshua Wuyts [Sun, 8 Aug 2021 16:58:42 +0000 (18:58 +0200)]
Use minicore

2 years agoexclude files from tidy check
Yoshua Wuyts [Sun, 8 Aug 2021 16:44:54 +0000 (18:44 +0200)]
exclude files from tidy check

2 years agoMerge #9817
bors[bot] [Sun, 8 Aug 2021 16:07:09 +0000 (16:07 +0000)]
Merge #9817

9817: fix: Increase chalk overflow depth r=flodiebold a=lnicola

This makes the experience better for people using `tonic`, see https://github.com/rust-analyzer/rust-analyzer/issues/7817.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoImplement if_to_bool_then assist
Lukas Wirth [Sun, 8 Aug 2021 15:12:08 +0000 (17:12 +0200)]
Implement if_to_bool_then assist

2 years agoIncrease chalk overflow depth
Laurențiu Nicola [Sun, 8 Aug 2021 15:40:28 +0000 (18:40 +0300)]
Increase chalk overflow depth

2 years agouse make::name_ref
Yoshua Wuyts [Sun, 8 Aug 2021 14:31:28 +0000 (16:31 +0200)]
use make::name_ref

2 years agoUpdate replace_derive_with_manual_impl.rs
Yoshua Wuyts [Sun, 8 Aug 2021 14:24:14 +0000 (16:24 +0200)]
Update replace_derive_with_manual_impl.rs

2 years agoImprove naming and add comments
Yoshua Wuyts [Sun, 8 Aug 2021 13:56:26 +0000 (15:56 +0200)]
Improve naming and add comments

2 years agodedup struct debug impl code
Yoshua Wuyts [Sun, 8 Aug 2021 13:41:32 +0000 (15:41 +0200)]
dedup struct debug impl code

2 years agoFix enum debug indent level
Yoshua Wuyts [Sun, 8 Aug 2021 13:32:11 +0000 (15:32 +0200)]
Fix enum debug indent level

2 years agogenerate Debug for enums
Yoshua Wuyts [Sun, 8 Aug 2021 13:24:04 +0000 (15:24 +0200)]
generate Debug for enums

2 years agorename variables
Yoshua Wuyts [Sun, 8 Aug 2021 12:11:47 +0000 (14:11 +0200)]
rename variables

According to https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/style.md#variable-naming

2 years agofinish debug_struct impls
Yoshua Wuyts [Sun, 8 Aug 2021 12:08:02 +0000 (14:08 +0200)]
finish debug_struct impls

2 years agodebug for record field structs
Yoshua Wuyts [Sun, 8 Aug 2021 11:50:49 +0000 (13:50 +0200)]
debug for record field structs

2 years agowip
Yoshua Wuyts [Sun, 8 Aug 2021 11:09:50 +0000 (13:09 +0200)]
wip

2 years agoimpl Debug def from trait
Irina Shestak [Sun, 1 Aug 2021 18:46:23 +0000 (20:46 +0200)]
impl Debug def from trait

2 years agoMerge #9812
bors[bot] [Sun, 8 Aug 2021 12:53:53 +0000 (12:53 +0000)]
Merge #9812

9812: fix: add `!` to macro completions with existing arg r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agofix: add `!` to macro completions with existing arg
Aleksey Kladov [Sun, 8 Aug 2021 12:49:00 +0000 (15:49 +0300)]
fix: add `!` to macro completions with existing arg

2 years agoMerge #9808
bors[bot] [Sun, 8 Aug 2021 10:41:45 +0000 (10:41 +0000)]
Merge #9808

9808: fix: Look for enum variants and trait assoc functions when looking for lang items r=matklad a=Veykril

Examples for lang enum variants are the `Option` variants.
Assoc trait functions aren't being seen since they aren't declared in the direct module scope.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoMerge #9810
bors[bot] [Sun, 8 Aug 2021 10:35:00 +0000 (10:35 +0000)]
Merge #9810

9810: Add reference here r=matklad a=ivan770

Superseds #6853

Co-authored-by: ivan770 <ivan@ivan770.me>
2 years agoAdd reference here diagnostic
ivan770 [Sun, 8 Aug 2021 08:12:40 +0000 (10:12 +0200)]
Add reference here diagnostic

2 years agoLook for enum variants and trait assoc functions when looking for lang items
Lukas Wirth [Sat, 7 Aug 2021 19:56:42 +0000 (21:56 +0200)]
Look for enum variants and trait assoc functions when looking for lang items

2 years agoMerge #9809
bors[bot] [Sat, 7 Aug 2021 20:16:58 +0000 (20:16 +0000)]
Merge #9809

9809: internal: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSimplify
Lukas Wirth [Sat, 7 Aug 2021 20:16:15 +0000 (22:16 +0200)]
Simplify

2 years agoMerge #9806
bors[bot] [Sat, 7 Aug 2021 15:42:26 +0000 (15:42 +0000)]
Merge #9806

9806: Add proc_macro crate for the 1.56 ABI r=lnicola a=alexjg

I've copied the latest proc macro source from Rust nightly and modified it to compile on `stable`. This fixes #9795 . Almost everything here is uninteresting copy and paste, the interesting stuff is in `crates/proc_macro_srv/src/abis/mod.rs`. I've left the 1.55 ABI implementation in for now. We did discuss only supporting one nightly ABI so we may want to remove 1.55. That will break code which is pinned to older nightly releases but that seems acceptable to me, what do people think?

Co-authored-by: Alex Good <alex@memoryandthought.me>
2 years agoCopy the proc_macro crate for the 1.56 ABI
Alex Good [Sat, 7 Aug 2021 15:21:53 +0000 (16:21 +0100)]
Copy the proc_macro crate for the 1.56 ABI

2 years agoMerge #9805
bors[bot] [Sat, 7 Aug 2021 11:32:08 +0000 (11:32 +0000)]
Merge #9805

9805: internal: Upgrade Chalk r=flodiebold a=flodiebold

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agoUpgrade Chalk
Florian Diebold [Sat, 7 Aug 2021 11:11:58 +0000 (13:11 +0200)]
Upgrade Chalk

2 years agoMerge #9801
bors[bot] [Fri, 6 Aug 2021 14:16:24 +0000 (14:16 +0000)]
Merge #9801

9801: fix: Don't publish diagnostics in crates.io or sysroot files r=jonas-schievink a=jonas-schievink

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

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agoDon't publish diagnostics in library source roots
Jonas Schievink [Fri, 6 Aug 2021 14:14:54 +0000 (16:14 +0200)]
Don't publish diagnostics in library source roots

2 years agoMerge #9800
bors[bot] [Fri, 6 Aug 2021 14:00:29 +0000 (14:00 +0000)]
Merge #9800

9800: feat: Include suggested replacement in diagnostics r=jonas-schievink a=jonas-schievink

rustc renders the diagnostic text for suggestions by including the suggested replacement at the end (`` help: a function with a similar name exists: `boo` ``), but the emitted JSON diagnostic does not include this in the message. This causes our diagnostics to lack some useful info, so this PR fixes that by appending any suggested replacements to the message.

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

Before:
![screenshot-2021-08-06-15:54:19](https://user-images.githubusercontent.com/1786438/128521003-105a43a3-e386-4afc-9d5c-7806631f53d7.png)

After:
![screenshot-2021-08-06-15:53:16](https://user-images.githubusercontent.com/1786438/128521022-c16e0967-6cc6-410d-917d-5db5cfbb96be.png)

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agoBless tests
Jonas Schievink [Fri, 6 Aug 2021 13:59:58 +0000 (15:59 +0200)]
Bless tests

2 years agoDon't include empty suggestions
Jonas Schievink [Fri, 6 Aug 2021 13:58:55 +0000 (15:58 +0200)]
Don't include empty suggestions

2 years agoInclude suggested replacement in diagnostics
Jonas Schievink [Fri, 6 Aug 2021 13:52:47 +0000 (15:52 +0200)]
Include suggested replacement in diagnostics

2 years agoMerge #9794
bors[bot] [Thu, 5 Aug 2021 20:45:49 +0000 (20:45 +0000)]
Merge #9794

9794: Fix binders with bare dyn trait r=flodiebold a=flodiebold

Fixes #9639.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agoFix binders with bare dyn trait
Florian Diebold [Thu, 5 Aug 2021 20:44:38 +0000 (22:44 +0200)]
Fix binders with bare dyn trait

Fixes #9639.

2 years agoMerge #9793
bors[bot] [Thu, 5 Aug 2021 17:56:19 +0000 (17:56 +0000)]
Merge #9793

9793: Remove unused structs in ide_db r=matklad a=michalmuskala

Co-authored-by: Michał Muskała <michal@muskala.eu>
2 years agoMerge #9785
bors[bot] [Thu, 5 Aug 2021 16:17:38 +0000 (16:17 +0000)]
Merge #9785

9785: feature: Add completion for struct literals in which all fields are visible. r=Veykril a=Afourcat

This PR adds a new completion for struct literal.

It Implements the feature discussed in the issue #9610.

![RAExample3](https://user-images.githubusercontent.com/35599359/128211142-116361e9-7a69-425f-83ea-473c6ea47b26.gif)

This PR introduce a repetition in the source files `crates/ide_completion/render/pattern.rs` and `crates/ide_completion/render/struct_literal.rs` that may be fix in another PR.

Co-authored-by: Alexandre Fourcat <afourcat@gmail.com>
2 years agoRemove unused structs in ide_db
Michał Muskała [Thu, 5 Aug 2021 11:02:52 +0000 (12:02 +0100)]
Remove unused structs in ide_db

2 years agoMerge #9790
bors[bot] [Thu, 5 Aug 2021 00:54:49 +0000 (00:54 +0000)]
Merge #9790

9790: fix: extract_type_alias extracts generics correctly r=Veykril a=Veykril

Fixes #8335
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoextract_type_alias extracts generics correctly
Lukas Wirth [Thu, 5 Aug 2021 00:54:06 +0000 (02:54 +0200)]
extract_type_alias extracts generics correctly

2 years agoMerge #9780
bors[bot] [Wed, 4 Aug 2021 18:12:37 +0000 (18:12 +0000)]
Merge #9780

9780: Support exclusive_range_pattern r=matklad a=lf-

Fix #9779

Co-authored-by: Jade <software@lfcode.ca>
2 years agoMerge #9788
bors[bot] [Wed, 4 Aug 2021 18:03:41 +0000 (18:03 +0000)]
Merge #9788

9788: fix: extract_function does not move locals defined outside of loops r=Veykril a=Veykril

Fixes #8234

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoextract_function does not move locals defined outside of loops
Lukas Wirth [Wed, 4 Aug 2021 18:00:45 +0000 (20:00 +0200)]
extract_function does not move locals defined outside of loops

2 years agoDocument reference highlighting mod
Lukas Wirth [Wed, 4 Aug 2021 12:17:56 +0000 (14:17 +0200)]
Document reference highlighting mod

2 years agoAdd completion for struct literal in which all fields are visible.
Alexandre Fourcat [Tue, 3 Aug 2021 22:46:50 +0000 (00:46 +0200)]
Add completion for struct literal in which all fields are visible.

Fix ide_completion tests.

Move 'complete_record_literal' call to the main completion function.

Fix a rendering bug when snippet not available.

Checks if an expression is expected before adding completion for struct literal.

Move 'completion struct literal with private field' test to 'expressions.rs' test file.

Update 'expect' tests with new check in 'complete record literal'.

2 years agoMerge #9786
bors[bot] [Wed, 4 Aug 2021 16:04:35 +0000 (16:04 +0000)]
Merge #9786

9786: fix: Fix detection of macro file in inactive-code diag r=jonas-schievink a=jonas-schievink

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

`HirFileId::expansion_info` can return `None` for builtin macros or if there's an error in the macro call or definition, so add a `HirFileId::is_macro` method that checks the right thing.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agoFix detection of macro file in inactive-code diag
Jonas Schievink [Wed, 4 Aug 2021 16:02:45 +0000 (18:02 +0200)]
Fix detection of macro file in inactive-code diag

2 years agoSplit the test
Jade [Wed, 4 Aug 2021 10:01:27 +0000 (03:01 -0700)]
Split the test