]> git.lizzy.rs Git - rust.git/log
rust.git
22 months agofeat: Add a "Unmerge match arm" assist to split or-patterns inside match expressions
Chayim Refael Friedman [Tue, 30 Aug 2022 09:42:12 +0000 (09:42 +0000)]
feat: Add a "Unmerge match arm" assist to split or-patterns inside match expressions

22 months agoAuto merge of #13133 - Veykril:diag-hack, r=Veykril
bors [Sun, 28 Aug 2022 09:56:06 +0000 (09:56 +0000)]
Auto merge of #13133 - Veykril:diag-hack, r=Veykril

Move empty diagnostics workaround back into the server

This only touches on the diagnostics in one place instead of multiple as was previously done, since all published diagnostics will go through this code path anyways.

Closes https://github.com/rust-lang/rust-analyzer/issues/13130

22 months agoMove empty diagnostics workaround back into the server
Lukas Wirth [Sun, 28 Aug 2022 09:54:46 +0000 (11:54 +0200)]
Move empty diagnostics workaround back into the server

22 months agoAuto merge of #13095 - jonas-schievink:avoid-liveshare-error, r=jonas-schievink
bors [Fri, 26 Aug 2022 18:39:53 +0000 (18:39 +0000)]
Auto merge of #13095 - jonas-schievink:avoid-liveshare-error, r=jonas-schievink

fix: Avoid error popup when using in Live Share

cc https://github.com/rust-lang/rust-analyzer/issues/8844

Not sure if there's a better way to do this, feedback appreciated!

22 months agoAuto merge of #13123 - Veykril:simplify, r=Veykril
bors [Fri, 26 Aug 2022 17:40:56 +0000 (17:40 +0000)]
Auto merge of #13123 - Veykril:simplify, r=Veykril

minor: Simplify

22 months agominor: Simplify
Lukas Wirth [Fri, 26 Aug 2022 17:40:01 +0000 (19:40 +0200)]
minor: Simplify

22 months agoAuto merge of #13087 - Veykril:config-update, r=Veykril
bors [Fri, 26 Aug 2022 16:22:57 +0000 (16:22 +0000)]
Auto merge of #13087 - Veykril:config-update, r=Veykril

Remove auto-config patching from the VSCode client

This was introduced 4 months ago when we drastically changed the config keys. I'd like to remove this given I always felt uneasy doing edits to a users config from within r-a, and by now most if not all users should've swapped to a new enough version of r-a that should've updated their configs.

The extension will continue to work fine even with the outdated keys afterwards since we still do patching server side as well, and that one we'll have to support for quite some more time (if not until a proper 1.0 release where I assume we can allow ourselves some more user facing breakage)

