]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoMerge #4516
bors[bot] [Fri, 22 May 2020 13:12:57 +0000 (13:12 +0000)]
Merge #4516

4516: LSP: Two stage initialization r=kjeremy a=kjeremy

Fills in server information.

Derives CodeAction capabilities from the client. If code action literals
are unsupported we fall back to the "simple support" which just sends back
commands (this is already supported in our config). The difference being
that we did not adjust our server capabilities so that if the client was
checking for `CodeActionProvider: "true"` in the response that would have failed.

Part of #144
Fixes #4130 (the specific case called out in that issue)

Co-authored-by: kjeremy <kjeremy@gmail.com>
4 years agoMerge #4560
bors[bot] [Thu, 21 May 2020 22:45:18 +0000 (22:45 +0000)]
Merge #4560

4560: Use WorkspaceEdit for ssr r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoUse WorkspaceEdit for ssr
Aleksey Kladov [Thu, 21 May 2020 22:28:49 +0000 (00:28 +0200)]
Use WorkspaceEdit for ssr

4 years agoMerge #4557
bors[bot] [Thu, 21 May 2020 18:05:58 +0000 (18:05 +0000)]
Merge #4557

4557: Formalize JoinLines protocol extension r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoFormalize JoinLines protocol extension
Aleksey Kladov [Thu, 21 May 2020 17:50:23 +0000 (19:50 +0200)]
Formalize JoinLines protocol extension

4 years agoMerge #4553
bors[bot] [Thu, 21 May 2020 14:14:53 +0000 (14:14 +0000)]
Merge #4553

4553: Cleanup r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoCleanup
Aleksey Kladov [Thu, 21 May 2020 14:11:37 +0000 (16:11 +0200)]
Cleanup

4 years agoCleanup TextEdit
Aleksey Kladov [Thu, 21 May 2020 13:56:18 +0000 (15:56 +0200)]
Cleanup TextEdit

4 years agoMerge #4552
bors[bot] [Thu, 21 May 2020 13:10:00 +0000 (13:10 +0000)]
Merge #4552

4552: Transition OnEnter to WorkspaceSnippetEdit r=matklad a=matklad

This also changes our handiling of snippet edits on the client side.
`editor.insertSnippet` unfortunately forces indentation, which we
really don't want to have to deal with. So, let's just implement our
manual hacky way of dealing with a simple subset of snippets we
actually use in rust-analyzer

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoRemove dead code for handling cursor positions
Aleksey Kladov [Thu, 21 May 2020 12:34:27 +0000 (14:34 +0200)]
Remove dead code for handling cursor positions

4 years agoTransition OnEnter to WorkspaceSnippetEdit
Aleksey Kladov [Thu, 21 May 2020 12:26:44 +0000 (14:26 +0200)]
Transition OnEnter to WorkspaceSnippetEdit

This also changes our handiling of snippet edits on the client side.
`editor.insertSnippet` unfortunately forces indentation, which we
really don't want to have to deal with. So, let's just implement our
manual hacky way of dealing with a simple subset of snippets we
actually use in rust-analyzer

4 years agoMerge #4550
bors[bot] [Thu, 21 May 2020 12:51:52 +0000 (12:51 +0000)]
Merge #4550

4550: Fix phrasing in inlay hints settings r=matklad a=lnicola

Part of #4549

r? @LucianoBestia

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
4 years agoFix phrasing in inlay hints settings
Laurențiu Nicola [Thu, 21 May 2020 09:24:18 +0000 (12:24 +0300)]
Fix phrasing in inlay hints settings

4 years agoMerge #4547
bors[bot] [Thu, 21 May 2020 08:38:55 +0000 (08:38 +0000)]
Merge #4547

4547: Remove unused cursor positions r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoRemove unused cursor positions
Aleksey Kladov [Wed, 20 May 2020 22:46:08 +0000 (00:46 +0200)]
Remove unused cursor positions

4 years agoMerge #4506
bors[bot] [Wed, 20 May 2020 23:48:02 +0000 (23:48 +0000)]
Merge #4506

4506: Make `find_path_inner` a query r=matklad a=jonas-schievink

