]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoMerge #11904
bors[bot] [Tue, 5 Apr 2022 15:48:09 +0000 (15:48 +0000)]
Merge #11904

11904: internal: Wrap macros in expr position in `MacroExpr` node r=jonas-schievink a=jonas-schievink

This lets us distinguish them from macros in item position just by looking at the syntax tree.

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

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoWrap macros in expr position in `MacroExpr` node
Jonas Schievink [Tue, 5 Apr 2022 15:42:07 +0000 (17:42 +0200)]
Wrap macros in expr position in `MacroExpr` node

2 years agoMerge #11899
bors[bot] [Mon, 4 Apr 2022 20:08:37 +0000 (20:08 +0000)]
Merge #11899

11899: fix: Skip match check on patterns of unexpected TyKind::FnDef r=Veykril a=iDawer

Match checking does not expect patterns of `TyKind::FnDef` type.
It seems that in _rustc_ match checking is ruled out due to such type errors at the typecheck stage.

Spotted in #11319

Co-authored-by: iDawer <ilnur.iskhakov.oss@outlook.com>
2 years agofix: Skip match check on a pattern of unexpected TyKind::FnDef
iDawer [Mon, 4 Apr 2022 19:05:20 +0000 (00:05 +0500)]
fix: Skip match check on a pattern of unexpected TyKind::FnDef

2 years agoMerge #11896
bors[bot] [Mon, 4 Apr 2022 14:14:26 +0000 (14:14 +0000)]
Merge #11896

11896: fix: Show the path to be created in the unresolved-module fix label r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Show the path to be created in the unresolved-module fix label
Lukas Wirth [Mon, 4 Apr 2022 13:54:29 +0000 (15:54 +0200)]
fix: Show the path to be created in the unresolved-module fix label

2 years agoMerge #11894
bors[bot] [Mon, 4 Apr 2022 13:06:51 +0000 (13:06 +0000)]
Merge #11894

11894: complete pattern args based on type name r=Veykril a=cameron1024

Addresses #11892

Changes function argument completion to cover a case like this:
```rust
struct Foo { bar: i32 }

fn qux(Foo { bar }: Foo) {
  println!("{bar}");
}
```
When completing the function call for `qux`, instead of expanding to `qux(_)`, it will now expand to `qux(foo)` (based on the snake-cased version of the name of the ADT)

Non ADTs are unaffected

Co-authored-by: cameron <cameron.studdstreet@gmail.com>
Co-authored-by: cameron1024 <cameron.studdstreet@gmail.com>
2 years agoUpdate crates/ide_completion/src/render/function.rs
cameron1024 [Mon, 4 Apr 2022 12:33:14 +0000 (13:33 +0100)]
Update crates/ide_completion/src/render/function.rs

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix type error
cameron [Mon, 4 Apr 2022 13:30:49 +0000 (14:30 +0100)]
fix type error

2 years agoremove unwarp on adt name
cameron [Mon, 4 Apr 2022 13:28:15 +0000 (14:28 +0100)]
remove unwarp on adt name

2 years agocomplete pattern args based on type name
cameron [Mon, 4 Apr 2022 12:51:51 +0000 (13:51 +0100)]
complete pattern args based on type name

2 years agoMerge #11865
bors[bot] [Sun, 3 Apr 2022 18:46:45 +0000 (18:46 +0000)]
Merge #11865

11865: Fix: Select correct insert position for disabled group import r=jonasbb a=jonasbb

