]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agosource_to_def: skip items with no def
Jonas Schievink [Tue, 8 Jun 2021 14:42:48 +0000 (16:42 +0200)]
source_to_def: skip items with no def

3 years agoRevert "Merge #9177"
Aleksey Kladov [Tue, 8 Jun 2021 12:31:36 +0000 (15:31 +0300)]
Revert "Merge #9177"

This reverts commit f1818cb7ba2808cba3fd9bf8f199c382060a1f19, reversing
changes made to 6c9362d61b895c11b1d0cf6837ada9f2a0a30eaf.

This broke things

3 years agoMerge #9177
bors[bot] [Tue, 8 Jun 2021 11:00:19 +0000 (11:00 +0000)]
Merge #9177

9177: :arrow_up: npm packages r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years ago:arrow_up: npm packages
Aleksey Kladov [Tue, 8 Jun 2021 10:55:20 +0000 (13:55 +0300)]
:arrow_up: npm packages

3 years agoMerge #9153
bors[bot] [Tue, 8 Jun 2021 10:53:20 +0000 (10:53 +0000)]
Merge #9153

9153: QOL: VSCode status bar icon on click now shows server status r=matklad a=Milo123459

Now, when you click the little status bar text, it will automatically reload the server. I don't think I've ever seen anyone click it randomly, and, it's there to save you a few clicks.

Co-authored-by: Milo <50248166+Milo123459@users.noreply.github.com>
3 years agoMerge #9171
bors[bot] [Mon, 7 Jun 2021 18:46:18 +0000 (18:46 +0000)]
Merge #9171

9171: internal: simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agosimplify
Lukas Wirth [Mon, 7 Jun 2021 18:45:17 +0000 (20:45 +0200)]
simplify

3 years agoMerge #9170
bors[bot] [Mon, 7 Jun 2021 17:47:23 +0000 (17:47 +0000)]
Merge #9170

9170: internal: Remove unnecessary `completion::macro_in_item_position` module r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoRemove unnecessary completion::macro_in_item_position
Lukas Wirth [Mon, 7 Jun 2021 17:35:24 +0000 (19:35 +0200)]
Remove unnecessary completion::macro_in_item_position

3 years agoMerge #9169
bors[bot] [Mon, 7 Jun 2021 17:37:48 +0000 (17:37 +0000)]
Merge #9169

9169: internal: steps towards attribute macro token mapping r=jonas-schievink a=jonas-schievink

This doesn't work yet, but we seem to be getting a bit further along (for example, we now stop highlighting `use` items inside item with attribute macros as if they were written verbatim).

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoAttempt to track attr macros during highlighting
Jonas Schievink [Mon, 7 Jun 2021 17:32:28 +0000 (19:32 +0200)]
Attempt to track attr macros during highlighting

3 years agoReorder CompletionContext fields
Lukas Wirth [Mon, 7 Jun 2021 17:06:03 +0000 (19:06 +0200)]
Reorder CompletionContext fields

3 years agofix
Milo [Mon, 7 Jun 2021 16:56:40 +0000 (17:56 +0100)]
fix

3 years agoMerge #9144
bors[bot] [Mon, 7 Jun 2021 16:17:14 +0000 (16:17 +0000)]
Merge #9144

9144: Extend convert_tuple_struct_to_named_struct to also apply to enum tuple variants r=matklad a=joshuawarner32

This is largely copied and adapted from the existing `convert_tuple_struct_to_named_struct` code.

Not sure if maybe some of this code can/should be shared between those two assists - but the differences are significant enough to make it at least seem like a non-trivial refactor.

Co-authored-by: Joshua Warner <joshuawarner32@gmail.com>
3 years agoMerge #9166
bors[bot] [Mon, 7 Jun 2021 15:49:50 +0000 (15:49 +0000)]
Merge #9166

9166: Clarify label documentation r=matklad a=flodiebold

Also some other cleanups while I'm there.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
3 years agoMake "expand macro" command work with attribute macros
Jonas Schievink [Mon, 7 Jun 2021 14:05:36 +0000 (16:05 +0200)]
Make "expand macro" command work with attribute macros