This eliminates the remaining performance problems in the "Implement default members" assist (at least those that I've found).

Closes https://github.com/rust-analyzer/rust-analyzer/issues/4498

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
4 years agoMerge #4543
bors[bot] [Wed, 20 May 2020 23:07:23 +0000 (23:07 +0000)]
Merge #4543

4543: Remove unused cursor positions r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoRemove unused cursor positions
Aleksey Kladov [Wed, 20 May 2020 22:46:08 +0000 (00:46 +0200)]
Remove unused cursor positions

4 years agoMerge #4541
bors[bot] [Wed, 20 May 2020 22:04:42 +0000 (22:04 +0000)]
Merge #4541

4541: Remove set_cursor r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoRemove set_cursor
Aleksey Kladov [Wed, 20 May 2020 22:03:42 +0000 (00:03 +0200)]
Remove set_cursor

4 years agoSnippetify unwrap -> match
Aleksey Kladov [Wed, 20 May 2020 22:01:08 +0000 (00:01 +0200)]
Snippetify unwrap -> match

4 years agoMake `find_path_inner` a query
Jonas Schievink [Mon, 18 May 2020 22:39:50 +0000 (00:39 +0200)]
Make `find_path_inner` a query

This eliminates any remaining performance problems in the
"Implement default members" assist (at least that I've found).

4 years agoMore snippets
Aleksey Kladov [Wed, 20 May 2020 21:50:29 +0000 (23:50 +0200)]
More snippets

4 years agoMerge #4540
bors[bot] [Wed, 20 May 2020 21:33:36 +0000 (21:33 +0000)]
Merge #4540

4540: More snippets r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoMore snippets
Aleksey Kladov [Wed, 20 May 2020 21:14:31 +0000 (23:14 +0200)]
More snippets

4 years agoMerge #4526
bors[bot] [Wed, 20 May 2020 21:23:13 +0000 (21:23 +0000)]
Merge #4526

4526: Use a flat play icon instead of the blue emoji with test code lens r=kjeremy a=aloucks

@lnicola

Restores this commit:
https://github.com/rust-analyzer/rust-analyzer/commit/55e914a2a179aba63bd9948d6e0cf3e2a4bf5960

That was effectively wiped out by this code formatting commit:
https://github.com/rust-analyzer/rust-analyzer/commit/dc217bdf90d555eaa1780041fc3a14e64173994d
https://github.com/rust-analyzer/rust-analyzer/commit/3d445256fe56f4a7ead64514fb57b79079973d84

Co-authored-by: Aaron Loucks <aloucks@cofront.net>
4 years agoSnippetify introduce/inline var
Aleksey Kladov [Wed, 20 May 2020 21:07:17 +0000 (23:07 +0200)]
Snippetify introduce/inline var

4 years agoMerge #4539
bors[bot] [Wed, 20 May 2020 20:56:28 +0000 (20:56 +0000)]
Merge #4539

4539: Relax cursor position tests in assists r=matklad a=matklad

Those will be replaced with snippets anyway

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoRelax cursor position tests in assists
Aleksey Kladov [Wed, 20 May 2020 20:55:37 +0000 (22:55 +0200)]
Relax cursor position tests in assists

Those will be replaced with snippets anyway

4 years agoMerge #4536
bors[bot] [Wed, 20 May 2020 19:04:02 +0000 (19:04 +0000)]
Merge #4536

4536: Fix names of launch configuration in dev docs r=kjeremy a=kuy

Follows renaming of launch configurations in https://github.com/rust-analyzer/rust-analyzer/commit/80a42a0628f7655c3299fbf4c5a15e31990b35d3

Co-authored-by: Yuki Kodama <endflow.net@gmail.com>
4 years agoMerge #4537
bors[bot] [Wed, 20 May 2020 18:18:18 +0000 (18:18 +0000)]
Merge #4537

4537: Fix GNOME spelling r=matklad a=afranke

GNOME is a trademark. :-)

Co-authored-by: Alexandre Franke <alexandre.franke@gmail.com>
4 years agoFix GNOME spelling
Alexandre Franke [Wed, 20 May 2020 18:11:14 +0000 (20:11 +0200)]
Fix GNOME spelling

GNOME is a trademark. :-)