(There also might've been a small bug in here that prevented users with certain outdated keys to prevent them from enabling certain keys for some reason)

22 months agoAuto merge of #13110 - DesmondWillowbrook:issue-11197, r=jonas-schievink
bors [Fri, 26 Aug 2022 13:35:13 +0000 (13:35 +0000)]
Auto merge of #13110 - DesmondWillowbrook:issue-11197, r=jonas-schievink

fix: make "Extract type as type alias" assist work with const generics in array

fixes #11197

22 months agoAuto merge of #13116 - Veykril:nohash, r=Veykril
bors [Thu, 25 Aug 2022 19:08:57 +0000 (19:08 +0000)]
Auto merge of #13116 - Veykril:nohash, r=Veykril

Make use of NoHash hashing for FileId and CrateId

Both of these are mere integers so there is nothing to hash here.

Ideally we would use this for `la_arena::Idx` too, but that doesn't work due to the orphan rule, and `la_arena` is unfortunately a public library so we can't really do much here... Unless we remove the trait restriction but I'd like not to

22 months agoUpdate test fixtures
Lukas Wirth [Thu, 25 Aug 2022 19:06:35 +0000 (21:06 +0200)]
Update test fixtures

22 months agoAuto merge of #13118 - lnicola:cleanup, r=lnicola
bors [Thu, 25 Aug 2022 19:00:07 +0000 (19:00 +0000)]
Auto merge of #13118 - lnicola:cleanup, r=lnicola

minor: Remove unused UpdatesChannel type

22 months agoRemove u/i128 hashing overloads from NoHashHasher::Hasher impl
Lukas Wirth [Thu, 25 Aug 2022 18:43:53 +0000 (20:43 +0200)]
Remove u/i128 hashing overloads from NoHashHasher::Hasher impl

22 months agoMake use of NoHash hashing for FileId and CrateId
Lukas Wirth [Thu, 25 Aug 2022 18:31:02 +0000 (20:31 +0200)]
Make use of NoHash hashing for FileId and CrateId

22 months agoRemove unused UpdatesChannel type
Laurențiu Nicola [Thu, 25 Aug 2022 18:33:42 +0000 (21:33 +0300)]
Remove unused UpdatesChannel type

22 months agostyle: run tidy tests
Kartavya Vashishtha [Thu, 25 Aug 2022 07:47:50 +0000 (13:17 +0530)]
style: run tidy tests

22 months agoextract const generic in ArrayType
Kartavya Vashishtha [Thu, 25 Aug 2022 07:41:51 +0000 (13:11 +0530)]
extract const generic in ArrayType

22 months agoadd test
Kartavya Vashishtha [Thu, 25 Aug 2022 07:41:14 +0000 (13:11 +0530)]
add test

22 months agoAuto merge of #13101 - Veykril:sem-tokens, r=jonas-schievink
bors [Tue, 23 Aug 2022 16:24:39 +0000 (16:24 +0000)]
Auto merge of #13101 - Veykril:sem-tokens, r=jonas-schievink

internal: Re-export standard semantic token types and mods

Should help in preventing future occurences of #13099 by having all token types and mods come through the same place

22 months agoRe-export standard semantic token types and mods
Lukas Wirth [Tue, 23 Aug 2022 16:06:32 +0000 (18:06 +0200)]
Re-export standard semantic token types and mods

22 months agoAuto merge of #13100 - jonas-schievink:doc-links-on-impl, r=jonas-schievink
bors [Tue, 23 Aug 2022 15:57:12 +0000 (15:57 +0000)]
Auto merge of #13100 - jonas-schievink:doc-links-on-impl, r=jonas-schievink

fix: Resolve doc links on impl blocks

Fixes https://github.com/rust-lang/rust-analyzer/issues/13089

22 months agoResolve doc links on impl blocks
Jonas Schievink [Tue, 23 Aug 2022 15:50:45 +0000 (17:50 +0200)]
Resolve doc links on impl blocks

22 months agoAuto merge of #13099 - jonas-schievink:add-decorator-token, r=jonas-schievink
bors [Tue, 23 Aug 2022 15:47:21 +0000 (15:47 +0000)]
Auto merge of #13099 - jonas-schievink:add-decorator-token, r=jonas-schievink

fix: Register decorator token type to avoid panic

Followup to https://github.com/rust-lang/rust-analyzer/pull/13084

22 months agoRegister decorator token type to avoid panic
Jonas Schievink [Tue, 23 Aug 2022 15:46:29 +0000 (17:46 +0200)]
Register decorator token type to avoid panic

22 months agoAuto merge of #13097 - jonas-schievink:liveshare-docs, r=jonas-schievink
bors [Tue, 23 Aug 2022 14:48:28 +0000 (14:48 +0000)]
Auto merge of #13097 - jonas-schievink:liveshare-docs, r=jonas-schievink

minor: Add a short blurb about VS Code Live Share to the manual

22 months agoAdd a short blurb about VS Code Live Share to the manual
Jonas Schievink [Tue, 23 Aug 2022 14:47:26 +0000 (16:47 +0200)]
Add a short blurb about VS Code Live Share to the manual

22 months agoAuto merge of #13096 - jonas-schievink:parse-more-or-pats, r=jonas-schievink
bors [Tue, 23 Aug 2022 14:35:03 +0000 (14:35 +0000)]
Auto merge of #13096 - jonas-schievink:parse-more-or-pats, r=jonas-schievink

fix: Allow leading `|` in more pattern positions

fixes https://github.com/rust-lang/rust-analyzer/issues/12894, fixes https://github.com/rust-lang/rust-analyzer/issues/13094

Oddly, the leading `|` token does not end up inside the `OR_PAT` node, since `pattern_top_r` consumes it first. This is a preexisting issue in match arms though, so I didn't fix it here.

22 months agoAllow leading `|` in more pattern positions
Jonas Schievink [Tue, 23 Aug 2022 14:31:59 +0000 (16:31 +0200)]
Allow leading `|` in more pattern positions

22 months agoForGoT tO RuN prEttIeR¿
Jonas Schievink [Tue, 23 Aug 2022 13:56:02 +0000 (15:56 +0200)]
ForGoT tO RuN prEttIeR¿

22 months agoAvoid error popup when using in Live Share
Jonas Schievink [Tue, 23 Aug 2022 13:45:02 +0000 (15:45 +0200)]
Avoid error popup when using in Live Share

22 months agoAuto merge of #13084 - Veykril:highlight-config, r=Veykril
bors [Tue, 23 Aug 2022 12:39:57 +0000 (12:39 +0000)]
Auto merge of #13084 - Veykril:highlight-config, r=Veykril

Add some more highlighting configurations

The following can be enabled/disabled now in terms of highlighting:
- doc comment injection (enabled by default)
- punctuation highlighting (disabled by default)
- operator highlighting (enabled by default)
- punctuation specialized highlighting (disabled by default)
- operator specialized highlighting (disabled by default)
- macro call bang highlighting (disabled by default)

This PR also changes our `attribute` semantic token type to the `decorator` type which landed upstream (but not yet in lsp-types).

Specialized highlighting is disabled by default, as all clients will have to ship something to map these back to the standard punctuation/operator token (we do this in VSCode via the inheritance mapping for example). This is a lot of maintenance work, and not something every client wants to do, pushing that need to use the user. As this is a rather niche use in the first place this will just be disabled by default.

Punctuation highlighting is disabled by default, punctuation is usually something that can be done by the native syntactic highlighting of the client, so there is no loss in quality. The main reason for this though is that punctuation adds a lot of extra token data that we sent over, a lot of clients struggle with applying this, so disabling this improves the UX for a lot of people. Note that we still highlight punctuations with special meaning as that special entity, (the never type `!` will still be tagged as a builtin type if it occurs as such)

Separate highlighting of the macro call bang `!` is disabled by default, as I think people actually didn't like that change that much, though at the same time I feel like not many people even noticed that change (I prefer it be separate, but that's not enough reason for it to be enabled by default I believe :^) )

