]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoMerge #6601
bors[bot] [Sun, 29 Nov 2020 19:21:25 +0000 (19:21 +0000)]
Merge #6601

6601: add let and letm postfix to turn expressions into variables r=matklad a=bnjjj

Partially resolve #6426

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
3 years agoMerge #6670
bors[bot] [Sun, 29 Nov 2020 19:07:04 +0000 (19:07 +0000)]
Merge #6670

6670: Allow renaming between self and first param with owned parameters r=matklad a=Veykril

This fixes renaming owned SelfParams turning the parameter into a reference, as in, for a type `Foo`, `fn foo(self) {}` became `fn foo(renamed_name: &Foo) {}` prior to this.

Similarly for the other way around, we now support renaming non-ref parameters to `self`. Additionally we do more checks now than before. We check:
- that the function has an impl block
- that we are renaming the first parameter(prior we ignored which parameter was renamed and always picked the first nevertheless)
- that the parameter's type aligns with the impl block(minus one level of reference abstraction to account for `&self`/`&mut self`)

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoReject more cases of invalid parameter to self renames
Lukas Wirth [Sun, 29 Nov 2020 17:44:26 +0000 (18:44 +0100)]
Reject more cases of invalid parameter to self renames

3 years agoFix renaming owned self to parameter emitting ref
Lukas Wirth [Sun, 29 Nov 2020 16:56:36 +0000 (17:56 +0100)]
Fix renaming owned self to parameter emitting ref

3 years agoMerge #6669
bors[bot] [Sun, 29 Nov 2020 15:46:08 +0000 (15:46 +0000)]
Merge #6669

6669: Align default importMergeBehaviour with VSCode r=lnicola a=flodiebold

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
3 years agoAlign default importMergeBehaviour with VSCode
Florian Diebold [Sun, 29 Nov 2020 15:43:30 +0000 (16:43 +0100)]
Align default importMergeBehaviour with VSCode

3 years agoMerge #6666
bors[bot] [Sun, 29 Nov 2020 14:35:38 +0000 (14:35 +0000)]
Merge #6666

6666: Support 'go to definition' for self r=jonas-schievink a=Veykril

Also reverts #6660, instead of showing the type it now works like it does for names by returning the declaration we are already on. This for example enables VSCode to show all references(#6665) when executing `go to definition` on the declaration.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoSupport 'go to definition' for self
Lukas Wirth [Sat, 28 Nov 2020 21:50:59 +0000 (22:50 +0100)]
Support 'go to definition' for self

3 years agoMerge #6664
bors[bot] [Sat, 28 Nov 2020 23:38:18 +0000 (23:38 +0000)]
Merge #6664

6664: Show type of self param on hover r=jonas-schievink a=Veykril

Show the type of `self` when hovering the token in a `SelfParam`.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoShow type of self param on hover
Lukas Wirth [Sat, 28 Nov 2020 21:46:25 +0000 (22:46 +0100)]
Show type of self param on hover

3 years agoadd let and letm postfix to turn expressions into variables
Benjamin Coenen [Sat, 28 Nov 2020 16:38:16 +0000 (17:38 +0100)]
add let and letm postfix to turn expressions into variables

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
3 years agoMerge #6660
bors[bot] [Sat, 28 Nov 2020 16:04:35 +0000 (16:04 +0000)]
Merge #6660

6660: Support "go to definition" for SelfParams r=jonas-schievink a=Veykril

Fixes #6657

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMerge #6659
bors[bot] [Sat, 28 Nov 2020 15:16:33 +0000 (15:16 +0000)]
Merge #6659

6659: Explain how we get precise spans for diagnostics. r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoExplain how we get precise spans for diagnostics.
Aleksey Kladov [Sat, 28 Nov 2020 15:14:08 +0000 (18:14 +0300)]
Explain how we get precise spans for diagnostics.

3 years agoMerge #6645
bors[bot] [Sat, 28 Nov 2020 15:10:00 +0000 (15:10 +0000)]
Merge #6645

6645: Publish diagnostics for macro expansion errors r=matklad a=jonas-schievink

This adds 2 new diagnostics, emitted during name resolution:

* `unresolved-proc-macro`, a weak warning that is emitted when a proc macro is supposed to be expanded, but was not provided by the build system. This usually means that proc macro support is turned off, but may also indicate setup issues when using rust-project.json. Being a weak warning, this should help set expectations when users see it, while not being too obstructive. We do not yet emit this for attribute macros though, just custom derives and `!` macros.
* `macro-error`, which is emitted when any macro (procedural or `macro_rules!`) fails to expand due to some error. This is an error-level diagnostic, but currently still marked as experimental, because there might be spurious errors and this hasn't been tested too well.

This does not yet emit diagnostics when expansion in item bodies fails, just for module-level macros.

Known bug: The "proc macro not found" diagnostic points at the whole item for custom derives, it should just point at the macro's name in the `#[derive]` list, but I haven't found an easy way to do that.

Screenshots:

![screenshot-2020-11-26-19:54:14](https://user-images.githubusercontent.com/1786438/100385782-f8bc2300-3023-11eb-9f27-e8f8ce9d6114.png)
![screenshot-2020-11-26-19:55:39](https://user-images.githubusercontent.com/1786438/100385784-f954b980-3023-11eb-9617-ac2eb0a0a9dc.png)

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoSupport goto definition for ADT-SelfParams
Lukas Wirth [Sat, 28 Nov 2020 15:07:07 +0000 (16:07 +0100)]
Support goto definition for ADT-SelfParams

3 years agoMerge #6650
bors[bot] [Sat, 28 Nov 2020 14:33:57 +0000 (14:33 +0000)]
Merge #6650

6650: Make completion and assists module independent r=matklad a=SomeoneToIgnore

A follow-up of https://github.com/rust-analyzer/rust-analyzer/pull/6553#discussion_r524402907

Move the common code for both assists and completion modules into a separate crate.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
3 years agoMove the helpers into ide_db
Kirill Bulatov [Sat, 28 Nov 2020 14:30:39 +0000 (16:30 +0200)]
Move the helpers into ide_db

3 years agoMerge #6656
bors[bot] [Sat, 28 Nov 2020 13:56:28 +0000 (13:56 +0000)]
Merge #6656

6656: Coalesce flycheck events r=matklad a=jonas-schievink

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoCoalesce flycheck events
Jonas Schievink [Fri, 27 Nov 2020 21:52:22 +0000 (22:52 +0100)]
Coalesce flycheck events

3 years agoMerge #6653
bors[bot] [Fri, 27 Nov 2020 17:36:07 +0000 (17:36 +0000)]
Merge #6653

6653: Downgrade "failed to load" error to warning r=jonas-schievink a=jonas-schievink

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

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoDowngrade "failed to load" error to warning
Jonas Schievink [Fri, 27 Nov 2020 17:35:22 +0000 (18:35 +0100)]
Downgrade "failed to load" error to warning

3 years agoMerge #6652
bors[bot] [Fri, 27 Nov 2020 17:08:22 +0000 (17:08 +0000)]
Merge #6652

6652: Add/Fix macro expansion profiling r=jonas-schievink a=jonas-schievink

bors r+ :robot:

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoAdd/Fix macro expansion profiling
Jonas Schievink [Fri, 27 Nov 2020 17:07:16 +0000 (18:07 +0100)]
Add/Fix macro expansion profiling

3 years agoRustdocs fixes
Kirill Bulatov [Fri, 27 Nov 2020 10:26:20 +0000 (12:26 +0200)]
Rustdocs fixes

3 years agoGroup import data in a struct
Kirill Bulatov [Fri, 27 Nov 2020 10:22:10 +0000 (12:22 +0200)]
Group import data in a struct

3 years agoExtract the import code into the shared module
Kirill Bulatov [Tue, 24 Nov 2020 21:25:13 +0000 (23:25 +0200)]
Extract the import code into the shared module

3 years agoMerge #6651
bors[bot] [Fri, 27 Nov 2020 16:14:04 +0000 (16:14 +0000)]
Merge #6651

6651: Profile completions better r=SomeoneToIgnore a=SomeoneToIgnore

During https://github.com/rust-analyzer/rust-analyzer/issues/6612 investigation, had added a few more profiling points and considered that they can be useful later, ergo the PR.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
3 years agoFix the profiling string
Kirill Bulatov [Fri, 27 Nov 2020 16:13:02 +0000 (18:13 +0200)]
Fix the profiling string

Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
3 years agoProfile completions better
Kirill Bulatov [Fri, 27 Nov 2020 16:00:03 +0000 (18:00 +0200)]
Profile completions better

3 years agoMore accurately place proc-macro diagnostic
Jonas Schievink [Fri, 27 Nov 2020 15:29:40 +0000 (16:29 +0100)]
More accurately place proc-macro diagnostic

3 years agoPublish diagnostics for macro expansion errors
Jonas Schievink [Thu, 26 Nov 2020 19:09:54 +0000 (20:09 +0100)]
Publish diagnostics for macro expansion errors

3 years agoAdd dedicated error for "proc macro not found"
Jonas Schievink [Thu, 26 Nov 2020 18:07:53 +0000 (19:07 +0100)]
Add dedicated error for "proc macro not found"

3 years agoMerge #6648
bors[bot] [Fri, 27 Nov 2020 11:14:14 +0000 (11:14 +0000)]
Merge #6648

6648: Avoid allocation in ast::String::value if the string needs no unescaping r=lnicola a=Veykril

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoAvoid allocation in ast::String::value if the string needs no unescaping
Lukas Wirth [Thu, 26 Nov 2020 22:08:02 +0000 (23:08 +0100)]
Avoid allocation in ast::String::value if the string needs no unescaping

3 years agoMerge #6586
bors[bot] [Fri, 27 Nov 2020 09:49:37 +0000 (09:49 +0000)]
Merge #6586

6586: Don't call a closure a function in the infer_function_return_type assist label r=lnicola a=Veykril

`Add this function's return type` becomes `Add this closure's return type` for closures. This makes it more obvious that we are indeed planning on modifying the closure and not its containing function.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMerge #6646
bors[bot] [Thu, 26 Nov 2020 20:50:16 +0000 (20:50 +0000)]
Merge #6646

6646: Remove single r#trait identifer usage r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoDon't use raw identifiers
Lukas Wirth [Thu, 26 Nov 2020 20:44:17 +0000 (21:44 +0100)]
Don't use raw identifiers

3 years agoMerge #6635
bors[bot] [Thu, 26 Nov 2020 20:30:16 +0000 (20:30 +0000)]
Merge #6635

6635: Complete struct in irrefutable let r=Veykril a=Veykril

Fixes #6210

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoComplete struct in irrefutable let
Lukas Wirth [Wed, 25 Nov 2020 22:25:10 +0000 (23:25 +0100)]
Complete struct in irrefutable let

3 years agoMerge #6644
bors[bot] [Thu, 26 Nov 2020 19:18:40 +0000 (19:18 +0000)]
Merge #6644

6644: Simplify error formatting r=lnicola a=lnicola

CC jonas-schievink

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoSimplify error formatting
Laurențiu Nicola [Thu, 26 Nov 2020 18:56:38 +0000 (20:56 +0200)]
Simplify error formatting

3 years agoMerge #6643
bors[bot] [Thu, 26 Nov 2020 17:28:43 +0000 (17:28 +0000)]
Merge #6643

6643: Remove unused import r=lnicola a=lnicola

Not sure why CI didn't catch this...

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoRemove unused import
Laurențiu Nicola [Thu, 26 Nov 2020 17:25:59 +0000 (19:25 +0200)]
Remove unused import

3 years agoMerge #6641
bors[bot] [Thu, 26 Nov 2020 16:30:05 +0000 (16:30 +0000)]
Merge #6641

6641: Fix def map volatility with `#[cfg]` diagnostics r=jonas-schievink a=jonas-schievink

bors r+ :robot:

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoDon't store `SyntaxNodePtr` in `CrateDefMap`
Jonas Schievink [Thu, 26 Nov 2020 16:29:09 +0000 (17:29 +0100)]
Don't store `SyntaxNodePtr` in `CrateDefMap`

It is volatile across reparses and makes incrementality worse.

3 years agoTest def map invalidation with #[cfg] below change
Jonas Schievink [Thu, 26 Nov 2020 16:28:00 +0000 (17:28 +0100)]
Test def map invalidation with #[cfg] below change

3 years agoMerge #6640
bors[bot] [Thu, 26 Nov 2020 15:56:58 +0000 (15:56 +0000)]
Merge #6640

6640: Implement `Display` for macro expansion errors r=jonas-schievink a=jonas-schievink

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoImplement `Display` for macro expansion errors
Jonas Schievink [Thu, 26 Nov 2020 15:56:22 +0000 (16:56 +0100)]
Implement `Display` for macro expansion errors

3 years agoMerge #6639
bors[bot] [Thu, 26 Nov 2020 15:48:58 +0000 (15:48 +0000)]
Merge #6639

6639: Use `ExpandResult` instead of `MacroResult` r=jonas-schievink a=jonas-schievink

`MacroResult` is redundant.

bors r+ :robot:

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoUse `ExpandResult` instead of `MacroResult`
Jonas Schievink [Thu, 26 Nov 2020 15:48:17 +0000 (16:48 +0100)]
Use `ExpandResult` instead of `MacroResult`

`MacroResult` is redundant

3 years agoMerge #6638
bors[bot] [Thu, 26 Nov 2020 15:05:09 +0000 (15:05 +0000)]
Merge #6638

6638: Use named fields in `ExpandResult` r=jonas-schievink a=jonas-schievink

bors r+ :robot:

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoUse named fields in `ExpandResult`
Jonas Schievink [Thu, 26 Nov 2020 15:04:23 +0000 (16:04 +0100)]
Use named fields in `ExpandResult`

3 years agoMerge #6637
bors[bot] [Thu, 26 Nov 2020 12:42:29 +0000 (12:42 +0000)]
Merge #6637

6637: Publish diagnostics on file open r=jonas-schievink a=jonas-schievink

Diagnostics are sometimes only showing up when typing. This should fix that.

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

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoPublish diagnostics on file open
Jonas Schievink [Thu, 26 Nov 2020 12:33:47 +0000 (13:33 +0100)]
Publish diagnostics on file open

Diagnostics are sometimes only showing up when typing.
This should fix that.

3 years agoMerge #6614 #6632
bors[bot] [Thu, 26 Nov 2020 10:43:35 +0000 (10:43 +0000)]
Merge #6614 #6632

6614: Improve autoimports on completion speed r=matklad a=SomeoneToIgnore

Presumably closes https://github.com/rust-analyzer/rust-analyzer/issues/6594
May help https://github.com/rust-analyzer/rust-analyzer/issues/6612

* Ignore modules eaferly
* Do less completion string rendering

6632: Pin cargo_metadata r=matklad a=kjeremy

See: https://github.com/oli-obk/cargo_metadata/pull/142#issuecomment-733653275

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agoMerge #6496
bors[bot] [Thu, 26 Nov 2020 10:36:26 +0000 (10:36 +0000)]
Merge #6496

6496: Use builtin scopes more r=matklad a=georgewfraser

VSCode has added more builtin fallback scopes, so we can remove some of our fallback scopes by aligning with their conventions.

Note that the macro scope doesn't seem to actually *work* at the moment. I have filed a bug with VSCode: https://github.com/microsoft/vscode/issues/110150

Co-authored-by: George Fraser <george@fivetran.com>
3 years agoJust remove the macro fallback
George Fraser [Wed, 25 Nov 2020 16:39:39 +0000 (08:39 -0800)]
Just remove the macro fallback

3 years agoPin cargo_metadata
kjeremy [Wed, 25 Nov 2020 15:11:53 +0000 (10:11 -0500)]
Pin cargo_metadata

3 years agoMerge #6631
bors[bot] [Tue, 24 Nov 2020 23:40:05 +0000 (23:40 +0000)]
Merge #6631

6631: Gate autoimports begind experimental completions flag r=kjeremy a=SomeoneToIgnore

Part of https://github.com/rust-analyzer/rust-analyzer/issues/6612

Adds a possibility to disable autoimports:

<img width="598" alt="image" src="https://user-images.githubusercontent.com/2690773/100156673-f8037f80-2eb1-11eb-8e74-59ebe4260ba3.png">

and other experimental completions we might want to add later.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
3 years agoDocument experimental completions
Kirill Bulatov [Tue, 24 Nov 2020 22:42:58 +0000 (00:42 +0200)]
Document experimental completions

3 years agoGate autoimports begind experimental completions flag
Kirill Bulatov [Tue, 24 Nov 2020 22:02:45 +0000 (00:02 +0200)]
Gate autoimports begind experimental completions flag

3 years agoMerge #6630
bors[bot] [Tue, 24 Nov 2020 21:01:33 +0000 (21:01 +0000)]
Merge #6630

6630: followup to "hir_expand: propagate expansion errors" r=jonas-schievink a=jonas-schievink

https://github.com/rust-analyzer/rust-analyzer/pull/6625

bors r+ :robot:

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoRename `parse_macro` to `parse_macro_expansion`
Jonas Schievink [Tue, 24 Nov 2020 20:57:51 +0000 (21:57 +0100)]
Rename `parse_macro` to `parse_macro_expansion`

This does not parse macros, it expands a macro and parses the *result*

3 years agohir_expand::db: reduce fn visibility
Jonas Schievink [Tue, 24 Nov 2020 20:55:08 +0000 (21:55 +0100)]
hir_expand::db: reduce fn visibility

3 years agoRemove fixed FIXME, propagate errors better
Jonas Schievink [Tue, 24 Nov 2020 20:52:19 +0000 (21:52 +0100)]
Remove fixed FIXME, propagate errors better

3 years agoMerge #6625
bors[bot] [Tue, 24 Nov 2020 18:01:49 +0000 (18:01 +0000)]
Merge #6625

6625: hir_expand: propagate expansion errors r=jonas-schievink a=jonas-schievink

This is needed to collect and report expansion errors later.

bors r+ :robot:

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agohir_expand: propagate expansion errors
Jonas Schievink [Tue, 24 Nov 2020 18:00:23 +0000 (19:00 +0100)]
hir_expand: propagate expansion errors

3 years agoMerge #6624
bors[bot] [Tue, 24 Nov 2020 17:51:46 +0000 (17:51 +0000)]
Merge #6624

6624: Check structs for match exhaustiveness r=Veykril a=Veykril

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoCheck structs for match exhaustiveness
Lukas Wirth [Tue, 24 Nov 2020 17:28:55 +0000 (18:28 +0100)]
Check structs for match exhaustiveness

3 years agoMerge #6621
bors[bot] [Tue, 24 Nov 2020 15:57:32 +0000 (15:57 +0000)]
Merge #6621

6621: Handle ellipsis in tuple patterns in match exhaustiveness checking r=flodiebold a=Veykril

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoAdd middle ellipsis missing arm text
Lukas Wirth [Tue, 24 Nov 2020 15:46:06 +0000 (16:46 +0100)]
Add middle ellipsis missing arm text

3 years agoHandle ellipsis in tuple patterns in match exhaustiveness checking
Lukas Wirth [Tue, 24 Nov 2020 15:43:28 +0000 (16:43 +0100)]
Handle ellipsis in tuple patterns in match exhaustiveness checking

3 years agoMerge #6618
bors[bot] [Tue, 24 Nov 2020 15:13:25 +0000 (15:13 +0000)]
Merge #6618

6618: Properly infer tuple patterns when encountering ellipsis r=Veykril a=Veykril

We basically just split the subpatterns into two halves when the ellipsis is present and then offset the latter half to account for the ignored bindings.

Fixes #6616

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoProperly infer tuple struct patterns when encountering ellipsis
Lukas Wirth [Tue, 24 Nov 2020 13:52:46 +0000 (14:52 +0100)]
Properly infer tuple struct patterns when encountering ellipsis

3 years agoMerge #6620
bors[bot] [Tue, 24 Nov 2020 15:00:54 +0000 (15:00 +0000)]
Merge #6620

6620: cargo update (without cargo_metadata) r=kjeremy a=kjeremy

This is a `cargo update` run without updating `cargo_metadata`.

`cargo_metadata` `0.12.1` pins `semver-parser` to `0.10.0` (https://github.com/oli-obk/cargo_metadata/commit/4e88e5624c5f20ca94dad0ea97fdb438fdea443f) which brings back the compile time blowup that @matklad tried so hard to avoid in https://github.com/steveklabnik/semver-parser/pull/50.

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agocargo update
kjeremy [Tue, 24 Nov 2020 14:13:26 +0000 (09:13 -0500)]
cargo update

3 years agoMerge #6619
bors[bot] [Tue, 24 Nov 2020 13:53:38 +0000 (13:53 +0000)]
Merge #6619

6619: New lsp-types to fix versioning r=kjeremy a=kjeremy

Fixes #6603

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agoNew lsp-types to fix versioning
kjeremy [Tue, 24 Nov 2020 13:52:24 +0000 (08:52 -0500)]
New lsp-types to fix versioning

Fixes #6603

3 years agoProperly infer tuple patterns when encountering ellipsis
Lukas Wirth [Tue, 24 Nov 2020 12:41:21 +0000 (13:41 +0100)]
Properly infer tuple patterns when encountering ellipsis

3 years agoMerge #6617
bors[bot] [Tue, 24 Nov 2020 10:10:05 +0000 (10:10 +0000)]
Merge #6617

6617: Avoid string allocations in ignore_test r=lnicola a=lnicola

CC @jakobhellermann

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoAvoid string allocations in ignore_test
Laurențiu Nicola [Tue, 24 Nov 2020 10:08:54 +0000 (12:08 +0200)]
Avoid string allocations in ignore_test

3 years agoMerge #6610
bors[bot] [Tue, 24 Nov 2020 00:54:53 +0000 (00:54 +0000)]
Merge #6610

6610: add 'Re-enable this test' assist r=SomeoneToIgnore a=jakobhellermann

The `Ignore this test` assist previously allowed ignoring multiple times, each time adding a `#[ignore]` attribute.

This PR instead shows an assist to undo the ignoring.

Co-authored-by: Jakob Hellermann <jakob.hellermann@protonmail.com>
3 years agoMerge #6613
bors[bot] [Tue, 24 Nov 2020 00:41:08 +0000 (00:41 +0000)]
Merge #6613

6613: Don't assume DidChangeTextDocument paths exist r=SomeoneToIgnore a=mjibson

Fixes #5933

Co-authored-by: Matt Jibson <matt.jibson@gmail.com>
3 years agoImprove autoimports on completion speed
Kirill Bulatov [Tue, 24 Nov 2020 00:26:16 +0000 (02:26 +0200)]
Improve autoimports on completion speed

* Ignore modules eaferly
* Do less completion string rendering

3 years agoDon't assume DidChangeTextDocument paths exist
Matt Jibson [Mon, 23 Nov 2020 23:35:34 +0000 (16:35 -0700)]
Don't assume DidChangeTextDocument paths exist

Fixes #5933

3 years agoadd 'Re-enable this test' assist
Jakob Hellermann [Mon, 23 Nov 2020 19:22:13 +0000 (20:22 +0100)]
add 'Re-enable this test' assist

3 years agoMerge #6609
bors[bot] [Mon, 23 Nov 2020 18:20:01 +0000 (18:20 +0000)]
Merge #6609

6609: Minor, import style r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoMinor, import style
Aleksey Kladov [Mon, 23 Nov 2020 18:19:37 +0000 (21:19 +0300)]
Minor, import style

3 years agoMerge #6606
bors[bot] [Mon, 23 Nov 2020 07:05:31 +0000 (07:05 +0000)]
Merge #6606

6606: Parse unsafe extern block r=lnicola a=dtolnay

`unsafe extern` block is parsed successfully by rustc, which means it is usable in attribute macro input.
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6f805556f176d082d87255957f16b5f6

```rust
#[cfg(parse)]
unsafe extern "C++" {
    fn demo();
}
```

```diff
  SOURCE_FILE@0..52
-   ERROR@0..33
+   EXTERN_BLOCK@0..52
      ATTR@0..13
        POUND@0..1 "#"
        L_BRACK@1..2 "["
        PATH@2..5
          PATH_SEGMENT@2..5
            NAME_REF@2..5
              IDENT@2..5 "cfg"
        TOKEN_TREE@5..12
          L_PAREN@5..6 "("
          IDENT@6..11 "parse"
          R_PAREN@11..12 ")"
        R_BRACK@12..13 "]"
      WHITESPACE@13..14 "\n"
      UNSAFE_KW@14..20 "unsafe"
      WHITESPACE@20..21 " "
      ABI@21..33
        EXTERN_KW@21..27 "extern"
        WHITESPACE@27..28 " "
        STRING@28..33 "\"C++\""
-   WHITESPACE@33..34 " "
-   ERROR@34..52
-     L_CURLY@34..35 "{"
-     WHITESPACE@35..40 "\n    "
-     FN@40..50
-       FN_KW@40..42 "fn"
-       WHITESPACE@42..43 " "
-       NAME@43..47
-         IDENT@43..47 "demo"
-       PARAM_LIST@47..49
-         L_PAREN@47..48 "("
-         R_PAREN@48..49 ")"
-       SEMICOLON@49..50 ";"
-     WHITESPACE@50..51 "\n"
-     R_CURLY@51..52 "}"
+     WHITESPACE@33..34 " "
+     EXTERN_ITEM_LIST@34..52
+       L_CURLY@34..35 "{"
+       WHITESPACE@35..40 "\n    "
+       FN@40..50
+         FN_KW@40..42 "fn"
+         WHITESPACE@42..43 " "
+         NAME@43..47
+           IDENT@43..47 "demo"
+         PARAM_LIST@47..49
+           L_PAREN@47..48 "("
+           R_PAREN@48..49 ")"
+         SEMICOLON@49..50 ";"
+       WHITESPACE@50..51 "\n"
+       R_CURLY@51..52 "}"
```

This is of interest for https://github.com/dtolnay/cxx.

Co-authored-by: David Tolnay <dtolnay@gmail.com>
3 years agoParse unsafe extern block
David Tolnay [Mon, 23 Nov 2020 04:43:00 +0000 (20:43 -0800)]
Parse unsafe extern block

3 years agoadd let and letm postfix to turn expressions into variables
Benjamin Coenen [Sat, 21 Nov 2020 14:06:22 +0000 (15:06 +0100)]
add let and letm postfix to turn expressions into variables

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
3 years agoMerge #6598
bors[bot] [Sat, 21 Nov 2020 07:49:13 +0000 (07:49 +0000)]
Merge #6598

6598: Textmate grammar: ensure word boundary after `true` r=dustypomerleau a=dustypomerleau

Adding round brackets ensures word boundaries on both sides of booleans (reported in https://github.com/dustypomerleau/rust-syntax/issues/7).

Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
3 years agoensure word boundary after `true`
Dusty Pomerleau [Sat, 21 Nov 2020 07:44:38 +0000 (18:44 +1100)]
ensure word boundary after `true`

3 years agoMerge #6595
bors[bot] [Fri, 20 Nov 2020 16:30:04 +0000 (16:30 +0000)]
Merge #6595

6595: Don't wrap parens around expr in remove_dbg assist if its in conditions r=Veykril a=Veykril

If the expr in the `dbg!` macro consists of multiple elements it won't remove the parentheses if its in a `match` or condition-using construct, as these are followed by siblings causing the `is_leaf` check to fail.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoDon't wrap parens around expr in remove_dbg assist if its in conditions
Lukas Wirth [Fri, 20 Nov 2020 15:44:52 +0000 (16:44 +0100)]
Don't wrap parens around expr in remove_dbg assist if its in conditions

3 years agoMerge #6592
bors[bot] [Thu, 19 Nov 2020 20:04:12 +0000 (20:04 +0000)]
Merge #6592

6592: cargo update r=kjeremy a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agocargo update
kjeremy [Thu, 19 Nov 2020 20:00:56 +0000 (15:00 -0500)]
cargo update

3 years agoMerge #6585
bors[bot] [Wed, 18 Nov 2020 14:01:29 +0000 (14:01 +0000)]
Merge #6585

6585: Link rustc error page and clippy lint page via CodeDescription r=kjeremy a=Veykril

Fixes #6371

This makes the error code in here clickable, same for clippy lints
![image](https://user-images.githubusercontent.com/3757771/99459468-6d110b00-292e-11eb-9cde-d43ec9cebc09.png)

For clippy I just chose the master build of the site as I believe that to be pretty much always the best fitting.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoFill code_description for rust_analyzer diagnostics
Lukas Wirth [Wed, 18 Nov 2020 07:54:52 +0000 (08:54 +0100)]
Fill code_description for rust_analyzer diagnostics