4 years agoFix names of launch configuration in dev docs
Yuki Kodama [Wed, 20 May 2020 18:01:37 +0000 (03:01 +0900)]
Fix names of launch configuration in dev docs

4 years agoMerge #4533
bors[bot] [Wed, 20 May 2020 12:16:26 +0000 (12:16 +0000)]
Merge #4533

4533: More snippets r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoSnippetify fix_visibility
Aleksey Kladov [Wed, 20 May 2020 12:13:17 +0000 (14:13 +0200)]
Snippetify fix_visibility

4 years agoSnippetify fill_match_arms
Aleksey Kladov [Wed, 20 May 2020 12:00:37 +0000 (14:00 +0200)]
Snippetify fill_match_arms

4 years agoDon't set cursor in change_visibility
Aleksey Kladov [Wed, 20 May 2020 11:48:31 +0000 (13:48 +0200)]
Don't set cursor in change_visibility

4 years agoCleanup imports
Aleksey Kladov [Wed, 20 May 2020 11:41:58 +0000 (13:41 +0200)]
Cleanup imports

4 years agoMerge #4532
bors[bot] [Wed, 20 May 2020 11:33:48 +0000 (11:33 +0000)]
Merge #4532

4532: Split change_ and fix_ visibility assists r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoSplit change_ and fix_ visibility assists
Aleksey Kladov [Wed, 20 May 2020 11:33:13 +0000 (13:33 +0200)]
Split change_ and fix_ visibility assists

4 years agoMerge #4520
bors[bot] [Wed, 20 May 2020 11:03:18 +0000 (11:03 +0000)]
Merge #4520

4520: Marks 2.0 r=matklad a=matklad

The main benefit here is that we no longer need to declare marks. The main drawback is that this is ~~glorious~~ horrible. WDYT?

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoSwitch to new magic marks
Aleksey Kladov [Wed, 20 May 2020 10:59:20 +0000 (12:59 +0200)]
Switch to new magic marks

4 years agoRemove cross-crate marks
Aleksey Kladov [Wed, 20 May 2020 09:54:57 +0000 (11:54 +0200)]
Remove cross-crate marks

They create quite a bit of friction. Really, we should just move the
tests to the same crate, rather than paper over existing split.

4 years agoSignificantly more glorious marks
Aleksey Kladov [Tue, 19 May 2020 22:19:59 +0000 (00:19 +0200)]
Significantly more glorious marks

4 years agoMerge #4530
bors[bot] [Wed, 20 May 2020 09:10:52 +0000 (09:10 +0000)]
Merge #4530

4530: Use snippets in change_return_type_to_result r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoUse snippets in change_return_type_to_result
Aleksey Kladov [Wed, 20 May 2020 09:10:15 +0000 (11:10 +0200)]
Use snippets in change_return_type_to_result

4 years agoMerge #4529
bors[bot] [Wed, 20 May 2020 08:52:34 +0000 (08:52 +0000)]
Merge #4529

4529: Fix Some|None order in fill_match_arms r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoFix Some|None order in fill_match_arms
Aleksey Kladov [Wed, 20 May 2020 08:51:48 +0000 (10:51 +0200)]
Fix Some|None order in fill_match_arms

4 years agowip
Aleksey Kladov [Wed, 20 May 2020 08:30:18 +0000 (10:30 +0200)]
wip

4 years agoCleanup
Aleksey Kladov [Wed, 20 May 2020 08:28:58 +0000 (10:28 +0200)]
Cleanup

4 years agoMinor
Aleksey Kladov [Wed, 20 May 2020 08:26:14 +0000 (10:26 +0200)]
Minor

4 years agoMinor
Aleksey Kladov [Wed, 20 May 2020 08:20:21 +0000 (10:20 +0200)]
Minor

4 years agoSnippetify add_new
Aleksey Kladov [Wed, 20 May 2020 08:17:46 +0000 (10:17 +0200)]
Snippetify add_new

4 years agoMerge #4528
bors[bot] [Wed, 20 May 2020 07:57:49 +0000 (07:57 +0000)]
Merge #4528

