Commit graph

9652 commits

Author SHA1 Message Date
bors[bot]
d426462b48
Merge #4007
4007: Reduce allocations when looking up proc macro decl r=edwin0cheng a=lnicola

`libserde_derive` has about 21K symbols on Linux. It's not much, but let's ~~not be wasteful~~ avoid the allocations anyway.

r? @edwin0cheng

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-04-17 08:32:20 +00:00
Benjamin Coenen
828f69ce54 tests: add more info about what failed in tidy tests
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-17 10:32:12 +02:00
Benjamin Coenen
0a1585075c Merge branch 'master' of github.com:rust-analyzer/rust-analyzer 2020-04-17 10:30:39 +02:00
Benjamin Coenen
071ef268b5 feat: improve dot completions with scoring
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-17 10:29:32 +02:00
Laurențiu Nicola
02b96d522c Reduce allocations when looking up proc macro decl 2020-04-17 11:12:05 +03:00
Edwin Cheng
ef6ee16006 Fix path for proc-macro in nightly / stable build 2020-04-17 04:45:03 +08:00
bors[bot]
8d296be109
Merge #3995
3995: Separate project discovery from project loading r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-16 20:36:19 +00:00
Aleksey Kladov
422ae477ce Unmix error handling when discovering workspaces
Hitting an io::Error is a legit problem. Finding more than one
Cargo.toml is not.
2020-04-16 22:35:50 +02:00
bors[bot]
10d8cb913c
Merge #3958
3958: Add proc-macro related config and tests r=matklad a=edwin0cheng

This PR do the following things:

1. Add cli argument `proc-macro` for running proc-macro server.
2. Added support for proc-macro in bench and analysis-stats
3. Added typescript config for proc-macros
4. Added an heavy test for proc-macros. 

To test it out: 

1. run `cargo xtask install --proc-macro`
2. add `"rust-analyzer.cargo.loadOutDirsFromCheck": true"` and `"rust-analyzer.procMacro.enabled": true"` in vs code config.

[Edit] Change to use `rust-analyzer proc-macro` for running proc-macro standalone process.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-16 20:21:59 +00:00
Edwin Cheng
16a74cfd23 Remove ci changes 2020-04-17 04:11:49 +08:00
Edwin Cheng
b4c5ee33ae Fix extern_process args 2020-04-17 04:08:01 +08:00
Aleksey Kladov
be2654b0ed Decouple project loading from project discovery a bit 2020-04-16 22:02:10 +02:00
bors[bot]
a4cda3efbb
Merge #3994
3994: Don't expose SyntaxNodePtr impl details r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-04-16 19:01:30 +00:00
Aleksey Kladov
cae2498513 Don't expose SyntaxNodePtr impl details 2020-04-16 21:01:04 +02:00
Benjamin Coenen
6ebc8bbeb0 feat: improve dot completions with scoring
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-16 18:30:08 +02:00
bors[bot]
fc0a47a0c1
Merge #3992
3992: cargo update r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-04-16 13:45:12 +00:00
Edwin Cheng
177becea98 Add proc-macro cli command for rust-analyzer 2020-04-16 21:13:57 +08:00
kjeremy
45b0826499 cargo update 2020-04-16 09:13:44 -04:00
bors[bot]
0390d62168
Merge #3979
3979: fix missing match arm false positive for enum with no variants r=flodiebold a=JoshMcguigan

fixes #3974

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-04-16 12:57:31 +00:00
bors[bot]
7d60a446fc
Merge #3990
3990: Switch to Chalk recursive solver r=matklad a=flodiebold

Before:
```
Expressions of unknown type: 5526 (3%)
Expressions of partially unknown type: 5415 (3%)
```
After:
```
Expressions of unknown type: 4600 (2%)
Expressions of partially unknown type: 4645 (2%)
```