cc https://github.com/rust-lang/rust-analyzer/issues/12783 https://github.com/rust-lang/rust-analyzer/issues/13066

22 months agoAuto merge of #13092 - Veykril:ref-match-completion, r=Veykril
bors [Tue, 23 Aug 2022 12:30:50 +0000 (12:30 +0000)]
Auto merge of #13092 - Veykril:ref-match-completion, r=Veykril

fix: Fix reference autocompletions using incorrect offsets in macro inputs

Fixes https://github.com/rust-lang/rust-analyzer/issues/13035

22 months agofix: Fix reference autocompletions using incorrect offsets in macro inputs
Lukas Wirth [Tue, 23 Aug 2022 12:29:59 +0000 (14:29 +0200)]
fix: Fix reference autocompletions using incorrect offsets in macro inputs

Fixes https://github.com/rust-lang/rust-analyzer/issues/13035

22 months agoUse lsp-types DECORATOR token type
Lukas Wirth [Tue, 23 Aug 2022 12:00:29 +0000 (14:00 +0200)]
Use lsp-types DECORATOR token type

22 months agoRemove unused default semantic modifiers
Lukas Wirth [Mon, 22 Aug 2022 12:53:05 +0000 (14:53 +0200)]
Remove unused default semantic modifiers

22 months agoRegen docs
Lukas Wirth [Mon, 22 Aug 2022 12:15:09 +0000 (14:15 +0200)]
Regen docs

22 months agoAdd config for macro bang token highlighting, disable by default
Lukas Wirth [Mon, 22 Aug 2022 12:09:38 +0000 (14:09 +0200)]
Add config for macro bang token highlighting, disable by default

22 months agoChange attribute semantic token type to decorator
Lukas Wirth [Mon, 22 Aug 2022 11:55:44 +0000 (13:55 +0200)]
Change attribute semantic token type to decorator

22 months agoMake doc comment highlight injection configurable
Lukas Wirth [Mon, 22 Aug 2022 11:44:07 +0000 (13:44 +0200)]
Make doc comment highlight injection configurable

22 months agoMove highlight configuration from protocol into the feature
Lukas Wirth [Mon, 22 Aug 2022 11:38:35 +0000 (13:38 +0200)]
Move highlight configuration from protocol into the feature