4528: Debug lens fix for a binary. r=matklad a=vsrs

Fixes an issue reported here: https://github.com/rust-analyzer/rust-analyzer/pull/4222#issuecomment-631073448

Co-authored-by: vsrs <vit@conrlab.com>
4 years agoMerge #4505
bors[bot] [Wed, 20 May 2020 07:22:53 +0000 (07:22 +0000)]
Merge #4505

4505: Infer return type of loops with value breaks r=flodiebold a=ruabmbua

Creates a type variable to represent the return value of the loop.
Uses `coerce_merge_branch` on each break with the previous value, to determine the actual return value of the loop.

Resolves: https://github.com/rust-analyzer/rust-analyzer/issues/4492 , https://github.com/rust-analyzer/rust-analyzer/issues/4512

Co-authored-by: Roland Ruckerbauer <roland.rucky@gmail.com>
4 years agoDebug lens fix for a binary.
vsrs [Wed, 20 May 2020 06:42:00 +0000 (09:42 +0300)]
Debug lens fix for a binary.

4 years agoUse a flat play icon instead of the blue emoji with test code lens
Aaron Loucks [Wed, 20 May 2020 00:29:49 +0000 (20:29 -0400)]
Use a flat play icon instead of the blue emoji with test code lens

4 years agoMerge #4525
bors[bot] [Wed, 20 May 2020 00:11:25 +0000 (00:11 +0000)]
Merge #4525

4525: Better cursor placement when adding impl members r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoBetter cursor placement when adding impl members
Aleksey Kladov [Wed, 20 May 2020 00:07:21 +0000 (02:07 +0200)]
Better cursor placement when adding impl members

4 years agoMerge #4524
bors[bot] [Tue, 19 May 2020 23:54:08 +0000 (23:54 +0000)]
Merge #4524

4524: Use snippets in add_missing_members r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoUse snippets in add_missing_members
Aleksey Kladov [Tue, 19 May 2020 23:53:21 +0000 (01:53 +0200)]
Use snippets in add_missing_members

4 years agoMerge #4521 #4522
bors[bot] [Tue, 19 May 2020 23:30:48 +0000 (23:30 +0000)]
Merge #4521 #4522

4521: Use snippets in add_function r=matklad a=matklad

bors r+
🤖

4522: Explain the purpose of `ast::make` module more clearly r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoModerate cleanup of add_function
Aleksey Kladov [Tue, 19 May 2020 21:12:01 +0000 (23:12 +0200)]
Moderate cleanup of add_function

4 years agoExplain the purpose of `ast::make` module more clearly
Aleksey Kladov [Tue, 19 May 2020 23:28:11 +0000 (01:28 +0200)]
Explain the purpose of `ast::make` module more clearly

4 years agoUse snippets in add function
Aleksey Kladov [Tue, 19 May 2020 20:25:07 +0000 (22:25 +0200)]
Use snippets in add function

4 years agoCleanup
Aleksey Kladov [Tue, 19 May 2020 19:43:14 +0000 (21:43 +0200)]
Cleanup

4 years agoCleanup
Aleksey Kladov [Tue, 19 May 2020 19:40:47 +0000 (21:40 +0200)]
Cleanup

4 years agoUse new format for all assists that don't change cursor positon
Aleksey Kladov [Tue, 19 May 2020 19:39:27 +0000 (21:39 +0200)]
Use new format for all assists that don't change cursor positon

4 years agoMerge #4519
bors[bot] [Tue, 19 May 2020 22:50:26 +0000 (22:50 +0000)]
Merge #4519

4519: Fix client-side snippets r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoFix client-side snippets
Aleksey Kladov [Tue, 19 May 2020 22:49:08 +0000 (00:49 +0200)]
Fix client-side snippets

4 years agoMerge #4518
bors[bot] [Tue, 19 May 2020 22:27:55 +0000 (22:27 +0000)]
Merge #4518

4518: New assist: add turbo fish r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoNew assist: add turbo fish
Aleksey Kladov [Tue, 19 May 2020 22:07:00 +0000 (00:07 +0200)]
New assist: add turbo fish