On the other hand,
```
'./target/release/rust-analyzer analysis-stats -q . # old solver' ran
    1.24 ± 0.04 times faster than 'rust-analyzer analysis-stats -q . # new solver'
```
I think part of this just comes from the fact that we're inferring more types now; but apart from that, it should be possible to improve the performance a bunch, and I'll make looking into that a priority.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-16 12:50:19 +00:00
Josh Mcguigan
360bdf653b fix false positive for enum with no variants 2020-04-16 05:37:49 -07:00
Edwin Cheng
ca7dc69a8e Add tests for proc_macro 2020-04-16 19:28:06 +08:00
Edwin Cheng
a4b0ce07f8 Add config for proc_macro 2020-04-16 19:28:06 +08:00
Edwin Cheng
22e33f308a Add with-proc-macro in bench ,stats and diagnositcs 2020-04-16 19:27:44 +08:00
Florian Diebold
39fe3a6486 Test for non-working proc macro server assoc types 2020-04-16 13:06:23 +02:00
Florian Diebold
14570df015 Switch Chalk to recursive solver
+ various fixes related to that.
2020-04-16 13:06:23 +02:00
bors[bot]
364415b7d6
Merge #3989
3989: Update Chalk r=flodiebold a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-16 10:50:21 +00:00
Florian Diebold
e8d0d79a0c Update Chalk 2020-04-16 12:39:00 +02:00
bors[bot]
aa887d7ab4
Merge #3948
3948: fix: inlay hints config desyncronization between the frontend and the backend r=matklad a=Veetaha

See the explanation in the issue comment:
https://github.com/rust-analyzer/rust-analyzer/issues/3924#issuecomment-612444566

Workaround-ly fixes: #3924

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-04-16 09:35:42 +00:00
Benjamin Coenen
06076f95a7 feat: improve dot completions in a struct literal expression
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-15 22:10:57 +02:00
bors[bot]
f1a07dbf55
Merge #3962
3962: Fix parentModule shortcut conflict r=matklad a=CodeSandwich

The default parentModule shortcut conflicts with VSCode's built-in undo selection

Co-authored-by: Igor Żuk <igor.zuk@protonmail.com>
2020-04-15 10:11:20 +00:00
bors[bot]
1e0ba04033
Merge #3966 #3968
3966: Add support for bounds on associated types in trait definitions r=matklad a=flodiebold

E.g.
```rust
trait Trait {
    type Item: SomeOtherTrait;
}
```
Note that these don't simply desugar to where clauses; as I understand it, where clauses have to be proved by the *user* of the trait, but these bounds are proved by the *implementor*. (Also, where clauses on associated types are unstable.)

(Another one from my recursive solver branch...)

3968: Remove format from syntax_bridge hot path r=matklad a=edwin0cheng

Although only around 1% speed up by running:

```
Measure-Command {start-process .\target\release\rust-analyzer "analysis-stats -q ." -NoNewWindow -wait}
```

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-15 09:29:36 +00:00
bors[bot]
d61909f904
Merge #3964 #3965 #3967
3964: Nicer Chalk debug logs r=matklad a=flodiebold

I'm looking at a lot of Chalk debug logs at the moment, so here's a few changes to make them slightly nicer...

3965: Implement inline associated type bounds r=matklad a=flodiebold

Like `Iterator<Item: SomeTrait>`.

This is an unstable feature, but it's used in the standard library e.g. in the definition of Flatten, so we can't get away with not implementing it :)

(This is cherry-picked from my recursive solver branch, where it works better, but I did manage to write a test that works with the current Chalk solver as well...)

3967: Handle `Self::Type` in trait definitions when referring to own associated type r=matklad a=flodiebold

It was implemented for other generic parameters for the trait, but not for `Self`.

(Last one off my recursive solver branch 😄 )

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-15 09:19:46 +00:00
bors[bot]
9726401eae
Merge #3963
3963: Upgrade Chalk r=matklad a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-04-15 09:08:39 +00:00
bors[bot]
923efa72bd
Merge #3969
3969: Change add_function assist to use todo!() instead of unimplemented!() r=matklad a=TimoFreiberg