3 years agoFurther clarification
Florian Diebold [Mon, 7 Jun 2021 12:50:03 +0000 (14:50 +0200)]
Further clarification

3 years agoOne additional grammar fix
Florian Diebold [Mon, 7 Jun 2021 12:43:58 +0000 (14:43 +0200)]
One additional grammar fix

3 years agoClarify label documentation
Florian Diebold [Mon, 7 Jun 2021 12:34:41 +0000 (14:34 +0200)]
Clarify label documentation

Also some other cleanups while I'm there.

3 years agoMerge #9164
bors[bot] [Mon, 7 Jun 2021 12:17:28 +0000 (12:17 +0000)]
Merge #9164

9164: internal: Reduce the number of direct fields in `CompletionContext` some more r=Veykril a=Veykril

Doesn't make the code much simpler yet.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMove more things into PathCompletionContext
Lukas Wirth [Mon, 7 Jun 2021 10:29:46 +0000 (12:29 +0200)]
Move more things into PathCompletionContext

3 years agoMerge #9161
bors[bot] [Mon, 7 Jun 2021 10:33:13 +0000 (10:33 +0000)]
Merge #9161

9161: Fix incorrect config usage in hover references r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoFix incorrect config usage in hover references
Lukas Wirth [Mon, 7 Jun 2021 10:32:25 +0000 (12:32 +0200)]
Fix incorrect config usage in hover references

3 years agoMerge #9160
bors[bot] [Mon, 7 Jun 2021 09:59:32 +0000 (09:59 +0000)]
Merge #9160

9160: internal: make `Documentation::new` non-generic r=lnicola a=lnicola

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoMake Documentation::new non-generic
Laurențiu Nicola [Mon, 7 Jun 2021 09:58:51 +0000 (12:58 +0300)]
Make Documentation::new non-generic

3 years agoMerge #9157
bors[bot] [Mon, 7 Jun 2021 07:40:52 +0000 (07:40 +0000)]
Merge #9157

9157: minor: Use HTTPS for clippy lint JSON r=lnicola a=lnicola

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoUse HTTPS for clippy lint JSON
Laurențiu Nicola [Mon, 7 Jun 2021 07:40:12 +0000 (10:40 +0300)]
Use HTTPS for clippy lint JSON

3 years agoMerge #9106
bors[bot] [Mon, 7 Jun 2021 04:52:38 +0000 (04:52 +0000)]
Merge #9106

9106: feat: goto definition on an impl fn goes to that fn in the trait r=lf- a=lf-

e.g. if you have a trait T and `impl T for S` for some struct, if you
goto definition on some function name inside the impl, it will go to the
definition of that function inside the `trait T` block, rather than the
current behaviour of not going anywhere at all.