4 years agoAdd version
kjeremy [Tue, 19 May 2020 22:12:07 +0000 (18:12 -0400)]
Add version

4 years agoFill code action capabilities with a function
kjeremy [Tue, 19 May 2020 21:22:38 +0000 (17:22 -0400)]
Fill code action capabilities with a function

4 years agoApply suggestion of @flodiebold: Get rid of multiple unwraps
Roland Ruckerbauer [Tue, 19 May 2020 20:52:15 +0000 (22:52 +0200)]
Apply suggestion of @flodiebold: Get rid of multiple unwraps

4 years agoloop return value inference: add tests
Roland Ruckerbauer [Tue, 19 May 2020 19:49:45 +0000 (21:49 +0200)]
loop return value inference: add tests

4 years agoMove false negative expr_diverges_missing_arm() to working tests
Roland Ruckerbauer [Tue, 19 May 2020 19:18:43 +0000 (21:18 +0200)]
Move false negative expr_diverges_missing_arm() to working tests

4 years agoloop return value inference: coerce_merge branches
Roland Ruckerbauer [Tue, 19 May 2020 19:03:59 +0000 (21:03 +0200)]
loop return value inference: coerce_merge branches

4 years agoMerge #4494
bors[bot] [Tue, 19 May 2020 18:29:46 +0000 (18:29 +0000)]
Merge #4494

4494: Support snippet text edit r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoUpdate test data
Aleksey Kladov [Tue, 19 May 2020 18:27:14 +0000 (20:27 +0200)]
Update test data

4 years agoImplement client-side of SnippetTextEdit
Aleksey Kladov [Sun, 17 May 2020 23:53:55 +0000 (01:53 +0200)]
Implement client-side of SnippetTextEdit

4 years agoServer side of SnippetTextEdit
Aleksey Kladov [Sun, 17 May 2020 22:11:40 +0000 (00:11 +0200)]
Server side of SnippetTextEdit

4 years agoAdd snippetTextEdit protocol extension
Aleksey Kladov [Sun, 17 May 2020 19:24:33 +0000 (21:24 +0200)]
Add snippetTextEdit protocol extension

4 years agoAdd snippet support for some assists
Aleksey Kladov [Sun, 17 May 2020 12:21:24 +0000 (14:21 +0200)]
Add snippet support for some assists

4 years agoAdd AssistConfig
Aleksey Kladov [Sun, 17 May 2020 10:09:53 +0000 (12:09 +0200)]
Add AssistConfig

4 years agoMerge #4491
bors[bot] [Tue, 19 May 2020 18:16:20 +0000 (18:16 +0000)]
Merge #4491

4491: fix doctest inside impl block r=matklad a=bnjjj

close #4449

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Coenen Benjamin <benjamin.coenen@hotmail.com>
4 years agoLSP: Two stage initialization
kjeremy [Tue, 19 May 2020 15:56:51 +0000 (11:56 -0400)]
LSP: Two stage initialization

Fills in server information.

Derives CodeAction capabilities from the client. If code action literals
are unsupported we fall back to the "simple support" which just sends back
commands (this is already supported in our config). The difference being
that we did not adjust our server capabilities so that if the client was
checking for `CodeActionProvider: "true"` in the response that would have failed.

4 years agoMerge #4514
bors[bot] [Tue, 19 May 2020 15:03:41 +0000 (15:03 +0000)]
Merge #4514

4514: find_path cleanups r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoCleanup query fn naming
Aleksey Kladov [Tue, 19 May 2020 14:54:45 +0000 (16:54 +0200)]
Cleanup query fn naming

4 years agoMove public API to the top
Aleksey Kladov [Tue, 19 May 2020 14:46:33 +0000 (16:46 +0200)]
Move public API to the top

4 years agoSimplify
Aleksey Kladov [Tue, 19 May 2020 14:45:57 +0000 (16:45 +0200)]
Simplify

4 years agoCleanup imports
Aleksey Kladov [Tue, 19 May 2020 14:43:26 +0000 (16:43 +0200)]
Cleanup imports

