Commit Graph

19091 Commits

Author SHA1 Message Date
Aleksey Kladov
076c972e3b internal: prevent possible bugs when adding magical comments 2021-09-13 13:43:13 +03:00
Aleksey Kladov
c56f041477 internal: simplify 2021-09-13 13:35:31 +03:00
Aleksey Kladov
940b3afd00 internal: fix bugs in tests by simplifying code 2021-09-13 13:29:27 +03:00
Aleksey Kladov
80991356e1 minore: improve readability
Tuples are hard to understand
2021-09-13 12:34:05 +03:00
bors[bot]
c45792ae8f
Merge #10218
10218: minor: Don't spam the manual with warnings r=lnicola a=lnicola

A single warning on the first line should™ be enough. Currently we put that warning on every section, while also breaking the table of contents in the process:

![image](https://user-images.githubusercontent.com/308347/133045747-5232ce04-7856-40fd-a82f-adcefb7a6f5a.png)

Fixes #9657

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-09-13 07:58:28 +00:00
Laurențiu Nicola
b66e506cc2 Don't spam the manual with warnings 2021-09-13 10:56:14 +03:00
bors[bot]
516eb40ba5
Merge #10215
10215: Use correct file syntax node for decl_access computation in find_all_refs r=Veykril a=Veykril

Defs and refs of locals only ever life in one file, this isn't true for fields though.
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10201

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-12 21:21:21 +00:00
Lukas Wirth
95746a99b4 Use correct file syntax node for decl_access computation in find_all_refs 2021-09-12 23:19:23 +02:00
bors[bot]
3e056b9e90
Merge #10213
10213: minor: Improve resilience of match checking r=flodiebold a=iDawer

In bug condition the match checking strives to recover giving false no-error diagnostic.

Suggested in https://github.com/rust-analyzer/rust-analyzer/pull/9105#discussion_r644656085

Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-09-12 12:23:56 +00:00
Dawer
68dfe190ab Improve resilience of match checking
In bug condition the match checking strives to recover giving false no-error diagnostic.
2021-09-12 16:03:12 +05:00
bors[bot]
80552d472d
Merge #10212
10212: fix: Avoid type inference panic on bitslice methods r=flodiebold a=flodiebold

Should fix #10090, fix #10046, and fix #10179.
This is only a workaround, but the proper fix requires some bigger
refactoring (also related to fixing #10058), and this at least prevents
the crash.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-09-12 08:55:17 +00:00
Florian Diebold
a2d9f7d7bb Avoid type inference panic on bitslice methods
Should fix #10090, #10046, #10179.
This is only a workaround, but the proper fix requires some bigger
refactoring (also related to fixing #10058), and this at least prevents
the crash.
2021-09-12 10:49:40 +02:00
bors[bot]
317059985a
Merge #10202
10202: fix: Type param hover shows correct sized bounds. r=flodiebold a=iDawer

Closes  #9949

This adds implicit `: Sized` bound to type parameters at lowering step.

Hovering on type parameter does not show it's `: Sized` bound be it set explicitly or implicitly. This is because it doesn't track that the bound was set implicitly.

### Perf

```rust
./target/rust-analyzer-baseline-3dae94bf -q analysis-stats --memory-usage .
Database loaded:     4.51s, 311minstr, 110mb (metadata 1.08s, 22minstr, 743kb; build 3.20s, 8730kinstr, -237kb)
  crates: 38, mods: 770, decls: 17173, fns: 12835
Item Collection:     29.63s, 85ginstr, 372mb
  exprs: 353460, ??ty: 364 (0%), ?ty: 232 (0%), !ty: 144
Inference:           118.25s, 284ginstr, 601mb
Total:               147.88s, 370ginstr, 973mb

./target/rust-analyzer-hover-ty-param-dfb15292 -q analysis-stats --memory-usage .
Database loaded:     4.53s, 311minstr, 110mb (metadata 1.10s, 22minstr, 743kb; build 3.20s, 8672kinstr, -189kb)
  crates: 38, mods: 770, decls: 17173, fns: 12835
Item Collection:     29.59s, 85ginstr, 372mb
  exprs: 353460, ??ty: 364 (0%), ?ty: 232 (0%), !ty: 144
Inference:           121.69s, 296ginstr, 601mb
Total:               151.28s, 382ginstr, 974mb

```

Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-09-12 07:54:56 +00:00
bors[bot]
d270679997
Merge #10210
10210: minor: make code clearer with ControlFlow r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-11 17:49:55 +00:00
Aleksey Kladov
9b2bac621e minor: make code clearer with ControlFlow 2021-09-11 20:49:10 +03:00
bors[bot]
abdb75912c
Merge #10207
10207: minor: improve readability r=matklad a=matklad

It's important that module interface doesn't depend on features. Better
hide features in bodies.

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-11 15:46:36 +00:00
Aleksey Kladov
e5b813b566 minor: improve readability
It's important that module interface doesn't depend on features. Better
hide features in bodies.
2021-09-11 18:42:38 +03:00
bors[bot]
9aa71ccdb3
Merge #10206
10206: internal: Remove unused dependencies r=lnicola a=gilescope

cargo check --all-targets compiles cleanly without these dependencies for me.

Co-authored-by: Giles Cope <gilescope@gmail.com>
2021-09-11 15:40:04 +00:00
Giles Cope
15312aab58
removing seemingly unused dev deps. 2021-09-11 16:26:36 +01:00
Giles Cope
4ccd90af81
remove unused deps 2021-09-11 16:20:04 +01:00
Dawer
964c7b3211 minor: fix tests. 2021-09-10 23:02:37 +05:00
Dawer
dfb15292c2 fix: Type param hover shows correct sized bounds. 2021-09-10 20:48:39 +05:00
Dawer
9ce3c075ad internal: add implicit : Sized bound to type parameters. 2021-09-10 20:41:53 +05:00
bors[bot]
07fb5db3dc
Merge #10177
10177: fix: Treat path dependencies like workspace members r=jonas-schievink a=jonas-schievink

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

Fixes diagnostics not showing up in path dependencies.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-10 14:14:02 +00:00
bors[bot]
21a1ced8b6
Merge #10193
10193: fix: fix type mismatches with `panic!()` on Rust 1.55.0 r=jonas-schievink a=jonas-schievink

This addresses the regression mentioned in https://github.com/rust-analyzer/rust-analyzer/issues/8961#issuecomment-916332702

(no test because https://github.com/rust-analyzer/rust-analyzer/issues/10192 makes that rather hard, but I've checked that the analysis-stats are back to normal)

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-09 19:34:39 +00:00
Jonas Schievink
9a320bcf38 Support the new rustc_builtin_macro syntax 2021-09-09 21:32:41 +02:00
bors[bot]
8e47e359fa
Merge #10190
10190: minor: Bump deps r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-09-09 18:13:26 +00:00
Laurențiu Nicola
c930dcca13 Bump chalk 2021-09-09 21:12:38 +03:00
Laurențiu Nicola
968000ee96 Bump deps 2021-09-09 21:09:57 +03:00
bors[bot]
92ce768ea3
Merge #10188
10188: fix: add multi-token mapping support to runnables r=jonas-schievink a=lnicola

Closes #10184


changelog fix (first contribution) add multi-token mapping support to runnables

Co-authored-by: Anatol Ulrich <anatol.ulrich@ferrous-systems.com>
2021-09-09 15:07:43 +00:00
Anatol Ulrich
5d08ac20d9 implement #10070 in runnables
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-09 18:02:53 +03:00
bors[bot]
f1bcf975a7
Merge #10186
10186: configure colorizedBracketPairs r=matklad a=IceSentry

The new bracket pair colorization feature of vscode colorizes all brackets no matter the language. In the context of rust colorizing the '<' and  '>' brackets doesn't make sense most of the time, especially in match statements with math like the following screenshot.

![image](https://user-images.githubusercontent.com/8348954/132622418-2edb7580-dc72-42df-894d-682d2882c7e3.png)

Currently this configuration is only possible on a language server level which is why this PR is necessary.

See https://github.com/microsoft/vscode/issues/132175 and https://github.com/microsoft/vscode/issues/132476 for more information on the issue in vscode

Co-authored-by: IceSentry <c.giguere42@gmail.com>
2021-09-09 08:56:33 +00:00
IceSentry
d9e4b231c7 configure colorizedBracketPairs 2021-09-09 00:25:38 -04:00
bors[bot]
1dc4d1ce29
Merge #10185
10185: minor: include `ImplLoc` in panic context r=jonas-schievink a=jonas-schievink

cc https://github.com/rust-analyzer/rust-analyzer/issues/10084

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-09 00:23:00 +00:00
Jonas Schievink
85993171e5 minor: include ImplLoc in panic context 2021-09-09 02:20:55 +02:00
bors[bot]
22162aa363
Merge #10093
10093: fix: Remove incorrectly filtering VS Code cargo task execution resolution by scope r=oeed a=oeed

This fixes #9093 ​introduced by #8995.

A filter was present on the function that adds the execution definition to Cargo tasks. This would mean Cargo tasks defined in workspaces (i.e. `.code-workspace` files) would not be given an execution, leading to a `There is no task provider registered for tasks of type "cargo".` error as descibed in #9093. I have made a minimum reproduction setup [here](https://github.com/oeed/ra-workspace).

This PR essentially removes that check. The `if (scope) { ... }` is to handle the case where `task.scope === undefined` using a deprecated constructor. I'm not sure if that is ever likely to occur and can remove if not needed.

There is some discussion about whether it's necessary to filter the tasks before building them. From my understanding, it shouldn't be needed as we should provide an execution for all `cargo` tasks; but I'm not overly familiar with VS Code internals so I could be wrong. For more info please see [the discussion](https://github.com/rust-analyzer/rust-analyzer/pull/8995#issuecomment-908920395) on #8995

Co-authored-by: Oliver Cooper <oliver.cooper@me.com>
2021-09-08 22:34:59 +00:00
Oliver Cooper
d246a5f58b
Undefined scope comment 2021-09-09 08:50:24 +12:00
bors[bot]
6a8062092b
Merge #10174
10174: fix: path display error when start with `crate` r=flodiebold a=dzvon

Fixes  #10172

Co-authored-by: Dezhi Wu <wu543065657@163.com>
2021-09-08 14:40:54 +00:00
bors[bot]
108b0809e0
Merge #10180
10180: Fix resolution for inherent array methods r=flodiebold a=yotamofek

My second attempt at fixing #9992 , previous attempt was here: #10017 , but the logic was broken.

I know that this is not an ideal solution.... that would require, IIUC, a pretty big overhaul of the const generics handling in `rust-analyzer`. But, given that some of the array methods were/are being stabilized (e.g. https://github.com/rust-lang/rust/pull/87174 ), I think it'll be very beneficial to `rust-analyzer` users to have some preliminary support for them. (I know it's something I've been running into quite a lot lately :) )

As far as my limited understanding of this project's architecture goes, I think this isn't the worst hack in the world, and shouldn't be too much of a hassle to undo if/when const generics become better supported. If the maintainers deem this approach viable, I'll want to add some comments, emphasizing the purpose of this code, and that it should be removed at some point in the future.

Co-authored-by: Yotam Ofek <yotam.ofek@gmail.com>
2021-09-08 12:46:34 +00:00
Yotam Ofek
ebb891246c Split and document array method resolution logic. 2021-09-08 13:15:40 +03:00
Yotam Ofek
9593fe684d Fix resolution of inherent array methods. 2021-09-08 11:49:05 +03:00
Yotam Ofek
1785493cae Add (failing) test for inherent array method resolution. 2021-09-08 11:00:55 +03:00
Oliver Cooper
001608914b Removed deprecated Task constructor 2021-09-08 10:46:31 +12:00
Jonas Schievink
e241015a75 Rename is_member to is_local 2021-09-07 17:29:58 +02:00
Jonas Schievink
8a4c35a068 Treat path dependencies like workspace members 2021-09-07 17:26:21 +02:00
Dezhi Wu
87436a08fa fix super path wrong display 2021-09-07 17:49:46 +08:00
Dezhi Wu
880af425d4 fix path wrong display 2021-09-07 16:54:02 +08:00
Dezhi Wu
6d2154e409 cargo fmt 2021-09-07 14:50:33 +08:00
Dezhi Wu
82ae228d98 fix: path display error when start with crate 2021-09-07 14:44:30 +08:00
bors[bot]
3dae94bf2b
Merge #10169
10169: internal: parser cleanup r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-06 15:55:34 +00:00