Commit graph

12257 commits

Author SHA1 Message Date
bors[bot]
b8dfc331ab
Merge #5682
5682: Add an option to disable diagnostics r=matklad a=popzxc

As far as I know, currently it's not possible to disable a selected type of diagnostics provided by `rust-analyzer`.

This causes an inconvenient situation with a false-positive warnings: you either have to disable all the diagnostics, or you have to ignore these warnings.

There are some open issues related to this problem, e.g.: https://github.com/rust-analyzer/rust-analyzer/issues/5412, https://github.com/rust-analyzer/rust-analyzer/issues/5502

This PR attempts to make it possible to selectively disable some diagnostics on per-project basis.

Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
2020-08-18 12:04:49 +00:00
bors[bot]
2252a65f23
Merge #5687
5687: Fix document symbols order r=matklad a=magurotuna

Resolves #5655 
And adds tests for `handle_document_symbol`, both with `hierarchical_symbols` enabled and with it disabled.

Previously document symbols were displayed in reverse order  in sublime text with its LSP plugin, but this patch fixes it like this:

![image](https://user-images.githubusercontent.com/23649474/89709020-fbccce00-d9b6-11ea-83b0-c88dc9f7977f.png)


Co-authored-by: Yusuke Tanaka <yusuktan@maguro.dev>
2020-08-18 11:58:02 +00:00
bors[bot]
5dfb1e054a
Merge #5793
5793: Minor
 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-18 11:20:54 +00:00
Aleksey Kladov
9389e313d0 Minor 2020-08-18 13:20:28 +02:00
bors[bot]
a95c5e2121
Merge #5758
5758: SSR: Explicitly autoderef and ref placeholders as needed r=matklad a=davidlattimore

Structural search replace now inserts *, & and &mut in the replacement to match any auto[de]ref in the matched code.

e.g. `$a.foo() ==>> bar($a)` might convert `x.foo()` to `bar(&mut x)`

Co-authored-by: David Lattimore <dml@google.com>
2020-08-18 10:52:27 +00:00
David Lattimore
29e6238cb7 SSR: A few small refactorings 2020-08-18 20:39:55 +10:00
Igor Aleksanov
34847c8d96 Move analysis config structure to the config.rs 2020-08-18 13:35:36 +03:00
Igor Aleksanov
b56cfcca10 Make disabled diagnostics an argument of corresponding function 2020-08-18 13:32:29 +03:00
bors[bot]
5d97db8d48
Merge #5791
5791: ⬆️ crates
 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-18 09:21:11 +00:00
Aleksey Kladov
88adca766a ⬆️ crates 2020-08-18 11:20:45 +02:00
Aleksey Kladov
90cb4bbbb9 Remove usless pre-cache task
We are not cleaning the rest of xtask artifacts, so this effectively
does nothing. xtask is small and changes rarely, so this shouldn't
really matter.
2020-08-18 11:19:44 +02:00
bors[bot]
620d67322a
Merge #5790
5790: Revive cache cleaning
 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-18 09:08:00 +00:00
Aleksey Kladov
6cff076513 Revive cache cleaning
The idea here is that, on CI, we only want to cache crates.io
dependencies, and not local crates. This keeps the size of the cache
low, and also improves performance, as network and moving files on
disk (on Windows) can be slow.
2020-08-18 11:07:21 +02:00
Aleksey Kladov
80ab6c8cd5 Re-enable mac build 2020-08-18 09:38:32 +02:00
bors[bot]
3932874794
Merge #5787
5787: Fix missing match arm false positive r=matklad a=CAD97

If the type of the match expression is `{unknown}`, don't do exhaustiveness checks, as it could be an uninhabited type.

Co-authored-by: CAD97 <cad97@cad97.com>
2020-08-18 07:25:57 +00:00
CAD97
c822bb68ce Fix missing match arm false error on unknown type 2020-08-17 13:27:12 -04:00
CAD97
2eaf79cfbb Document missing match arm false positive
This should already be guarded against
(d2212a49f6/crates/hir_ty/src/diagnostics/expr.rs (L225-L230))
but it isn't preventing this false positive for some reason.
2020-08-17 13:19:15 -04:00
bors[bot]
7d95a8447c
Merge #5776 #5780
5776: Fix eslint errors on .eslintrc.js and rollup.config.js r=matklad a=fuafa

Eslint complains if these two files does not include in the `tsconfig.json`.
```
Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: .eslintrc.js.
The file must be included in at least one of the projects provided.eslint
```
![image](https://user-images.githubusercontent.com/20750310/90338269-176d4f80-e01b-11ea-8710-3ea817b235d2.png)



5780: Fixup whitespace when adding missing impl items r=matklad a=jDomantas

Generate properly formatted whitespace when adding impl items - with an empty line between items and removing extra whitespace that often appears at the end.

This is my first time working on rust analyzer so I'm not very familiar with its internal APIs. If there's a better way to do such syntax tree editing I'd be glad to hear it.

Co-authored-by: xiaofa <xiaofalzx@gmail.com>
Co-authored-by: jDomantas <djadenkus@gmail.com>
2020-08-17 14:30:24 +00:00
bors[bot]
6826dd044a
Merge #5782
5782: Fix StatusNotification r=matklad a=vsrs

This PR fixes the following:

As per specification `params` property in [NotificationMessage ](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#notificationMessage) should be `array | object` while RA uses `"loading" | "ready" | "invalid" | "needsReload"`.

Co-authored-by: vsrs <vit@conrlab.com>
2020-08-17 14:23:03 +00:00
bors[bot]
64bbdb5bc7
Merge #5785
5785: Don't make fields private unless you have to
 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-17 14:13:07 +00:00
Aleksey Kladov
6a4c9fc9fd Don't make fields private unless you have to 2020-08-17 16:11:29 +02:00
bors[bot]
df22547276
Merge #5784
5784: Mention that generated .adocs are generaterd
 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-17 13:50:13 +00:00
Aleksey Kladov
b82d967182 Mention that generated .adocs are generaterd 2020-08-17 15:49:46 +02:00
vsrs
1eed036a6e Fix StatusNotification 2020-08-17 14:56:27 +03:00
jDomantas
a565a42f46 format 2020-08-17 11:36:46 +03:00
jDomantas
38e3088a56 update generated tests 2020-08-17 10:47:13 +03:00
bors[bot]
0b2b9a5508
Merge #5766
5766: Hacky support for fn-like proc macros r=matklad a=jonas-schievink

It turns out that this is all that's needed to get something like this working:

```rust
#[proc_macro]
pub fn function_like_macro(_args: TokenStream) -> TokenStream {
    TokenStream::from_str("fn fn_success() {}").unwrap()
}
```

```rust
function_like_macro!();

fn f() {
    fn_success();
}
```

The drawback is that it also makes this work, because there is no distinction between different proc macro kinds in the rest of r-a:

```rust
#[derive(function_like_macro)]
struct S {}

fn f() {
    fn_success();
}
```

Another issue is that it seems to panic, and then panic, when using this on the rustc code base, due to some issue in the inscrutable proc macro bridge code.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-08-16 20:03:06 +00:00
bors[bot]
6deb9087bb
Merge #5778
5778: Chalk 0.23 r=kjeremy a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-08-16 16:18:55 +00:00
Jeremy Kolb
409090e74c Chalk 0.23 2020-08-16 12:15:44 -04:00
bors[bot]
76bd27be89
Merge #5777
5777: Bump rustc_lexer r=kjeremy a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-08-16 16:01:52 +00:00
Jeremy Kolb
7819e794db Bump rustc_lexer 2020-08-16 11:57:10 -04:00
bors[bot]
728feea086
Merge #5775
5775: Bump chrono r=kjeremy a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-08-16 15:40:09 +00:00
Jeremy Kolb
9aca8d6647 Update chrono 2020-08-16 11:34:13 -04:00
xiaofa
951fc3f65a Fix eslint errors on .eslintrc.js and rollup.config.js 2020-08-16 23:28:26 +08:00
Yusuke Tanaka
e8e1eb4263
Remove test for handle_document_symbol 2020-08-17 00:19:29 +09:00
bors[bot]
3b206ff756
Merge #5770
5770: Fix typo in comment r=kjeremy a=rockerBOO



Co-authored-by: Dave Lage <rockerboo@gmail.com>
2020-08-15 20:47:08 +00:00
Dave Lage
d31634940d
Fix typo in comment 2020-08-15 16:37:44 -04:00
bors[bot]
b5023e25e3
Merge #5769
5769: Don't expose hir::Path out of hir
 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-15 16:53:15 +00:00
Aleksey Kladov
0ca1ba29e8 Don't expose hir::Path out of hir
Conjecture: it's impossible to use hir::Path *correctly* from an IDE.

I am not entirely sure about this, and we might need to add it back at
some point, but I have to arguments that convince me that we probably
won't:

* `hir::Path` has to know about hygiene, which an IDE can't set up
  properly.

* `hir::Path` lacks identity, but you actually have to know identity
  to resolve it correctly
2020-08-15 18:50:41 +02:00
bors[bot]
19c41a9152
Merge #5768
5768: Remove deprecated Path::from_ast
 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-15 16:23:13 +00:00
Aleksey Kladov
2052d33b9b Remove deprecated Path::from_ast
Long term, we probably should make hir::Path private to hir.
2020-08-15 18:22:16 +02:00
Jonas Schievink
bee56e68a3 Hacky support for fn-like proc macros 2020-08-15 15:34:56 +02:00
bors[bot]
f0ad68b962
Merge #5762
5762: Add a proc_macro_test crate r=jonas-schievink a=jonas-schievink

This exports all 3 kinds of proc macros and is useful for testing.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-08-14 22:29:04 +00:00
Jonas Schievink
cb816b1ea8 Add a proc_macro_test crate
This exports all 3 kinds of proc macros and is useful for testing
2020-08-15 00:27:32 +02:00
bors[bot]
c2594daf29
Merge #5347
5347: Chalk writer integration r=flodiebold a=detrumi

~~This adds a `rust-analyzer dump-chalk` command, similar to analysis-stats, which writes out the whole chalk progam (see [chalk#365](https://github.com/rust-lang/chalk/issues/365) for more info about the .chalk writer)~~

Write out chalk programs in debug output if chalk debugging is active (using `CHALK_DEBUG`).

Example output:
```
[DEBUG ra_hir_ty::traits] solve(UCanonical { canonical: Canonical { value: InEnvironment { environment: Env([]), goal: Implemented(SeparatorTraitRef(?)) }, binders: [] }, universes: 1 }) => None
[INFO  ra_hir_ty::traits] trait_solve_query(Implements(fn min<?0.0>(?0.0, ?0.0) -> ?0.0: Deref))
[DEBUG ra_hir_ty::traits] solve goal: UCanonical { canonical: Canonical { value: InEnvironment { environment: Env([]), goal: Implemented(SeparatorTraitRef(?)) }, binders: [U0 with kind type] }, universes: 1 }
[DEBUG ra_hir_ty::traits::chalk] impls_for_trait Deref
[DEBUG ra_hir_ty::traits::chalk] impls_for_trait returned 0 impls
[DEBUG ra_hir_ty::traits::chalk] trait_datum Ord
[DEBUG ra_hir_ty::traits::chalk] trait Ord = Name(Text("Ord"))
[DEBUG ra_hir_ty::traits] chalk program:
    #[upstream]
    #[non_enumerable]
    #[object_safe]
    trait Ord {}
    #[upstream]
    #[non_enumerable]
    #[object_safe]
    #[lang(sized)]
    trait Sized {}
    fn fn_0<_1_0>(arg_0: _1_0, arg_1: _1_0) -> _1_0
    where
      _1_0: Ord;
    #[upstream]
    #[non_enumerable]
    #[object_safe]
    trait Deref {
      type Assoc_1829: Sized;
    }
    
[DEBUG ra_hir_ty::traits] solve(UCanonical { canonical: Canonical { value: InEnvironment { environment: Env([]), goal: Implemented(SeparatorTraitRef(?)) }, binders: [U0 with kind type] }, universes: 1 }) => None
[INFO  ra_hir_ty::traits] trait_solve_query(Implements(?0.0: Ord))
```

Co-authored-by: Wilco Kusee <wilcokusee@gmail.com>
2020-08-14 17:02:55 +00:00
bors[bot]
f7abd16a8c
Merge #5760
5760: Document xtask has few deps invariant
 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-14 15:30:53 +00:00
Aleksey Kladov
1d11c9c91a Document xtask has few deps invariant 2020-08-14 17:30:27 +02:00
bors[bot]
3b5947e1cd
Merge #5759
5759: Rename hypothetical -> speculative
 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-14 13:23:58 +00:00
Aleksey Kladov
125744c057 Rename hypothetical -> speculative 2020-08-14 15:23:27 +02:00
jDomantas
9f548a0295 fixup whitespace when adding missing impl items 2020-08-14 16:10:52 +03:00