4 years agoMerge #4513
bors[bot] [Tue, 19 May 2020 14:35:21 +0000 (14:35 +0000)]
Merge #4513

4513: Update crates r=kjeremy a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
4 years agoUpdate crates
kjeremy [Tue, 19 May 2020 14:11:34 +0000 (10:11 -0400)]
Update crates

4 years agoInfer return type of loops with value breaks.
Roland Ruckerbauer [Mon, 18 May 2020 21:39:10 +0000 (23:39 +0200)]
Infer return type of loops with value breaks.

4 years agoMerge #4501
bors[bot] [Mon, 18 May 2020 19:43:12 +0000 (19:43 +0000)]
Merge #4501

4501: Querify `importable_locations_in_crate` r=jonas-schievink a=jonas-schievink

This brings the time needed to compute the `add_missing_impl_members` assist down from ~5 minutes to 20 seconds on my test workload (which is editing within an impl of a MIR [`MutVisitor`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/visit/trait.MutVisitor.html))

cc #4498

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
4 years ago Querify `importable_locations_in_crate`
Jonas Schievink [Mon, 18 May 2020 19:42:39 +0000 (21:42 +0200)]
 Querify `importable_locations_in_crate`

 This brings the time needed to compute the `add_missing_impl_members`
assist down from ~5 minutes to 20 seconds

4 years agoMerge #4497
bors[bot] [Mon, 18 May 2020 11:03:44 +0000 (11:03 +0000)]
Merge #4497

4497: Create LowerCtx on the fly r=matklad a=edwin0cheng

Previously we create `LowerCtx` at the beginning of lowering, however, the hygiene content is in fact changing between macro expression expanding.

This PR change it to create the `LowerCtx` on the fly to fix above bug.

However, #4465 is not fixed by this PR, the goto-def is still not work yet. It only fixed the infer part.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
4 years agoMerge #4493
bors[bot] [Mon, 18 May 2020 07:44:44 +0000 (07:44 +0000)]
Merge #4493

4493: Provide builtin impls of Fn traits for fn-pointers r=flodiebold a=hban

Meant to be, but isn't actually a fix for #2880.

Consider this snippet:

```rust
use std::marker::PhantomData;
use std::ops::Deref;

struct Lazy<T, F/* = fn() -> T*/>(F, PhantomData<T>);

impl<T, F> Lazy<T, F> {
    pub fn new(f: F) -> Lazy<T, F> {
        Lazy(f, PhantomData)
    }
}

impl<T, F: FnOnce() -> T> Deref for Lazy<T, F> {
    type Target = T;

    fn deref(&self) -> &T { todo!() }
}

fn test() {
    let lazy1: Lazy<u32, _> = Lazy::new(|| 0u32);
    let r1 = lazy1.to_string();

    fn make_u32_fn() -> u32 { todo!() }
    let make_u32_fn_ptr: fn() -> u32 = make_u32_fn;
    let lazy2: Lazy<u32, _> = Lazy::new(make_u32_fn_ptr);
    let r2 = lazy2.to_string();
}
```

* On current master:
  * When type default is commented-out, `r1` is correctly inferred, `r2` in _{unknown}_.
  * When type default is not commented-out, both `r1`  and `r2` are _{unknown}_.
* With this PR:
  * When type default is commented-out, both `r1` and `r2` are correctly inferred.
  * When type default is not commented-out, both `r1`  and `r2` are _{unknown}_.

Well, it's a improvement at least. I guess this thing with type defaults is a different problem.

I also tried add Fn impls for fn items, but wasn't successful. So this PR only adds those impls for fn pointers.

Co-authored-by: Hrvoje Ban <hban@users.noreply.github.com>
4 years agoMerge #4499
bors[bot] [Mon, 18 May 2020 07:37:04 +0000 (07:37 +0000)]
Merge #4499

4499: CodeLens configuration options r=vsrs a=vsrs

This PR
- adds an option to granularly enable\disable all CodeLens, just like the TypeScript extension.
- fixes a minor bug for doctests. It makes no sense to show `Debug` lens for them as cargo `Can't skip running doc tests with --no-run`.

Co-authored-by: vsrs <vit@conrlab.com>