The logic for importing with and without `group_imports` differed
significantly when no previous group existed. This lead to the problem
of using the wrong position when importing inside a module (#11585) or
when inner attributes are involved.
The existing code for grouped imports is better and takes these things
into account.

This PR changes the flow to use the pre-existing code for adding a new
import group even for the non-grouped import settings.
Some coverage markers are updated and the `group` is removed, since they
are now invoked in both cases (grouping and no grouping).

Tests are updated and two tests (empty module and inner attribute) are
added.

Fixes #11585

Co-authored-by: Jonas Bushart <jonas@bushart.org>
2 years agoUse check_count! instead of multiple check! in separate scopes
Jonas Bushart [Sun, 3 Apr 2022 18:34:06 +0000 (18:34 +0000)]
Use check_count! instead of multiple check! in separate scopes

Changes are based on the review feedback by Veykril.

2 years agoMerge #11890
bors[bot] [Sun, 3 Apr 2022 15:19:01 +0000 (15:19 +0000)]
Merge #11890

11890: Delete FUNDING.yml r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoDelete FUNDING.yml
Lukas Wirth [Sun, 3 Apr 2022 15:18:41 +0000 (17:18 +0200)]
Delete FUNDING.yml

2 years agoMerge #11887
bors[bot] [Sun, 3 Apr 2022 13:42:15 +0000 (13:42 +0000)]
Merge #11887

11887: fix: Add missing fields diagnostic fix for patterns r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Add missing fields diagnostic fix for patterns
Lukas Wirth [Sun, 3 Apr 2022 13:11:04 +0000 (15:11 +0200)]
fix: Add missing fields diagnostic fix for patterns

2 years agoMerge #11699
bors[bot] [Sun, 3 Apr 2022 12:42:52 +0000 (12:42 +0000)]
Merge #11699

11699: feat: assist to remove unneeded `async`s r=Ethiraric a=Ethiraric

This should fix #11392

This PR adds a quickfix on functions marked with `async` that suggests, if and only if no `await` expression in find in the body of the function (it relies on `SyntaxNode::descendants()` to recursively traverse blocks), to remove the `async` keyword.

The lint is made so that it triggers only if the cursor is not in the body of the function, so that it does not pollute the quickfix list.

It does not trigger a diagnostic. I don't know if this repository is the place to implement those (`clippy`?). If it is, I would very much like pointers on where to start looking.

If there are test cases I haven't thought about, please do suggest.

Co-authored-by: Ethiraric <ethiraric@gmail.com>
2 years agofeat: assist to remove unneeded `async`s
Ethiraric [Sun, 13 Mar 2022 20:56:34 +0000 (21:56 +0100)]
feat: assist to remove unneeded `async`s

2 years agoMerge #10802
bors[bot] [Sun, 3 Apr 2022 12:03:46 +0000 (12:03 +0000)]
Merge #10802

10802: Allow clients to configure the global workspace search limit r=Veykril a=knutwalker

Playing around with [helix](https://helix-editor.com) I realized that the global worksapce symbol search works different compared to vs-code.
Helix requires all possible symbols in one query and does no subsequent refinement searched.
This PR adds a configuration option to override the default search limit with the default being the currently hardocded value.
Helix users can increment this limit for their instance with a config like

```toml
[[language]]
name = "rust"
language-server = { command = "rust-analyzer" }
[language.config]
workspace = { symbol = { search = { limit = 65536 }}}
```

Other editors are not affected by this change.

Co-authored-by: Paul Horn <dev@knutwalker.engineer>
2 years agoMerge test functions using the same coverage marks to avoid parallelism
Jonas Bushart [Sun, 3 Apr 2022 12:01:11 +0000 (12:01 +0000)]
Merge test functions using the same coverage marks to avoid parallelism

2 years agoMerge #11866
bors[bot] [Sun, 3 Apr 2022 11:49:23 +0000 (11:49 +0000)]
Merge #11866

11866: fix: Prevent underflow in range conversion  r=Veykril a=skyfmmf

Previously, when line numbers of Rust spans were converted to LSP ranges, they could underflow resulting in very large line numbers. As an underflow is always wrong, prevent it and use 0 instead.

This was noticed when opening an empty file in `src/bin/` of a library crate. In this case rustc produces a span with `"line_start": 0, "line_end": 0` resulting in the underflow.

Co-authored-by: Felix Maurer <felix@felix-maurer.de>
2 years agoMerge #11886
bors[bot] [Sun, 3 Apr 2022 11:13:46 +0000 (11:13 +0000)]
Merge #11886

11886: add test for postfix completion relevance r=matklad a=matklad

Follow up to #11857, add a test and cov-marks

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agoadd test for postfix completion relevance
Aleksey Kladov [Sun, 3 Apr 2022 11:09:55 +0000 (12:09 +0100)]
add test for postfix completion relevance

Follow up to #11857, add a test and cov-marks

2 years agoMerge #11821
bors[bot] [Sun, 3 Apr 2022 07:14:14 +0000 (07:14 +0000)]
Merge #11821

11821: minor: Bump npm deps r=lnicola a=lnicola

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoMerge #11879
bors[bot] [Sun, 3 Apr 2022 07:05:41 +0000 (07:05 +0000)]
Merge #11879

11879: Suggest infered type in auto complete r=HKalbasi a=HKalbasi

fix #11855

It doesn't work for return types and consts (so their tests are failing) because I can't find their body node in the original file. (Are these original and fake file documented somewhere?)

Also it currently needs to type first character of the type (or manual ctrl+space) to open the auto complete panel, is it possible to open it automatically on typing `:` and `->`?

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2 years agoLoad @hpcc-js/wasm as a script, not worker
Laurențiu Nicola [Sun, 3 Apr 2022 07:05:36 +0000 (10:05 +0300)]
Load @hpcc-js/wasm as a script, not worker

2 years agosuggest infered type in auto complete
hkalbasi [Sat, 2 Apr 2022 11:49:36 +0000 (16:19 +0430)]
suggest infered type in auto complete

2 years agoMerge #11877
bors[bot] [Sat, 2 Apr 2022 22:12:59 +0000 (22:12 +0000)]
Merge #11877

11877: fix: splitting path of a glob import wrongly adds `self` r=Veykril a=iDawer

Close  #11703

`ast::UseTree::split_prefix` handles globs now.
Removed an extra branch for globs in `ide_db::imports::merge_imports::recursive_merge` (superseeded by split_prefix).

Co-authored-by: iDawer <ilnur.iskhakov.oss@outlook.com>
2 years agoMerge #11882
bors[bot] [Sat, 2 Apr 2022 14:19:38 +0000 (14:19 +0000)]
Merge #11882

11882: internal: Record outline child modules with missing backing file in def map r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agointernal: outline child modules with missing backing file
Lukas Wirth [Sat, 2 Apr 2022 14:14:19 +0000 (16:14 +0200)]
internal: outline child modules with missing backing file

2 years agoMerge #11881
bors[bot] [Sat, 2 Apr 2022 13:40:08 +0000 (13:40 +0000)]
Merge #11881

11881: fix: Don't rely on lang items to find primitive impls r=flodiebold a=flodiebold

rustc has removed the use of lang items to mark the primitive impls, so just look through the crate graph for them (this should be fine performance-wise since we cache the crates that contain these impls).

Fixes #11876.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agofix: Don't rely on lang items to find primitive impls
Florian Diebold [Sat, 2 Apr 2022 13:32:40 +0000 (15:32 +0200)]
fix: Don't rely on lang items to find primitive impls

rustc has removed the use of lang items to mark the primitive impls, so
just look through the crate graph for them (this should be fine
performance-wise since we cache the crates that contain these impls).

Fixes #11876.

2 years agoMerge #11878
bors[bot] [Sat, 2 Apr 2022 12:41:14 +0000 (12:41 +0000)]
Merge #11878

11878: fix: Paper over GAT panic r=flodiebold a=flodiebold

TIL that Chalk expects the arguments to a generic associated type to come *before* the ones for the parent trait, not *after* as we have been doing with all other nested generics. Fixing this requires a larger refactoring, so for now this just papers over the problem by completely ignoring parameters of associated types.

Fixes #11769.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agofix: Paper over GAT panic
Florian Diebold [Sat, 2 Apr 2022 11:04:04 +0000 (13:04 +0200)]
fix: Paper over GAT panic

TIL that Chalk expects the arguments to a generic associated type to
come *before* the ones for the parent trait, not *after* as we have been
doing with all other nested generics. Fixing this requires a larger
refactoring, so for now this just papers over the problem by completely
ignoring parameters of associated types.

Fixes #11769.

2 years agofix: `merge_imports::recursive_merge` exiting early
iDawer [Sat, 2 Apr 2022 09:18:42 +0000 (14:18 +0500)]
fix: `merge_imports::recursive_merge` exiting early

2 years agoMerge #11875
bors[bot] [Fri, 1 Apr 2022 23:43:28 +0000 (23:43 +0000)]
Merge #11875

11875: internal: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSimplify completion import insertion
Lukas Wirth [Fri, 1 Apr 2022 23:42:21 +0000 (01:42 +0200)]
Simplify completion import insertion

2 years agoCleanup relevance scoring
Lukas Wirth [Fri, 1 Apr 2022 23:19:33 +0000 (01:19 +0200)]
Cleanup relevance scoring

2 years agoMerge #11857
bors[bot] [Fri, 1 Apr 2022 21:42:54 +0000 (21:42 +0000)]
Merge #11857

11857: Lower postfix suggestions in completions list r=Veykril a=avrong

Fixes #11850

Adds a parameter for postfix suggestions in `CompletionRelevance`, and basing on it, decreases relevance score of such items in completion list

Co-authored-by: Aleksei Trifonov <avrong@avrong.me>
2 years agoMerge #11874
bors[bot] [Fri, 1 Apr 2022 21:30:32 +0000 (21:30 +0000)]
Merge #11874

11874: minor: enum variant wording r=Veykril a=jakevossen5

As discussed on Zulip: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/generate.20_.20for.20.22an.20enum.20variant.22

Co-authored-by: Jake Vossen <jake@vossen.dev>
2 years agoenum variant wording
Jake Vossen [Fri, 1 Apr 2022 20:22:49 +0000 (14:22 -0600)]
enum variant wording

2 years agoIntroduce postfix item types
Aleksei Trifonov [Fri, 1 Apr 2022 17:50:27 +0000 (20:50 +0300)]
Introduce postfix item types

2 years agoMerge #11872
bors[bot] [Fri, 1 Apr 2022 17:12:44 +0000 (17:12 +0000)]
Merge #11872

11872: internal: Remove `PathResolution::AssocItem` r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agointernal: Remove `PathResolution::AssocItem`
Lukas Wirth [Fri, 1 Apr 2022 16:32:05 +0000 (18:32 +0200)]
internal: Remove `PathResolution::AssocItem`

2 years agoMerge #11796
bors[bot] [Fri, 1 Apr 2022 15:51:29 +0000 (15:51 +0000)]
Merge #11796

11796: minor: Remove sponsors from readme files r=Veykril a=Veykril

No need to merge this now though

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoMerge #11870
bors[bot] [Fri, 1 Apr 2022 15:33:01 +0000 (15:33 +0000)]
Merge #11870

11870: Recover from missing type annotation r=Veykril a=HKalbasi

We were missing the init expression in case of `let x: = 2`, which breaks type inference of that variable (previously x were `{unknown}`, now it is `i32`).

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2 years agoMerge #11871
bors[bot] [Fri, 1 Apr 2022 15:17:03 +0000 (15:17 +0000)]
Merge #11871

11871: internal: Move `rust.ungram` into `rust-analyzer/crates/syntax` r=Veykril a=Veykril

This makes updating the grammar a lot simpler for us. Though removing it from ungrammar can't be done without bumping it to 2.0 so I'll leave it in there for the time being.
cc https://github.com/rust-analyzer/ungrammar/pull/47

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agointernal: Move rust.ungram into rust-analyzer/crates/syntax
Lukas Wirth [Fri, 1 Apr 2022 15:12:25 +0000 (17:12 +0200)]
internal: Move rust.ungram into rust-analyzer/crates/syntax

2 years agofix: splitting path of a glob import wrongly adds `self`
iDawer [Fri, 1 Apr 2022 14:12:50 +0000 (19:12 +0500)]
fix: splitting path of a glob import wrongly adds `self`

`ast::UseTree::split_prefix` handles globs now.
Removed an extra branch for globs in `ide_db::imports::merge_imports::recursive_merge` (superseeded by split_prefix).

2 years agorecover from missing type annotation
hkalbasi [Fri, 1 Apr 2022 12:50:54 +0000 (17:20 +0430)]
recover from missing type annotation

2 years agoMerge #11869
bors[bot] [Fri, 1 Apr 2022 12:40:51 +0000 (12:40 +0000)]
Merge #11869

11869: fix: code blocks with tilde also works like code block r=Veykril a=moreal

The `rustdoc` uses the `pulldown_cmark` package to parse *doc_comment* and the package also treat triple `~` characters also as code block fences. So when we run `cargo doc`, they will be placed also.

<img width="965" alt="image" src="https://user-images.githubusercontent.com/26626194/161208072-5a09a209-57fc-4a52-b190-b0a9be9ffcd6.png">

But `rust-analyzer` doesn't support it so it doesn't have any injected code highlights and any `Run doctest` hint. This pull request tries to allow also them. đź™‡đźŹ»â€Ťâ™‚️

Before:

<img width="224" alt="image" src="https://user-images.githubusercontent.com/26626194/161207405-b1d6cfda-82b1-4f60-8e42-c51d0ed98f38.png">

After:

<img width="161" alt="image" src="https://user-images.githubusercontent.com/26626194/161207693-8e39997c-9ca6-4e69-8c65-e9b70899f7db.png">

Co-authored-by: Lee Dogeon <dev.moreal@gmail.com>
2 years agoCode blocks with tilde also works like code block
Lee Dogeon [Fri, 1 Apr 2022 06:22:32 +0000 (15:22 +0900)]
Code blocks with tilde also works like code block

2 years agoMerge #11867
bors[bot] [Fri, 1 Apr 2022 10:18:15 +0000 (10:18 +0000)]
Merge #11867

11867: create generate is, as, try_into group r=Veykril a=jakevossen5

Fixes #11636

In `generate_enum_projection_method.rs`, the changes to the function are from `cargo fmt`, I made the same change as I did in `generate_enum_is_method.rs`.

Co-authored-by: Jake Vossen <jake@vossen.dev>
2 years agocreate generate is, as, try_into group
Jake Vossen [Fri, 1 Apr 2022 03:19:45 +0000 (21:19 -0600)]
create generate is, as, try_into group

2 years agoAdd test against line number underflow
Felix Maurer [Thu, 31 Mar 2022 21:37:23 +0000 (23:37 +0200)]
Add test against line number underflow

2 years agoPrevent underflow when converting line numbers
Felix Maurer [Thu, 31 Mar 2022 21:00:48 +0000 (23:00 +0200)]
Prevent underflow when converting line numbers

Previously, when line numbers of Rust spans were converted to LSP
ranges, they could underflow resulting in very large line numbers. As
an underflow is always wrong, prevent it and use 0 instead.

2 years agoFix: Select correct insert position for disabled group import
Jonas Bushart [Thu, 31 Mar 2022 18:15:01 +0000 (18:15 +0000)]
Fix: Select correct insert position for disabled group import

The logic for importing with and without `group_imports` differed
significantly when no previous group existed. This lead to the problem
of using the wrong position when importing inside a module (#11585) or
when inner attributes are involved.
The existing code for grouped imports is better and takes these things
into account.

This PR changes the flow to use the pre-existing code for adding a new
import group even for the non-grouped import settings.
Some coverage markers are updated and the `group` is removed, since they
are now invoked in both cases (grouping and no grouping).

Tests are updated and two tests (empty module and inner attribute) are
added.

Fixes #11585

2 years agoMerge #11863
bors[bot] [Thu, 31 Mar 2022 14:04:38 +0000 (14:04 +0000)]
Merge #11863

11863: fix: allow varargs in any param position r=jonas-schievink a=jonas-schievink

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/3578 and aligns us with the Rust reference.

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoRemove parser restriction on varargs positioning
Jonas Schievink [Thu, 31 Mar 2022 14:03:27 +0000 (16:03 +0200)]
Remove parser restriction on varargs positioning

2 years agoMerge #11827
bors[bot] [Thu, 31 Mar 2022 13:01:10 +0000 (13:01 +0000)]
Merge #11827

11827: internal: Enforce Invariant that Resolver always contains a ModuleScope r=Veykril a=Veykril

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoMerge #11861
bors[bot] [Thu, 31 Mar 2022 12:52:11 +0000 (12:52 +0000)]
Merge #11861

11861: internal: Add "view file text" command to debug sync issues r=jonas-schievink a=jonas-schievink

I saw a file sync bug the other day but didn't know how to further debug it. This command might give a clue as to what's wrong and help debug issues like https://github.com/rust-analyzer/rust-analyzer/issues/4829.

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoAdd "view file text" command to debug sync issues
Jonas Schievink [Thu, 31 Mar 2022 12:50:33 +0000 (14:50 +0200)]
Add "view file text" command to debug sync issues

2 years agointernal: Enforce Resolver to always have a module scope
Lukas Wirth [Thu, 31 Mar 2022 09:12:08 +0000 (11:12 +0200)]
internal: Enforce Resolver to always have a module scope

2 years agoFix formatting
Aleksei Trifonov [Wed, 30 Mar 2022 23:59:15 +0000 (02:59 +0300)]
Fix formatting

2 years agoLower postfix suggestions in completions list
Aleksei Trifonov [Wed, 30 Mar 2022 23:27:33 +0000 (02:27 +0300)]
Lower postfix suggestions in completions list

2 years agointernal: Refactor FamousDefs builtin crate search
Lukas Wirth [Sat, 26 Mar 2022 20:22:35 +0000 (21:22 +0100)]
internal: Refactor FamousDefs builtin crate search

2 years agoMerge #11852
bors[bot] [Wed, 30 Mar 2022 13:48:50 +0000 (13:48 +0000)]
Merge #11852

11852: Type mismatch when last expression is noreturn asm r=lnicola a=weirdsmiley

When last expression in a function body is noreturn asm, then analyzer
complains about the type mismatch by highlighting entire body. This
fixes it by introducing loop {} in the expanded code.

Fixes: [#11820](https://github.com/rust-analyzer/rust-analyzer/issues/11820)
Co-authored-by: Manas <manas18244@iiitd.ac.in>
2 years agoType mismatch when last expression is noreturn asm
Manas [Wed, 30 Mar 2022 13:32:27 +0000 (19:02 +0530)]
Type mismatch when last expression is noreturn asm

When last expression in a function body is noreturn asm, then analyzer
complains about the type mismatch by highlighting entire body. This
fixes it by introducing loop {} in the expanded code.

2 years agoMerge #11849
bors[bot] [Wed, 30 Mar 2022 11:52:50 +0000 (11:52 +0000)]
Merge #11849

11849: docs(auto_import): change by_self -> self and by_crate -> crate r=Veykril a=gibfahn

---

#### Commits _(oldest to newest)_

6b38c2d75 docs(auto_import): change by_self -> self and by_crate -> crate

Keep things consistent with the package.json , which uses `self` and
`crate` instead of `by_self` and `by_crate`. Both names are in fact
allowed as aliases, but we should be consistent so that people reading
the docs and using a schema do not see red squiggles.

<br/>

Co-authored-by: Gibson Fahnestock <gibfahn@gmail.com>
2 years agodocs(auto_import): change by_self -> self and by_crate -> crate
Gibson Fahnestock [Wed, 30 Mar 2022 10:45:14 +0000 (11:45 +0100)]
docs(auto_import): change by_self -> self and by_crate -> crate

Keep things consistent with the package.json , which uses `self` and
`crate` instead of `by_self` and `by_crate`. Both names are in fact
allowed as aliases, but we should be consistent so that people reading
the docs and using a schema do not see red squiggles.

2 years agoMerge #11844
bors[bot] [Tue, 29 Mar 2022 19:58:14 +0000 (19:58 +0000)]
Merge #11844

11844: Fix divergence detection for bare match arms r=flodiebold a=flodiebold

Fixes #11814 and #11837.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agoFix divergence detection for bare match arms
Florian Diebold [Tue, 29 Mar 2022 19:55:34 +0000 (21:55 +0200)]
Fix divergence detection for bare match arms

Fixes #11814 and #11837.

2 years agoMerge #11842
bors[bot] [Tue, 29 Mar 2022 16:10:20 +0000 (16:10 +0000)]
Merge #11842

11842: Fix duplicate type mismatches with blocks r=flodiebold a=flodiebold

E.g. when there's a type mismatch on the return value of a function. To fix this, we have to return the expected type as the type of the block when there's a mismatch. That meant some IDE code that expected otherwise had to be adapted, in particular the "add return type" assist. For the "wrap in Ok/Some" quickfix, this sadly means it usually can't be applied in all branches of an if expression at the same time anymore, because there's a type mismatch for each branch that has the wrong type.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agoFix duplicate type mismatches with blocks
Florian Diebold [Tue, 29 Mar 2022 15:51:11 +0000 (17:51 +0200)]
Fix duplicate type mismatches with blocks

E.g. when there's a type mismatch on the return value of a function. To
fix this, we have to return the expected type as the type of the block
when there's a mismatch. That meant some IDE code that expected
otherwise had to be adapted, in particular the "add return type" assist.
For the "wrap in Ok/Some" quickfix, this sadly means it usually can't be applied
in all branches of an if expression at the same time anymore, because
there's a type mismatch for each branch that has the wrong type.

2 years agoMerge #11840
bors[bot] [Tue, 29 Mar 2022 10:55:17 +0000 (10:55 +0000)]
Merge #11840

11840: Fix another const generic panic r=flodiebold a=HKalbasi

fix #11835

If I change `dyn` to `impl` in the test, it will infer the type as `IntoIterator::Item<impl Iterator<Item = [Ar<u8, 7>; 9]> + ?Sized>` instead of `[Ar<u8, 7>; 9]`. Maybe it needs some action?

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2 years agofix regression_11688_3
hkalbasi [Tue, 29 Mar 2022 06:33:55 +0000 (11:03 +0430)]
fix regression_11688_3

2 years agoMerge #11833
bors[bot] [Sun, 27 Mar 2022 17:22:02 +0000 (17:22 +0000)]
Merge #11833

11833: internal: Move mismatched arg count diagnostic to inference r=flodiebold a=flodiebold

This means we only need to handle legacy const generics in one place, and it fits there especially since there will be more diagnostics coming.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agoRemove legacy_const_generics_indices from CallableSig
Florian Diebold [Sun, 27 Mar 2022 17:12:00 +0000 (19:12 +0200)]
Remove legacy_const_generics_indices from CallableSig

I want to remove CallableSig anyway, and it's not needed anymore.

2 years agoMove mismatched-arg-count diagnostic to inference
Florian Diebold [Sun, 27 Mar 2022 17:10:31 +0000 (19:10 +0200)]
Move mismatched-arg-count diagnostic to inference

2 years agoMerge #11832
bors[bot] [Sun, 27 Mar 2022 13:46:35 +0000 (13:46 +0000)]
Merge #11832

11832: Fix typo in the style documentation r=lnicola a=Therzok

Was going through the documentation itself and found this typo just waiting to be fixed

Co-authored-by: Marius Ungureanu <therzok@gmail.com>
2 years agoFix typo in the style documentation
Marius Ungureanu [Sun, 27 Mar 2022 12:23:33 +0000 (15:23 +0300)]
Fix typo in the style documentation

Was going through the documentation itself and found this typo just waiting to be fixed

2 years agoMerge #11831
bors[bot] [Sun, 27 Mar 2022 10:52:27 +0000 (10:52 +0000)]
Merge #11831

11831: fix: Disable ref_match for qualified paths as well r=flodiebold a=flodiebold

I.e. don't suggest `Foo::&foo()`.

CC #8058.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agofix: Disable ref_match for qualified paths as well
Florian Diebold [Sun, 27 Mar 2022 10:50:16 +0000 (12:50 +0200)]
fix: Disable ref_match for qualified paths as well

I.e. don't suggest `Foo::&foo()`.

CC #8058.

2 years agoMerge #11829
bors[bot] [Sun, 27 Mar 2022 07:12:06 +0000 (07:12 +0000)]
Merge #11829

11829: minor: Bump chalk r=lnicola a=lnicola

Pulls in https://github.com/rust-lang/chalk/pull/759.

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoBump chalk
Laurențiu Nicola [Sun, 27 Mar 2022 07:11:02 +0000 (10:11 +0300)]
Bump chalk

2 years agoMerge #11825
bors[bot] [Sat, 26 Mar 2022 18:49:41 +0000 (18:49 +0000)]
Merge #11825

11825: fix: Don't complete `Drop::drop` for qualified paths r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoMerge #11826
bors[bot] [Sat, 26 Mar 2022 18:40:39 +0000 (18:40 +0000)]
Merge #11826

11826: Revert "Emit #[must_use] in Generate new assist" r=lnicola a=lnicola

CC https://github.com/rust-analyzer/rust-analyzer/pull/11737#issuecomment-1079740305

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoRevert "Emit #[must_use] in Generate new assist"
Laurențiu Nicola [Sat, 26 Mar 2022 18:39:36 +0000 (20:39 +0200)]
Revert "Emit #[must_use] in Generate new assist"

This reverts commit 7e05e10495cd0f83cbcba2e7d881b616998cf7dc.

2 years agoSort runnable test results to make them deterministic
Lukas Wirth [Sat, 26 Mar 2022 18:38:20 +0000 (19:38 +0100)]
Sort runnable test results to make them deterministic

2 years agofix: Don't complete Drop::drop for qualified paths
Lukas Wirth [Sat, 26 Mar 2022 17:46:49 +0000 (18:46 +0100)]
fix: Don't complete Drop::drop for qualified paths

2 years agoSimplify
Lukas Wirth [Wed, 23 Mar 2022 17:09:53 +0000 (18:09 +0100)]
Simplify

2 years agoMerge #11793
bors[bot] [Fri, 25 Mar 2022 22:46:15 +0000 (22:46 +0000)]
Merge #11793

11793: LSIF: consolidate references into a single edge where possible. r=Veykril a=khuey

Co-authored-by: Kyle Huey <khuey@kylehuey.com>
2 years agoBump npm deps
Laurențiu Nicola [Fri, 25 Mar 2022 18:25:37 +0000 (20:25 +0200)]
Bump npm deps

2 years agoMerge #11817
bors[bot] [Fri, 25 Mar 2022 15:26:10 +0000 (15:26 +0000)]
Merge #11817

11817: minor: fix comment r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoMerge #11809
bors[bot] [Fri, 25 Mar 2022 15:11:56 +0000 (15:11 +0000)]
Merge #11809

11809: feat: disable experimental diagnostics by default r=jonas-schievink a=jonas-schievink

Now that we diagnose type mismatches, we have another diagnostic that can potentially produce false positives, so let's disable experimental diagnostics by default.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agofix comment
Jonas Schievink [Fri, 25 Mar 2022 14:30:52 +0000 (15:30 +0100)]
fix comment

2 years agoMerge #11810
bors[bot] [Thu, 24 Mar 2022 17:27:18 +0000 (17:27 +0000)]
Merge #11810

11810: internal: rename the 1.47 proc macro ABI to 1.48 r=jonas-schievink a=jonas-schievink

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

We don't support 1.47, so rename it to reflect that.

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoRename the 1.47 ABI to 1.48
Jonas Schievink [Thu, 24 Mar 2022 17:26:10 +0000 (18:26 +0100)]
Rename the 1.47 ABI to 1.48

2 years agoDisable experimental diagnostics by default
Jonas Schievink [Thu, 24 Mar 2022 15:57:50 +0000 (16:57 +0100)]
Disable experimental diagnostics by default