22 months agoMake operator highlighting configurable, disable it by default
Lukas Wirth [Mon, 22 Aug 2022 11:21:30 +0000 (13:21 +0200)]
Make operator highlighting configurable, disable it by default

22 months agoMake punctuation highlighting configurable, disable it by default
Lukas Wirth [Mon, 22 Aug 2022 11:15:42 +0000 (13:15 +0200)]
Make punctuation highlighting configurable, disable it by default

22 months agoAuto merge of #13090 - ice1k:master, r=Veykril
bors [Tue, 23 Aug 2022 08:08:45 +0000 (08:08 +0000)]
Auto merge of #13090 - ice1k:master, r=Veykril

Do not substitute `Self` when in same impl block

Fix #13076

22 months agoAuto merge of #12976 - tjdevries:scip, r=Veykril
bors [Tue, 23 Aug 2022 07:53:36 +0000 (07:53 +0000)]
Auto merge of #12976 - tjdevries:scip, r=Veykril

feat: emit SCIP from rust-analyzer

hi rust-analyzer team

I'm one of the engineers at Sourcegraph (and have done a few small changes related to the LSIF work done in rust-analyzer). Recently, we've moved to a new protocol as the primary way to interact with Sourcegraph (LSIF is still possible to upload, so existing jobs will not stop working any time soon). This new protocol is SCIP (I linked a blog post below with more information).

I've implemented SCIP support (based largely on the existing LSIF support). In addition to supporting the existing features that `rust-analyzer`'s LSIF support does, this PR adds the ability to move between crates on sourcegraph.com. So if both your project and a dependency are indexed, you would be able to hop to the particular version and view the source code. I'd be happy to record a demo of that on my local instance if you're interested.

There are a few TODO's left in the code (some that you might have insights on) which I'm happy to fix in this PR, but I just wanted to open this up for discussion first.

Thanks for your time :)

TJ