![ra goto def trait the other way](https://user-images.githubusercontent.com/6652840/120403989-39aa3280-c2fa-11eb-9359-639346878acd.gif)

Co-authored-by: Jade <software@lfcode.ca>
3 years agofeat: goto def on impl items also goes to the defn in the trait
Jade [Mon, 7 Jun 2021 04:48:06 +0000 (21:48 -0700)]
feat: goto def on impl items also goes to the defn in the trait

It was trivial to extend this to associated consts/associated types and
I just didn't think of it.

3 years agofeat: goto definition on an impl fn goes to that fn in the trait
Jade [Tue, 1 Jun 2021 23:16:59 +0000 (16:16 -0700)]
feat: goto definition on an impl fn goes to that fn in the trait

e.g. if you have a trait T and `impl T for S` for some struct, if you
goto definition on some function name inside the impl, it will go to the
definition of that function inside the `trait T` block, rather than the
current behaviour of not going anywhere at all.

3 years agoSimplify CompletionContext by introducing a path CallKind enum
Lukas Wirth [Sun, 6 Jun 2021 18:02:26 +0000 (20:02 +0200)]
Simplify CompletionContext by introducing a path CallKind enum

3 years agoHandle attribute macros in `descend_into_macros`
Jonas Schievink [Sun, 6 Jun 2021 13:51:05 +0000 (15:51 +0200)]
Handle attribute macros in `descend_into_macros`

3 years agoMerge #9155
bors[bot] [Sun, 6 Jun 2021 14:50:06 +0000 (14:50 +0000)]
Merge #9155

9155: internal: replace attribute with equivalent whitespace r=jonas-schievink a=jonas-schievink

This is needed to that the `TokenMap` we create contains offsets that match the source. Currently the offsets don't match because the attribute is removed, shifting all subsequent token offsets by the attribute's text length.

Currently this fix has no visible effect because we don't remap tokens in attribute macros.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoReplace attribute with equivalent whitespace
Jonas Schievink [Sun, 6 Jun 2021 13:51:49 +0000 (15:51 +0200)]
Replace attribute with equivalent whitespace

This is needed to that the `TokenMap` we create contains offsets that
match the source.

3 years agofmt
Joshua Warner [Sun, 6 Jun 2021 00:09:56 +0000 (17:09 -0700)]
fmt

3 years agofix
Milo [Sat, 5 Jun 2021 23:21:50 +0000 (00:21 +0100)]
fix

3 years agowhen you click status bar icon it now restarts server
Milo [Sat, 5 Jun 2021 23:17:16 +0000 (00:17 +0100)]
when you click status bar icon it now restarts server

3 years agoRefactor to be just one assist
Joshua Warner [Sat, 5 Jun 2021 22:29:29 +0000 (15:29 -0700)]
Refactor to be just one assist

3 years agoMerge #9149
bors[bot] [Sat, 5 Jun 2021 19:26:33 +0000 (19:26 +0000)]
Merge #9149

9149: feat: Support goto-definition for include macros input path r=Veykril a=Veykril

![0l6l9iWPNE](https://user-images.githubusercontent.com/3757771/120891155-3fa85800-c607-11eb-9b20-7ac330dceb4b.gif)
Fixes #5871

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMerge #9150
bors[bot] [Sat, 5 Jun 2021 18:16:57 +0000 (18:16 +0000)]
Merge #9150

9150: Unescape generated clippy lints r=lnicola a=Veykril

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMerge #9140
bors[bot] [Sat, 5 Jun 2021 17:23:40 +0000 (17:23 +0000)]
Merge #9140

9140: feat: Render documentation for derive completion r=Veykril a=Veykril

![eEzGiq2wNa](https://user-images.githubusercontent.com/3757771/120847308-9c5a3300-c573-11eb-958d-e0f22f4757ed.gif)

Nothing fancy as all the std derives aren't really documented though maybe some 3rd party crates document them equally to their trait counterparts.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoUnescape generated clippy lints
Lukas Wirth [Sat, 5 Jun 2021 17:14:53 +0000 (19:14 +0200)]
Unescape generated clippy lints

3 years agoSupport goto-definition for include macro paths
Lukas Wirth [Sat, 5 Jun 2021 12:02:36 +0000 (14:02 +0200)]
Support goto-definition for include macro paths

3 years agoMerge #9147
bors[bot] [Sat, 5 Jun 2021 12:29:52 +0000 (12:29 +0000)]
Merge #9147

9147: internal: enable proc macros and build scripts in cli r=flodiebold a=lnicola

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoEnable proc macros and build scripts by default in CLI
Laurențiu Nicola [Sat, 5 Jun 2021 11:03:56 +0000 (14:03 +0300)]
Enable proc macros and build scripts by default in CLI

3 years agoMerge #9148
bors[bot] [Sat, 5 Jun 2021 11:16:46 +0000 (11:16 +0000)]
Merge #9148

9148: minor: Prevent renaming of aliases on usages r=Veykril a=Veykril

Otherwise trying to rename a usage that goes through an alias will still rename the aliased item instead, cc https://github.com/rust-analyzer/rust-analyzer/issues/5671
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoPrevent renaming of aliases on usages
Lukas Wirth [Sat, 5 Jun 2021 11:15:07 +0000 (13:15 +0200)]
Prevent renaming of aliases on usages

3 years agoMerge #9146
bors[bot] [Sat, 5 Jun 2021 10:44:36 +0000 (10:44 +0000)]
Merge #9146

9146: minor: Fix incorrect list nesting in format_like feature description r=Veykril a=Veykril

bors r+
Closes #6261

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoFix incorrect list nesting in format_like feature description
Lukas Wirth [Sat, 5 Jun 2021 10:43:45 +0000 (12:43 +0200)]
Fix incorrect list nesting in format_like feature description

3 years agoMerge #9145
bors[bot] [Sat, 5 Jun 2021 09:32:40 +0000 (09:32 +0000)]
Merge #9145

9145: internal: Enable attribute macro expansion in `analysis-stats` r=flodiebold a=flodiebold

Before:
```
> $ rust-analyzer -q analysis-stats --with-proc-macro --load-output-dirs .
Database loaded:     19.08s, 277minstr
  crates: 34, mods: 688, decls: 13202, fns: 10412
Item Collection:     16.21s, 76ginstr
  exprs: 290580, ??ty: 2508 (0%), ?ty: 1814 (0%), !ty: 947
Inference:           27.46s, 108ginstr
Total:               43.67s, 184ginstr
```
After:
```
> $ ./target/release/rust-analyzer -q analysis-stats --with-proc-macro --load-output-dirs .
Database loaded:     1.09s, 277minstr
  crates: 34, mods: 688, decls: 14790, fns: 11006
Item Collection:     18.20s, 78ginstr
  exprs: 297826, ??ty: 493 (0%), ?ty: 558 (0%), !ty: 342
Inference:           28.34s, 111ginstr
Total:               46.54s, 190ginstr
```

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
3 years agoEnable attribute macro expansion in `analysis-stats`
Florian Diebold [Sat, 5 Jun 2021 09:29:24 +0000 (11:29 +0200)]
Enable attribute macro expansion in `analysis-stats`

Before:
```
> $ rust-analyzer -q analysis-stats --with-proc-macro --load-output-dirs .
Database loaded:     19.08s, 277minstr
  crates: 34, mods: 688, decls: 13202, fns: 10412
Item Collection:     16.21s, 76ginstr
  exprs: 290580, ??ty: 2508 (0%), ?ty: 1814 (0%), !ty: 947
Inference:           27.46s, 108ginstr
Total:               43.67s, 184ginstr
```
After:
```
> $ ./target/release/rust-analyzer -q analysis-stats --with-proc-macro --load-output-dirs .
Database loaded:     1.09s, 277minstr
  crates: 34, mods: 688, decls: 14790, fns: 11006
Item Collection:     18.20s, 78ginstr
  exprs: 297826, ??ty: 493 (0%), ?ty: 558 (0%), !ty: 342
Inference:           28.34s, 111ginstr
Total:               46.54s, 190ginstr
```

3 years agoAdd assist for converting a tuple enum variant to a named variant
Joshua Warner [Sat, 5 Jun 2021 04:48:32 +0000 (21:48 -0700)]
Add assist for converting a tuple enum variant to a named variant

3 years agoComplete third-party attributes
Lukas Wirth [Fri, 4 Jun 2021 19:07:19 +0000 (21:07 +0200)]
Complete third-party attributes

3 years agoRender documentation for derive completion
Lukas Wirth [Fri, 4 Jun 2021 18:25:16 +0000 (20:25 +0200)]
Render documentation for derive completion

3 years agoMerge #9141
bors[bot] [Fri, 4 Jun 2021 18:44:22 +0000 (18:44 +0000)]
Merge #9141

9141: fix: Don't inline mutable locals in 'inline_local_variable' r=Veykril a=Veykril

Fixes #9139

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoDon't inline mutable locals in 'inline_local_variable'
Lukas Wirth [Fri, 4 Jun 2021 18:36:43 +0000 (20:36 +0200)]
Don't inline mutable locals in 'inline_local_variable'

3 years agoMerge #9138
bors[bot] [Fri, 4 Jun 2021 17:45:37 +0000 (17:45 +0000)]
Merge #9138

9138: feat: Implement hover for lints r=Veykril a=Veykril

fixes https://github.com/rust-analyzer/rust-analyzer/issues/8857, fixes https://github.com/rust-analyzer/rust-analyzer/issues/3941

![URXBanNxYe](https://user-images.githubusercontent.com/3757771/120830905-4bd8da80-c55f-11eb-9f55-ff5a321726fa.gif)

We also generate the default lints(and lint groups ðŸŽ‰) instead now by invoking `rustc -W help` and parsing the output from that.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoExclude `crates/ide_db/src/helpers/generated_lints.rs` from `tidy::check_todo`
Lukas Wirth [Fri, 4 Jun 2021 17:18:45 +0000 (19:18 +0200)]
Exclude `crates/ide_db/src/helpers/generated_lints.rs` from `tidy::check_todo`

3 years agoReplace `-` with `_` in generated lint names
Lukas Wirth [Fri, 4 Jun 2021 17:03:45 +0000 (19:03 +0200)]
Replace `-` with `_` in generated lint names

3 years agoGenerate default lint groups
Lukas Wirth [Fri, 4 Jun 2021 16:55:08 +0000 (18:55 +0200)]
Generate default lint groups

3 years agoGenerate default lint completions
Lukas Wirth [Fri, 4 Jun 2021 16:35:19 +0000 (18:35 +0200)]
Generate default lint completions

3 years agoImplement hover for lints
Lukas Wirth [Fri, 4 Jun 2021 15:03:18 +0000 (17:03 +0200)]
Implement hover for lints

3 years agoMerge #9137
bors[bot] [Fri, 4 Jun 2021 14:51:39 +0000 (14:51 +0000)]
Merge #9137

9137: fix: fix incorrect "unresolved import" error when using derive helpers r=jonas-schievink a=jonas-schievink

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

cursed bug

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoReturn `ReachedFixedPoint::No` when resolving derive helper
Jonas Schievink [Fri, 4 Jun 2021 14:50:35 +0000 (16:50 +0200)]
Return `ReachedFixedPoint::No` when resolving derive helper

3 years agoMerge #9136
bors[bot] [Fri, 4 Jun 2021 13:55:49 +0000 (13:55 +0000)]
Merge #9136

9136: feat: Add function references hover action r=Veykril a=Veykril

![image](https://user-images.githubusercontent.com/3757771/120811670-8422ed80-c54c-11eb-87f5-dd65c1f8ef7d.png)
This is off by default as this can slow down hover messages significantly for very big projects I believe.
Fixes #6590
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoAdd function references hover action
Lukas Wirth [Fri, 4 Jun 2021 13:49:43 +0000 (15:49 +0200)]
Add function references hover action

3 years agoMerge #9135
bors[bot] [Fri, 4 Jun 2021 12:10:21 +0000 (12:10 +0000)]
Merge #9135

9135: Reorganize inlay_hints tests r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoCleanup parameter_hint_heuristics inlay hints test
Lukas Wirth [Fri, 4 Jun 2021 12:09:20 +0000 (14:09 +0200)]
Cleanup parameter_hint_heuristics inlay hints test

3 years agoReorganize inlay_hints tests
Lukas Wirth [Fri, 4 Jun 2021 11:47:39 +0000 (13:47 +0200)]
Reorganize inlay_hints tests

3 years agoMerge #9128
bors[bot] [Thu, 3 Jun 2021 16:17:25 +0000 (16:17 +0000)]
Merge #9128

9128: feat: expand procedural attribute macros r=jonas-schievink a=jonas-schievink

This adds experimental support for attribute macros. They can be enabled by setting `rust-analyzer.experimental.procAttrMacros` to `true`.

Known issues:
* Tokens aren't remapped, presumably because we edit the input syntax tree (this causes IDE features to not work inside items with attribute macros on them)
* Macro errors aren't reported correctly

Closes https://github.com/rust-analyzer/rust-analyzer/issues/8971
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/8964 / https://github.com/la10736/rstest/issues/120
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/2984
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/5412
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6029
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6687

https://github.com/rust-analyzer/rust-analyzer/issues/6740 is still not fixed â€“ we now expand `#[proc_macro_hack]`, but fail to expand the resulting `proc_macro_call!()` macro.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoSet enable_proc_attr_macros in hir_ty TestDB
Jonas Schievink [Thu, 3 Jun 2021 16:11:33 +0000 (18:11 +0200)]
Set enable_proc_attr_macros in hir_ty TestDB

3 years agoUpdate list of built-in attributes
Jonas Schievink [Thu, 3 Jun 2021 16:06:17 +0000 (18:06 +0200)]
Update list of built-in attributes

3 years agoMake it opt-in
Jonas Schievink [Thu, 3 Jun 2021 14:11:20 +0000 (16:11 +0200)]
Make it opt-in

3 years agoExpand procedural attribute macros
Jonas Schievink [Mon, 31 May 2021 11:37:11 +0000 (13:37 +0200)]
Expand procedural attribute macros

3 years agoMerge #9130
bors[bot] [Thu, 3 Jun 2021 14:26:07 +0000 (14:26 +0000)]
Merge #9130

9130: Prefix/suffix parameter inlay hint hiding heuristic is more strict r=Veykril a=Veykril

Instead of just plainly checking prefix/suffix of the argument string to the parameter name we only check for prefixes and suffixes if they are split apart via an underscore meaning, with the argument `foo`, it will be hidden for the parameter name `foo_bar` but not for `foobar`.

bors r+
Closes https://github.com/rust-analyzer/rust-analyzer/issues/8878

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoPrefix/suffix parameter inlay hint hiding heuristic is more strict
Lukas Wirth [Thu, 3 Jun 2021 14:22:24 +0000 (16:22 +0200)]
Prefix/suffix parameter inlay hint hiding heuristic is more strict

3 years agoMerge #9129
bors[bot] [Thu, 3 Jun 2021 13:45:17 +0000 (13:45 +0000)]
Merge #9129

9129: NFC: remove redundant clones (clippy::perf) r=Veykril a=matthiaskrgr

Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
3 years agoNFC: remove redundant clones (clippy::perf)
Matthias Krüger [Thu, 3 Jun 2021 13:32:46 +0000 (15:32 +0200)]
NFC: remove redundant clones (clippy::perf)

3 years agoMerge #9127
bors[bot] [Thu, 3 Jun 2021 12:27:57 +0000 (12:27 +0000)]
Merge #9127

9127: internal: make variant fields inherit the enum's visibility in the ItemTree r=jonas-schievink a=jonas-schievink

No observable changes from what I can tell, but this is "more correct".

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoItemTree: make variant fields inherit the enum's visibility
Jonas Schievink [Thu, 3 Jun 2021 12:26:26 +0000 (14:26 +0200)]
ItemTree: make variant fields inherit the enum's visibility

3 years agoMerge #9124
bors[bot] [Thu, 3 Jun 2021 12:09:10 +0000 (12:09 +0000)]
Merge #9124

9124: Apply a few clippy suggestions r=lnicola a=clemenswasser

Co-authored-by: Clemens Wasser <clemens.wasser@gmail.com>
3 years agoMerge #9104
bors[bot] [Thu, 3 Jun 2021 11:52:15 +0000 (11:52 +0000)]
Merge #9104

9104: Implement `#[rustc_skip_array_during_method_dispatch]` r=flodiebold a=jonas-schievink

haxx run the world

Closes https://github.com/rust-analyzer/rust-analyzer/issues/8552
Part of https://github.com/rust-analyzer/rust-analyzer/issues/9056

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoAdd comment
Jonas Schievink [Thu, 3 Jun 2021 11:51:43 +0000 (13:51 +0200)]
Add comment

3 years agoUse push_str
Clemens Wasser [Thu, 3 Jun 2021 11:01:16 +0000 (13:01 +0200)]
Use push_str

3 years agoApply more clippy suggestions and update generated
Clemens Wasser [Thu, 3 Jun 2021 10:46:56 +0000 (12:46 +0200)]
Apply more clippy suggestions and update generated

3 years agoMerge #9105
bors[bot] [Thu, 3 Jun 2021 09:55:37 +0000 (09:55 +0000)]
Merge #9105

9105: internal: calculate pattern adjustments r=flodiebold a=iDawer

This extends `InferenceResult` with `pub pat_adjustments: FxHashMap<PatId, Vec<Ty>>`.

Fixes #9095

Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
3 years agoApply a few clippy suggestions
Clemens Wasser [Thu, 3 Jun 2021 09:45:10 +0000 (11:45 +0200)]
Apply a few clippy suggestions

3 years agoMerge #9123
bors[bot] [Thu, 3 Jun 2021 08:24:56 +0000 (08:24 +0000)]
Merge #9123

9123: manual.adoc: add Gentoo Linux installation method r=lnicola a=mjkalyan

Added installation instructions for the binary ebuild of the "latest" `rust-analyzer` in Gentoo's GURU repository.

Co-authored-by: mjkalyan <34904034+mjkalyan@users.noreply.github.com>
3 years agomanual.adoc: add Gentoo Linux installation method
mjkalyan [Thu, 3 Jun 2021 06:16:23 +0000 (00:16 -0600)]
manual.adoc: add Gentoo Linux installation method

Added installation instructions for the binary ebuild of the "latest" `rust-analyzer` in Gentoo's GURU repository.

3 years agoMerge #9119
bors[bot] [Wed, 2 Jun 2021 20:28:15 +0000 (20:28 +0000)]
Merge #9119

9119: fix: some minor "extract type alias" fixes r=jonas-schievink a=jonas-schievink

It now correctly works inside traits, and no longer messes up the indentation of the original node

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoPreserve indentation
Jonas Schievink [Wed, 2 Jun 2021 20:27:12 +0000 (22:27 +0200)]
Preserve indentation

3 years agoAccount for traits
Jonas Schievink [Wed, 2 Jun 2021 20:20:41 +0000 (22:20 +0200)]
Account for traits

3 years agoMerge #9118
bors[bot] [Wed, 2 Jun 2021 20:12:10 +0000 (20:12 +0000)]
Merge #9118

9118: Document that `addCallArgumentSnippets` requires `addCallParenthesis r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoDocument that `addCallArgumentSnippets` requires `addCallParenthesis
Lukas Wirth [Wed, 2 Jun 2021 20:10:09 +0000 (22:10 +0200)]
Document that `addCallArgumentSnippets` requires `addCallParenthesis

3 years agoMerge #9117
bors[bot] [Wed, 2 Jun 2021 19:43:29 +0000 (19:43 +0000)]
Merge #9117

9117: Allow expand-macro to be invoked anywhere inside a macro call r=Veykril a=Veykril

I don't really see a reason to only limit this to the name-ref of a macro.
bors r+
Closes #4606

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoAllow expand-macro to be invoked anywhere inside a macro call
Lukas Wirth [Wed, 2 Jun 2021 19:39:53 +0000 (21:39 +0200)]
Allow expand-macro to be invoked anywhere inside a macro call

3 years agoMerge #9114
bors[bot] [Wed, 2 Jun 2021 18:01:42 +0000 (18:01 +0000)]
Merge #9114

9114: Fix bind patterns always being treated as ref taking patterns r=Veykril a=Veykril

Fixes #9107
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoFix bind patterns always being treated as ref taking patterns
Lukas Wirth [Wed, 2 Jun 2021 18:00:39 +0000 (20:00 +0200)]
Fix bind patterns always being treated as ref taking patterns

3 years agoMerge #9108
bors[bot] [Wed, 2 Jun 2021 17:25:11 +0000 (17:25 +0000)]
Merge #9108

9108: Don't show extract into variable assist for unit expressions r=jonas-schievink a=brandondong

**Reproduction:**

```rust
fn main() {
    let mut i = 3;
    $0if i >= 0 {
        i += 1;
    } else {
        i -= 1;
    }$0
}
```

1. Select the snippet of code between the $0's.
2. The extract into variable assist shows up, pushing down the more useful extract into function assist.
3. The resulting output of selecting the extract into variable assist is valid but with the extracted variable having the unit type:
```rust
fn main() {
    let mut i = 3;
    let var_name = if i >= 0 {
        i += 1;
    } else {
        i -= 1;
    };
    var_name
}
```

**Fix:**
- Don't show the extract into variable assist for unit expressions. I could not think of any scenarios where such a variable extraction would be desired.

Co-authored-by: Brandon <brandondong604@hotmail.com>
3 years agoMerge #9112
bors[bot] [Wed, 2 Jun 2021 16:18:42 +0000 (16:18 +0000)]
Merge #9112

9112: Fix some bugs in `extract_struct_from_enum_variant` assist r=Veykril a=Veykril

bors r+
Fixes #9100
Fixes #9099
Kind of fixes  #9109, it now copies all the generics might be incorrect if the variant doesn't use all of them)

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>