In the spirit of #3935

Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
2020-04-15 08:55:44 +00:00
bors[bot]
61cb87e506
Merge #3976
3976: Bump @types/vscode and vscode-languageclient r=matklad a=kjeremy

Brings us inline with proposed LSP 3.16.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-04-15 08:43:15 +00:00
bors[bot]
d6327297e4
Merge #3978
3978: insta 0.16 r=matklad a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-04-15 08:31:18 +00:00
bors[bot]
b495e56b0d
Merge #3971
3971: add diagnostics subcommand to rust-analyzer CLI r=JoshMcguigan a=JoshMcguigan

This PR adds a `diagnostics` subcommand to the rust-analyzer CLI. The intent is to detect all diagnostics on a workspace. It returns a non-zero status code if any error diagnostics are detected. Ideally I'd like to run this in CI against the rust analyzer project as a guard against false positives.

```
$ cargo run --release --bin rust-analyzer -- diagnostics .
```

Questions for reviewers:

1. Is this the proper way to get all diagnostics for a workspace? It seems there are at least a few ways this can be done, and I'm not sure if this is the most appropriate mechanism to do this.
2. It currently prints out the relative file path as it is collecting diagnostics, but it doesn't print the crate name. Since the file name is relative to the crate there can be repeated names, so it would be nice to print some identifier for the crate as well, but it wasn't clear to me how best to accomplish this. 

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-04-14 23:35:50 +00:00
Josh Mcguigan
6be972770e diagnostics cli, iterate over members 2020-04-14 16:26:03 -07:00
kjeremy
eedab116ab insta 0.16 2020-04-14 13:57:02 -04:00
Benjamin Coenen
c5d18f570c add sort_text to sort in editor view
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-14 19:28:33 +02:00
Benjamin Coenen
b092bbc83d Merge branch 'master' of github.com:rust-analyzer/rust-analyzer 2020-04-14 19:20:30 +02:00
kjeremy
d7efe54515 Bump @types/vscode and vscode-languageclient 2020-04-14 10:20:16 -04:00
Josh Mcguigan
f9701efbe7 cli diagnostics walk files 2020-04-14 04:35:34 -07:00
Josh Mcguigan
f62c73a972 add diagnostics subcommand to rust-analyzer CLI 2020-04-13 18:40:41 -07:00
Timo Freiberg
1231418f31 Change add_function assist to use todo!() 2020-04-13 22:17:06 +02:00
bors[bot]
c82e7696e6
Merge #3961
3961: Fix double comma when merge imports on second line r=edwin0cheng a=IceSentry

This fixes the bug when merging imports from the second line when it already has a comma it would previously insert a comma.

There's probably a better way to check for a COMMA. 

This also ends up with a weird indentation, but rust-fmt can easily deal with it so I'm not sure how to resolve that.

Closes #3832

Co-authored-by: IceSentry <c.giguere42@gmail.com>
2020-04-13 18:03:12 +00:00
IceSentry
ed0eedb1dd Fix PR 2020-04-13 13:59:30 -04:00
Edwin Cheng
464af68ec5 Remove format from syntax_bridge hot path 2020-04-14 01:23:33 +08:00
bors[bot]
d075f49e6d
Merge #3960
3960: ellipsis in tuple patterns r=JoshMcguigan a=JoshMcguigan

This PR lowers ellipsis in tuple patterns. It fixes a bug in the way ellipsis were previously lowered (by replacing the ellipsis with a single `Pat::Wild` no matter how many items the `..` was taking the place of).

It also uses this new information to properly handle `..` in tuple struct patterns when perform match statement exhaustiveness checks.

While this PR provides the building blocks for match statement exhaustiveness checks for tuples, there are some additional challenges there, so that is still unimplemented (unlike tuple structs).

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2020-04-13 15:20:17 +00:00