- [announcing scip](https://about.sourcegraph.com/blog/announcing-scip)

22 months agoDo not substitute `Self` when in same impl block
ice1000 [Tue, 23 Aug 2022 04:55:05 +0000 (04:55 +0000)]
Do not substitute `Self` when in same impl block

22 months agofeat: emit SCIP via rust-analyzer
TJ DeVries [Sat, 11 Jun 2022 01:29:04 +0000 (21:29 -0400)]
feat: emit SCIP via rust-analyzer

22 months agoAuto merge of #13088 - Veykril:flycheck-failure, r=Veykril
bors [Mon, 22 Aug 2022 15:43:13 +0000 (15:43 +0000)]
Auto merge of #13088 - Veykril:flycheck-failure, r=Veykril

Pop an error notification when flycheck can't be restarted

22 months agoPop an error notification when flycheck can't be restarted
Lukas Wirth [Mon, 22 Aug 2022 15:42:33 +0000 (17:42 +0200)]
Pop an error notification when flycheck can't be restarted

22 months agoRemove auto-config patching from the VSCode client
Lukas Wirth [Mon, 22 Aug 2022 15:13:49 +0000 (17:13 +0200)]
Remove auto-config patching from the VSCode client

22 months agoAuto merge of #13021 - N3xed:fix-gat-panics, r=flodiebold
bors [Mon, 22 Aug 2022 14:00:23 +0000 (14:00 +0000)]
Auto merge of #13021 - N3xed:fix-gat-panics, r=flodiebold

fix: Fix panics on GATs involving const generics

This workaround avoids constant crashing of rust analyzer when using GATs with const generics,
even when the const generics are only on the `impl` block.

The workaround treats GATs as non-existing if either itself or the parent has const generics and
removes relevant panicking code-paths.

Fixes #11989, fixes #12193

22 months agoAuto merge of #13001 - Veykril:scoped, r=Veykril
bors [Mon, 22 Aug 2022 12:56:06 +0000 (12:56 +0000)]
Auto merge of #13001 - Veykril:scoped, r=Veykril

Replace crossbeam with std's scoped threads

Probably best to wait a week or two so we don't immediately give linux packagers problems again

22 months agoReplace crossbeam with std's scoped threads
Lukas Wirth [Thu, 11 Aug 2022 15:12:25 +0000 (17:12 +0200)]
Replace crossbeam with std's scoped threads

22 months agoAuto merge of #12965 - DesmondWillowbrook:assoc-method-dimming, r=Veykril
bors [Mon, 22 Aug 2022 07:20:56 +0000 (07:20 +0000)]
Auto merge of #12965 - DesmondWillowbrook:assoc-method-dimming, r=Veykril

feat: make trait assoc items become inactive due to cfg

fixes #12394

22 months agoAuto merge of #13078 - pymongo:master, r=Veykril
bors [Mon, 22 Aug 2022 06:18:26 +0000 (06:18 +0000)]
Auto merge of #13078 - pymongo:master, r=Veykril

internal: remove unnecessary stream writer try_clone in lsp-server

22 months agointernal: remove unnecessary stream writer try_clone in lsp-server
wuaoxiang [Mon, 22 Aug 2022 03:25:21 +0000 (11:25 +0800)]
internal: remove unnecessary stream writer try_clone in lsp-server

22 months agoExpect the test to panic by catching the unwind
Dominik Gschwind [Sun, 21 Aug 2022 20:48:53 +0000 (22:48 +0200)]
Expect the test to panic by catching the unwind

22 months agoAuto merge of #13074 - lowr:fix/method-resolution-with-impl-predicate, r=lowr
bors [Sun, 21 Aug 2022 12:21:33 +0000 (12:21 +0000)]
Auto merge of #13074 - lowr:fix/method-resolution-with-impl-predicate, r=lowr

Consider bounds on inherent impl in method resolution

There are three type-related things we should consider in method resolution: `Self` type, receiver type, and impl bounds. While we check the first two and impl bounds on trait impls, we've been ignoring the impl bounds on inherent impls. With this patch rust-analyzer now takes them into account and is able to select the appropriate inherent method.

Resolves #5441
Resolves #12308

22 months agoAuto merge of #13071 - lnicola:ubuntu-20.04, r=lnicola
bors [Sun, 21 Aug 2022 11:24:38 +0000 (11:24 +0000)]
Auto merge of #13071 - lnicola:ubuntu-20.04, r=lnicola

internal: Build release binaries on `ubuntu-20.04`

Ubuntu 18.04 is still available until December 1st, but will start failing from time to time, which is not something we want when building nightlies.

22 months agoConsider bounds on inherent impl in method resolution
Ryo Yoshida [Sat, 20 Aug 2022 11:12:23 +0000 (20:12 +0900)]
Consider bounds on inherent impl in method resolution

22 months agoSwitch to ubuntu-20.04 runners
Laurențiu Nicola [Sat, 20 Aug 2022 14:21:54 +0000 (17:21 +0300)]
Switch to ubuntu-20.04 runners

22 months agofix: formatting
Kartavya Vashishtha [Sat, 20 Aug 2022 08:14:01 +0000 (13:44 +0530)]
fix: formatting

22 months agoremove push_diagnostic methods
Kartavya Vashishtha [Sat, 20 Aug 2022 08:00:25 +0000 (13:30 +0530)]
remove push_diagnostic methods
weren't used in the end

22 months agomake impl and trait inactive diagnostics work
Kartavya Vashishtha [Sat, 20 Aug 2022 07:58:43 +0000 (13:28 +0530)]
make impl and trait inactive diagnostics work

22 months agoAuto merge of #13069 - lnicola:bump-deps, r=lnicola
bors [Fri, 19 Aug 2022 18:37:54 +0000 (18:37 +0000)]
Auto merge of #13069 - lnicola:bump-deps, r=lnicola

minor: Bump deps

22 months agoBump notify
Laurențiu Nicola [Fri, 19 Aug 2022 18:37:05 +0000 (21:37 +0300)]
Bump notify

22 months agoBump chalk
Laurențiu Nicola [Fri, 19 Aug 2022 18:33:28 +0000 (21:33 +0300)]
Bump chalk

22 months agoBump deps
Laurențiu Nicola [Fri, 19 Aug 2022 18:22:43 +0000 (21:22 +0300)]
Bump deps

22 months agoAuto merge of #13065 - RalfJung:override-command-docs, r=Veykril
bors [Fri, 19 Aug 2022 14:52:26 +0000 (14:52 +0000)]
Auto merge of #13065 - RalfJung:override-command-docs, r=Veykril

document interaction of checkOnSave.overrideCommand and multiple linked projects

Cc https://github.com/rust-lang/rust-analyzer/issues/10793

r? `@Veykril`

22 months agoexplain how to re-generate the package.json
Ralf Jung [Fri, 19 Aug 2022 12:58:08 +0000 (08:58 -0400)]
explain how to re-generate the package.json

22 months agodocument interaction of checkOnSave.overrideCommand and multiple linked projects
Ralf Jung [Fri, 19 Aug 2022 12:23:58 +0000 (08:23 -0400)]
document interaction of checkOnSave.overrideCommand and multiple linked projects

22 months agoAuto merge of #13041 - DorianListens:dscheidt/gen-fn-self-assoc-2, r=Veykril
bors [Fri, 19 Aug 2022 10:57:02 +0000 (10:57 +0000)]
Auto merge of #13041 - DorianListens:dscheidt/gen-fn-self-assoc-2, r=Veykril

feat: Generate static method using Self::assoc() syntax

This change improves the `generate_function` assist to support generating static methods/associated functions using the `Self::assoc()` syntax. Previously, one could generate a static method, but only when specifying the type name directly (like `Foo::assoc()`). After this change, `Self` is supported as well as the type name.

Fixes #13012

22 months agoAuto merge of #13061 - ice1k:master, r=Veykril
bors [Fri, 19 Aug 2022 10:47:15 +0000 (10:47 +0000)]
Auto merge of #13061 - ice1k:master, r=Veykril

feat: Improved inline_call to replace `Self`

Fixes #13060

22 months agoAuto merge of #13064 - Veykril:rustfmt-err, r=Veykril
bors [Fri, 19 Aug 2022 07:23:01 +0000 (07:23 +0000)]
Auto merge of #13064 - Veykril:rustfmt-err, r=Veykril

Log rustfmt parsing errors as warnings

We unconditionally pass an edition parameter to rustfmt, for some crates
this might fail rustfmt so instead of swallowing the error, at least Log
it on a level that is logged by default so users won't be completely
confused about it.
See for context https://github.com/rust-lang/rust-analyzer/issues/10209

Closes https://github.com/rust-lang/rust-analyzer/issues/10209

22 months agoLog rustfmt parsing errors as warnings
Lukas Wirth [Fri, 19 Aug 2022 07:19:02 +0000 (09:19 +0200)]
Log rustfmt parsing errors as warnings

We unconditionally pass an edition parameter to rustfmt, for some crates
this might fail rustfmt so instead of swallowing the error, at least Log
it on a level that is logged by default so users won't be completely
confused about it.
See for context https://github.com/rust-lang/rust-analyzer/issues/10209

Closes https://github.com/rust-lang/rust-analyzer/issues/10209

22 months agoAuto merge of #13063 - Veykril:stop-flycheck, r=Veykril
bors [Fri, 19 Aug 2022 06:58:52 +0000 (06:58 +0000)]
Auto merge of #13063 - Veykril:stop-flycheck, r=Veykril

Implement lsp extension for cancelling running flychecks

Fixes https://github.com/rust-lang/rust-analyzer/issues/4828

22 months agoImplement lsp extension for cancelling running flychecks
Lukas Wirth [Fri, 19 Aug 2022 06:52:31 +0000 (08:52 +0200)]
Implement lsp extension for cancelling running flychecks

22 months agofix: use functional programming
ice1000 [Fri, 19 Aug 2022 01:08:59 +0000 (01:08 +0000)]
fix: use functional programming

22 months agofeat: Improved inline_call to replace `Self`
ice1000 [Fri, 19 Aug 2022 01:06:00 +0000 (01:06 +0000)]
feat: Improved inline_call to replace `Self`

22 months agoIntroduce and use get_fn_target_info
Dorian Scheidt [Thu, 18 Aug 2022 23:39:42 +0000 (18:39 -0500)]
Introduce and use get_fn_target_info

22 months agoGenerate and use TargetInfo::new
Dorian Scheidt [Thu, 18 Aug 2022 23:32:35 +0000 (18:32 -0500)]
Generate and use TargetInfo::new

22 months agoCleanup inline
Dorian Scheidt [Thu, 18 Aug 2022 23:28:43 +0000 (18:28 -0500)]
Cleanup inline

22 months agoinline assoc_fn_target
Dorian Scheidt [Thu, 18 Aug 2022 23:28:14 +0000 (18:28 -0500)]
inline assoc_fn_target

22 months agoRemove mut out params via assoc_fn_target_info
Dorian Scheidt [Thu, 18 Aug 2022 23:26:54 +0000 (18:26 -0500)]
Remove mut out params via assoc_fn_target_info

22 months agoReorder args with flip_comma
Dorian Scheidt [Thu, 18 Aug 2022 23:21:58 +0000 (18:21 -0500)]
Reorder args with flip_comma

22 months agoReplace tuple with TargetInfo struct
Dorian Scheidt [Thu, 18 Aug 2022 23:20:06 +0000 (18:20 -0500)]
Replace tuple with TargetInfo struct

22 months agoextract fn_target_info
Dorian Scheidt [Thu, 18 Aug 2022 23:14:51 +0000 (18:14 -0500)]
extract fn_target_info

22 months agouse fn_name instead of name_ref.text()
Dorian Scheidt [Thu, 18 Aug 2022 23:12:53 +0000 (18:12 -0500)]
use fn_name instead of name_ref.text()

22 months agoRename static_method_target -> assoc_fn_target
Dorian Scheidt [Thu, 18 Aug 2022 23:10:37 +0000 (18:10 -0500)]
Rename static_method_target -> assoc_fn_target

22 months agoAuto merge of #13039 - davidbarsky:davidbarsky/remove-used-nightly-checking-code...
bors [Thu, 18 Aug 2022 16:06:18 +0000 (16:06 +0000)]
Auto merge of #13039 - davidbarsky:davidbarsky/remove-used-nightly-checking-code, r=Veykril

chore: remove unused `currentExtensionIsNightly()` in `config.ts`

I was debugging an unrelated issue in rust-analyzer, but came across this unused code and figured that it's fine to send a fully red PR :)

22 months agoAuto merge of #13053 - lowr:fix/pat-sole-Self, r=Veykril
bors [Thu, 18 Aug 2022 11:17:40 +0000 (11:17 +0000)]
Auto merge of #13053 - lowr:fix/pat-sole-Self, r=Veykril

fix: resolve path `Self` alone in value namespace

Fixes #12968

22 months agofix: resolve path `Self` alone in value namespace
Ryo Yoshida [Wed, 17 Aug 2022 23:46:06 +0000 (08:46 +0900)]
fix: resolve path `Self` alone in value namespace

22 months agoAuto merge of #13036 - sancho20021:10881-inline_type_alias_uses, r=Veykril
bors [Thu, 18 Aug 2022 08:02:37 +0000 (08:02 +0000)]
Auto merge of #13036 - sancho20021:10881-inline_type_alias_uses, r=Veykril

feat: Add an assist for inlining all type alias uses

## Description
`inline_type_alias_uses` assist tries to inline all selected type alias occurrences.

### Currently
Type alias used in `PathType` position are inlined.

### Not supported
- Removing type alias declaration if all uses are inlined.
- Removing redundant imports after inlining all uses in the file.
- Type alias not in `PathType` position, such as:
  - `A::new()`
  - `let x = A {}`
  - `let bits = A::BITS`
  - etc.

## Demonstration

![example](https://user-images.githubusercontent.com/45790125/184905226-9cb8ac81-1439-4387-a13b-e18ad4ecf208.gif)

## Related Issues
Partially fixes #10881

22 months agoAuto merge of #13045 - DorianListens:dscheidt/run-test-mod-outside, r=Veykril
bors [Thu, 18 Aug 2022 07:54:10 +0000 (07:54 +0000)]
Auto merge of #13045 - DorianListens:dscheidt/run-test-mod-outside, r=Veykril

feat: Run test mod from anywhere in parent file

The "Run" feature of rust-analyzer is super useful, especially for running
individual tests or test-modules during development.

One common pattern in rust development is to develop tests in the same file as
production code, inside a module (usually called `test` or `tests`) marked with
`#[cfg(test)]`.  Unforunately, this pattern is not well supported by r-a today,
as a test module won't show up as a runnable unless the cursor is inside it.

In my experience, it is quite common to want to run the tests associated with
some production code immediately after editing it, not only after editing the
tests themselves. As such it would be better if test modules were available
from the "Run" menu even when the cursor is outside the test module.

This change updates the filtration logic for runnables in
`handlers::handle_runnables` to special case `RunnableKind::TestMod`, making
test modules available regardless of the cursor location. Other `RunnableKind`s
are unnaffected.

Fixes #9589

22 months agoAuto merge of #12982 - jridgewell:into_future, r=Veykril
bors [Thu, 18 Aug 2022 07:37:47 +0000 (07:37 +0000)]
Auto merge of #12982 - jridgewell:into_future, r=Veykril

Implement IntoFuture type inference

One of my projects is using [IntoFuture](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) to make our async code a little less verbose. However, rust-analyzer can't infer the output type of an await expression if the value uses `IntoFuture` to convert into another type. So we're getting `{unknown}` types everywhere since switching.

`foo.await` itself [desugars](https://github.com/rust-lang/rust/blob/e4417cf020fbcd6182c11637bc6b8694434bd81a/compiler/rustc_ast_lowering/src/expr.rs#L644-L658) into a `match into_future(foo) {}`, with every `Future` impl getting a [default](https://github.com/rust-lang/rust/blob/e4417cf020fbcd6182c11637bc6b8694434bd81a/library/core/src/future/into_future.rs#L131-L139) `IntoFuture` implementation. I'm not sure if we want to disable the old `future_trait` paths, since this only recently [stabilize](https://github.com/rust-lang/rust/pull/98718).

22 months agoAuto merge of #13049 - lowr:fix/bare-dyn-assoc-type, r=Veykril
bors [Thu, 18 Aug 2022 07:29:16 +0000 (07:29 +0000)]
Auto merge of #13049 - lowr:fix/bare-dyn-assoc-type, r=Veykril

fix: resolve associated types of bare dyn types

Fixes #13031

We've been dropping the associated type bindings of trait object types that were written without the `dyn` keyword. This patch reuses the lowering logic for `TypeRef::DynTrait` so the associated type bindings are properly lowered.

22 months agofix: resolve associated types of bare dyn types
Ryo Yoshida [Wed, 17 Aug 2022 16:30:04 +0000 (01:30 +0900)]
fix: resolve associated types of bare dyn types

22 months agofeat: Run test mod from anywhere in parent file
Dorian Scheidt [Wed, 17 Aug 2022 16:57:14 +0000 (11:57 -0500)]
feat: Run test mod from anywhere in parent file

The "Run" feature of rust-analyzer is super useful, especially for running
individual tests or test-modules during development.

One common pattern in rust development is to develop tests in the same file as
production code, inside a module (usually called `test` or `tests`) marked with
`#[cfg(test)]`.  Unforunately, this pattern is not well supported by r-a today,
as a test module won't show up as a runnable unless the cursor is inside it.

In my experience, it is quite common to want to run the tests associated with
some production code immediately after editing it, not only after editing the
tests themselves. As such it would be better if test modules were available
from the "Run" menu even when the cursor is outside the test module.

This change updates the filtration logic for runnables in
`handlers::handle_runnables` to special case `RunnableKind::TestMod`, making
test modules available regardless of the cursor location. Other `RunnableKind`s
are unnaffected.

Fixes #9589

22 months agoAuto merge of #13044 - dzvon:fix-typo, r=Veykril
bors [Wed, 17 Aug 2022 14:59:02 +0000 (14:59 +0000)]
Auto merge of #13044 - dzvon:fix-typo, r=Veykril

fix: a bunch of typos

This PR will fix some typos detected by [typos].

There are also some other typos in the function names, variable names, and file
names, which I leave as they are. I'm more certain that typos in comments
should be fixed.

[typos]: https://github.com/crate-ci/typos

22 months agofix: a bunch of typos
Dezhi Wu [Wed, 17 Aug 2022 13:44:58 +0000 (21:44 +0800)]
fix: a bunch of typos

This PR will fix some typos detected by [typos].

There are also some other typos in the function names, variable names, and file
names, which I leave as they are. I'm more certain that typos in comments
should be fixed.

[typos]: https://github.com/crate-ci/typos

22 months agoAuto merge of #13034 - lowr:fix/regression-from-12993, r=lowr
bors [Wed, 17 Aug 2022 09:55:14 +0000 (09:55 +0000)]
Auto merge of #13034 - lowr:fix/regression-from-12993, r=lowr

fix: escape keywords used as names in earlier editions

Fixes #13030

There are keywords in Rust 2018+ that you can use as names without escaping when your crate is in Rust 2015 e.g. "try". We need to be consistent on how to keep track of the names regardless of how they are actually written in each crate. This patch attempts at it by taking such names into account and storing them uniformly in their escaped form.

22 months agofixup! feat: add inline_type_alias_uses assist
Aleksandr Pak [Wed, 17 Aug 2022 09:50:33 +0000 (12:50 +0300)]
fixup! feat: add inline_type_alias_uses assist