]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agointernal: Show more project building errors to the user
Lukas Wirth [Mon, 11 Apr 2022 12:38:30 +0000 (14:38 +0200)]
internal: Show more project building errors to the user

2 years agoAuto merge of #11979 - Veykril:ci, r=lnicola
bors [Thu, 14 Apr 2022 06:36:09 +0000 (06:36 +0000)]
Auto merge of #11979 - Veykril:ci, r=lnicola

minor: Don't run CI on master branch

2 years agoAuto merge of #11956 - fee1-dead:master, r=flodiebold
bors [Wed, 13 Apr 2022 22:53:31 +0000 (22:53 +0000)]
Auto merge of #11956 - fee1-dead:master, r=flodiebold

feat: allow customizing the command for running build scripts

I have tested this locally and it fixed #9201 with some small changes on the compiler side with suggestions from https://github.com/rust-analyzer/rust-analyzer/issues/9201#issuecomment-1019554086.

I have also added an environment variable `IS_RA_BUILDSCRIPT_CHECK` for crates to detect that it is a check for buildscripts, and allows defaulting to bogus values for expected environment variables.

2 years agominor: Don't run CI on master branch
Lukas Wirth [Wed, 13 Apr 2022 22:42:51 +0000 (00:42 +0200)]
minor: Don't run CI on master branch

2 years agoAuto merge of #11976 - Veykril:rust-lang-test, r=Veykril
bors [Wed, 13 Apr 2022 17:24:18 +0000 (17:24 +0000)]
Auto merge of #11976 - Veykril:rust-lang-test, r=Veykril

minor: fix ide docs link

Let's test if bors listens to me here
bors r+

2 years agoUpdate CI for Rust bors
Deadbeef [Wed, 13 Apr 2022 14:13:36 +0000 (00:13 +1000)]
Update CI for Rust bors

2 years agofeat: allow customizing the command for running build scripts
Deadbeef [Mon, 11 Apr 2022 03:13:50 +0000 (13:13 +1000)]
feat: allow customizing the command for running build scripts

2 years agominor: fix ide docs link
Lukas Wirth [Wed, 13 Apr 2022 11:22:45 +0000 (13:22 +0200)]
minor: fix ide docs link

2 years agoMerge #11974
bors[bot] [Wed, 13 Apr 2022 10:28:45 +0000 (10:28 +0000)]
Merge #11974

11974: minor: prepare CI for rust-lang move r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agominor: prepare CI for rust-lang move
Lukas Wirth [Wed, 13 Apr 2022 10:26:24 +0000 (12:26 +0200)]
minor: prepare CI for rust-lang move

2 years agoMerge #11970
bors[bot] [Tue, 12 Apr 2022 17:14:16 +0000 (17:14 +0000)]
Merge #11970

11970: Bump chalk r=lnicola a=lnicola

Closes #9990, but not #6418, #10653

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoBump chalk
Laurențiu Nicola [Tue, 12 Apr 2022 17:10:10 +0000 (20:10 +0300)]
Bump chalk

2 years agoMerge #11969
bors[bot] [Tue, 12 Apr 2022 16:29:48 +0000 (16:29 +0000)]
Merge #11969

11969: fix: Add trailing `;` when completing assoc const/type in trait impl r=jonas-schievink a=jonas-schievink

Final item of https://github.com/rust-analyzer/rust-analyzer/issues/11860, thus closes https://github.com/rust-analyzer/rust-analyzer/issues/11860 :tada:

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoAdd trailing `;` when completing assoc const/type
Jonas Schievink [Tue, 12 Apr 2022 16:28:43 +0000 (18:28 +0200)]
Add trailing `;` when completing assoc const/type

2 years agoMerge #11967
bors[bot] [Tue, 12 Apr 2022 16:03:12 +0000 (16:03 +0000)]
Merge #11967

11967: fix: Fix trait impl completions not triggering after `fn`/`const`/`type` r=jonas-schievink a=jonas-schievink

![screenshot-2022-04-12-17:13:01](https://user-images.githubusercontent.com/1786438/162996087-56540f5e-a6be-4111-a4a5-8de21f483a5e.png)

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11467
cc https://github.com/rust-analyzer/rust-analyzer/issues/11860

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoFix trait impl completions' `lookup_by` text
Jonas Schievink [Tue, 12 Apr 2022 15:17:31 +0000 (17:17 +0200)]
Fix trait impl completions' `lookup_by` text

2 years agoMerge #11883
bors[bot] [Tue, 12 Apr 2022 15:17:00 +0000 (15:17 +0000)]
Merge #11883

11883: fix(ide): move moudle directory when rename r=rainy-me a=rainy-me

fix: #10992

Added `FileSystemEdit::MoveDir` variant for move dirs. Original implemented as recursively move child mod files but had many issues like

1. left empty dir after rename file
2. only affect rust file
3. not performant

so changed to current version

Co-authored-by: rainy-me <github@yue.coffee>
2 years agofix: move dir on rename mod
rainy-me [Tue, 12 Apr 2022 14:01:53 +0000 (23:01 +0900)]
fix: move dir on rename mod

2 years agoMerge #11966
bors[bot] [Tue, 12 Apr 2022 13:34:52 +0000 (13:34 +0000)]
Merge #11966

11966: minor: simplify r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agosimplify
Jonas Schievink [Tue, 12 Apr 2022 13:34:12 +0000 (15:34 +0200)]
simplify

2 years agoMerge #11964
bors[bot] [Mon, 11 Apr 2022 22:21:57 +0000 (22:21 +0000)]
Merge #11964

11964: internal: Show more project building errors to the user r=Veykril a=Veykril

Something very fishy is going on with the `rustc_workspace` handling, which caused this bug to only manifest in the `std` library but not other library crate... So there is either a bug there or just the fact that we seem to add duplicate dependencies (I think this is what we are doing with this right?) might be tripping something up somewhere.

cc https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Rust-analyzer.20use.20inside.20stdlib

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Unset test feature in rustc source crates
Lukas Wirth [Mon, 11 Apr 2022 22:18:49 +0000 (00:18 +0200)]
fix: Unset test feature in rustc source crates

2 years agoMerge #11961
bors[bot] [Mon, 11 Apr 2022 16:50:00 +0000 (16:50 +0000)]
Merge #11961

11961: feature: deprioritize already-imported names in `use` items r=jonas-schievink a=jonas-schievink

![screenshot-2022-04-11-18:48:46](https://user-images.githubusercontent.com/1786438/162790376-6b133925-7cf9-46c5-b0e2-d8c3cba61d47.png)

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

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoDeprioritize already-imported names
Jonas Schievink [Mon, 11 Apr 2022 16:48:27 +0000 (18:48 +0200)]
Deprioritize already-imported names

2 years agoMerge #11958
bors[bot] [Mon, 11 Apr 2022 11:12:55 +0000 (11:12 +0000)]
Merge #11958

11958: Show config deseralization failures on start up r=Veykril a=Veykril

We now also show deserialization errors to the user when starting the server.
This PR also adds a small validation "pass" on the config that we will probably populate over time with more checks.

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

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoAdd simplistic config validation
Lukas Wirth [Mon, 11 Apr 2022 11:10:43 +0000 (13:10 +0200)]
Add simplistic config validation

2 years agoShow config deseralization failures on start up
Lukas Wirth [Mon, 11 Apr 2022 11:05:34 +0000 (13:05 +0200)]
Show config deseralization failures on start up

2 years agoMerge #11935
bors[bot] [Mon, 11 Apr 2022 09:29:15 +0000 (09:29 +0000)]
Merge #11935

11935: feat: Switch to LSP inlay hints r=lnicola a=lnicola

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoMerge #11957
bors[bot] [Mon, 11 Apr 2022 08:03:50 +0000 (08:03 +0000)]
Merge #11957

11957: fix panic on GAT r=flodiebold a=skyzh

Signed-off-by: Alex Chi <iskyzh@gmail.com>
This is still a workaround on GAT panic, and didn't solve the full problem. But at least we won't panic now. False positive is better than panicking and letting VSCode constantly pop out the warning 🤣

This PR is simple -- only apply the https://github.com/rust-analyzer/rust-analyzer/pull/11878 fix on const generics. For normal GATs, just follow the previous approach.

This PR fixes https://github.com/rust-analyzer/rust-analyzer/issues/11939, I've added it as a test case.

This PR didn't fully fix / https://github.com/rust-analyzer/rust-analyzer/issues/11923. But at least it won't panic now -- will only give a type mismatch error.

Not sure if it fixes / https://github.com/rust-analyzer/rust-analyzer/issues/11921, I'll test it later.

cc `@flodiebold` for review, thanks!

Co-authored-by: Alex Chi <iskyzh@gmail.com>
2 years agofix panic on GAT
Alex Chi [Mon, 11 Apr 2022 05:44:01 +0000 (13:44 +0800)]
fix panic on GAT

Signed-off-by: Alex Chi <iskyzh@gmail.com>
2 years agoMerge #11951
bors[bot] [Sun, 10 Apr 2022 18:21:54 +0000 (18:21 +0000)]
Merge #11951

11951: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSimplify
Lukas Wirth [Sun, 10 Apr 2022 10:42:16 +0000 (12:42 +0200)]
Simplify

2 years agoMerge #11955
bors[bot] [Sun, 10 Apr 2022 16:28:40 +0000 (16:28 +0000)]
Merge #11955

11955: Fix typo in the manual r=lnicola a=okuramasafumi

The -> There

Co-authored-by: OKURA Masafumi <masafumi.o1988@gmail.com>
2 years agoFix typo in the manual
OKURA Masafumi [Sun, 10 Apr 2022 16:17:39 +0000 (01:17 +0900)]
Fix typo in the manual

The -> There

2 years agoMerge #11954
bors[bot] [Sun, 10 Apr 2022 15:59:38 +0000 (15:59 +0000)]
Merge #11954

11954: Parse `for<'a>` closure syntax r=Veykril a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoParse for<'a> closure syntax
Lukas Wirth [Sun, 10 Apr 2022 15:50:14 +0000 (17:50 +0200)]
Parse for<'a> closure syntax

2 years agoMerge #11953
bors[bot] [Sun, 10 Apr 2022 13:31:33 +0000 (13:31 +0000)]
Merge #11953

11953: fix: `extract_module` is too eager r=Veykril a=iDawer

Refactored `extract_module`.
Searching for usages and import resolving are done lazily.

Close #11944

Co-authored-by: iDawer <ilnur.iskhakov.oss@outlook.com>
2 years ago`extract_module`: Refactor loops
iDawer [Sat, 9 Apr 2022 17:07:44 +0000 (22:07 +0500)]
`extract_module`: Refactor loops

2 years agoextract_module: Resolve imports lazily
iDawer [Mon, 28 Mar 2022 16:31:07 +0000 (21:31 +0500)]
extract_module: Resolve imports lazily

2 years agoRefactor `extract_module`
iDawer [Mon, 28 Mar 2022 14:10:13 +0000 (19:10 +0500)]
Refactor `extract_module`

2 years agoClean up `extract_module`
iDawer [Mon, 28 Mar 2022 11:31:18 +0000 (16:31 +0500)]
Clean up `extract_module`

2 years agoMerge #11946
bors[bot] [Sat, 9 Apr 2022 11:41:47 +0000 (11:41 +0000)]
Merge #11946

11946: internal: Revert #11912 as it parses all visited files r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoRevert #11912 as it parses all visited files
Lukas Wirth [Sat, 9 Apr 2022 11:40:48 +0000 (13:40 +0200)]
Revert #11912 as it parses all visited files

2 years agoMerge #11943
bors[bot] [Fri, 8 Apr 2022 23:09:18 +0000 (23:09 +0000)]
Merge #11943

11943: fix: Don't create `hir::Local`s from const path patterns r=Veykril a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Don't create `hir::Local`s from const path patterns
Lukas Wirth [Fri, 8 Apr 2022 23:08:13 +0000 (01:08 +0200)]
fix: Don't create `hir::Local`s from const path patterns

2 years agoMerge #11942
bors[bot] [Fri, 8 Apr 2022 22:56:57 +0000 (22:56 +0000)]
Merge #11942

11942: fix: Check whether a parameter can be converted to a local r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11941
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Check whether a parameter can be converted to a local
Lukas Wirth [Fri, 8 Apr 2022 22:55:45 +0000 (00:55 +0200)]
fix: Check whether a parameter can be converted to a local

2 years agoMerge #11940
bors[bot] [Fri, 8 Apr 2022 22:14:48 +0000 (22:14 +0000)]
Merge #11940

11940: minor: bump lsp-server version r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agominor: bump lsp-server version
Lukas Wirth [Fri, 8 Apr 2022 22:13:47 +0000 (00:13 +0200)]
minor: bump lsp-server version

2 years agoMerge #11938
bors[bot] [Fri, 8 Apr 2022 18:00:41 +0000 (18:00 +0000)]
Merge #11938

11938: feat: improve assoc. item completion in trait impls r=jonas-schievink a=jonas-schievink

Account for macro-generated items, increase the score of these completions since they're very relevant, and allow them to trigger when the cursor is directly in the assoc. item list without requiring further input.

![screenshot-2022-04-08-18:12:06](https://user-images.githubusercontent.com/1786438/162481277-2a0d2f21-dc20-4452-804d-6370766216b6.png)

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

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoMake trait item completions work in a bare impl and score them
Jonas Schievink [Fri, 8 Apr 2022 16:06:18 +0000 (18:06 +0200)]
Make trait item completions work in a bare impl and score them

2 years agoAccount for macros in `get_missing_assoc_items`
Jonas Schievink [Fri, 8 Apr 2022 16:05:34 +0000 (18:05 +0200)]
Account for macros in `get_missing_assoc_items`

2 years agoMerge #11936
bors[bot] [Fri, 8 Apr 2022 12:34:12 +0000 (12:34 +0000)]
Merge #11936

11936: Ignore `Drop` and `Destruct` bounds for now r=flodiebold a=flodiebold

- `T: ~const Drop` has a special meaning in Rust 1.61 that we don't implement. (So ideally, we'd only ignore `~const Drop`, but this should be fine for now.)
- `Destruct` impls are built-in in 1.62 (current nightlies), so until the builtin impls are supported by Chalk, we ignore them as well. Since `Destruct` is implemented for everything in non-const contexts IIUC, this should also work fine.

Fixes #11932.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agoIgnore `Drop` and `Destruct` bounds for now
Florian Diebold [Fri, 8 Apr 2022 12:29:43 +0000 (14:29 +0200)]
Ignore `Drop` and `Destruct` bounds for now

- `T: ~const Drop` has a special meaning in Rust 1.61 that we don't implement.
  (So ideally, we'd only ignore `~const Drop`, but this should be fine
  for now.)
- `Destruct` impls are built-in in 1.62 (current nightlies as of 08-04-2022), so until
  the builtin impls are supported by Chalk, we ignore them as well.
  Since `Destruct` is implemented for everything in non-const contexts
  IIUC, this should also work fine.

Fixes #11932.

2 years agoUpdate for languageclient API changes
Laurențiu Nicola [Fri, 8 Apr 2022 11:24:28 +0000 (14:24 +0300)]
Update for languageclient API changes

2 years agoSwitch to LSP inlay hints
Laurențiu Nicola [Fri, 8 Apr 2022 10:20:21 +0000 (13:20 +0300)]
Switch to LSP inlay hints

2 years agoMerge #11931
bors[bot] [Thu, 7 Apr 2022 18:05:21 +0000 (18:05 +0000)]
Merge #11931

11931: fix: flyimport: omit types when completing where-clause r=jonas-schievink a=jonas-schievink

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

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoflyimport: omit types when completing where-clause
Jonas Schievink [Thu, 7 Apr 2022 18:02:33 +0000 (20:02 +0200)]
flyimport: omit types when completing where-clause

2 years agoMerge #11920
bors[bot] [Thu, 7 Apr 2022 17:08:02 +0000 (17:08 +0000)]
Merge #11920

11920: Consider types of const generics r=flodiebold a=HKalbasi

fix #11913

We should emit type_mismatch in const generics, probably after #7434. Currently they will lead to a misleading, time of use type error (like the added test).

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2 years agoMerge #11930
bors[bot] [Thu, 7 Apr 2022 16:38:42 +0000 (16:38 +0000)]
Merge #11930

11930: internal: move function unsafety determination out of the ItemTree r=jonas-schievink a=jonas-schievink

Resolves some FIXMEs.

I've also renamed some FnFlags to be more explicit about what they represent (presence of keywords, not necessarily presence of semantics)

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoDetermine function unsafety semantically
Jonas Schievink [Thu, 7 Apr 2022 16:33:03 +0000 (18:33 +0200)]
Determine function unsafety semantically

2 years agoMerge #11925
bors[bot] [Thu, 7 Apr 2022 14:38:46 +0000 (14:38 +0000)]
Merge #11925

11925: internal: Add and use `HirFormatter::write_{str,char}` r=Veykril a=lnicola

Saves slightly over 3 KB of `text`, but comparing the total with that from two weeks ago in #11776, this is a losing battle (we're 951 KB larger).

```
   text    data     bss     dec     hex filename
24693512 1542704    4424 26240640 1906680 rust-analyzer-baseline
24690216 1542112    4424 26236752 1905750 rust-analyzer-pr
```

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoMerge #11927
bors[bot] [Thu, 7 Apr 2022 14:27:08 +0000 (14:27 +0000)]
Merge #11927

11927: internal: Use bitflags for `FnFlags` r=jonas-schievink a=jonas-schievink

Previously we didn't do this because it didn't pull its weight, but now we actually do some bitops

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoUse bitflags for `FnFlags`
Jonas Schievink [Thu, 7 Apr 2022 14:13:37 +0000 (16:13 +0200)]
Use bitflags for `FnFlags`

2 years agoMerge #11926
bors[bot] [Thu, 7 Apr 2022 13:56:14 +0000 (13:56 +0000)]
Merge #11926

11926: fix: Fix panics with `#[cfg]`'d-out `self` parameter r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agouse stdx::never
Jonas Schievink [Thu, 7 Apr 2022 13:55:44 +0000 (15:55 +0200)]
use stdx::never

2 years agoFix panics with `#[cfg]`'d-out `self` parameter
Jonas Schievink [Thu, 7 Apr 2022 13:47:03 +0000 (15:47 +0200)]
Fix panics with `#[cfg]`'d-out `self` parameter

2 years agoAdd and use HirFormatter::write_{str,char}
Laurențiu Nicola [Thu, 7 Apr 2022 13:41:07 +0000 (16:41 +0300)]
Add and use HirFormatter::write_{str,char}

2 years agoMerge #11924
bors[bot] [Thu, 7 Apr 2022 13:23:50 +0000 (13:23 +0000)]
Merge #11924

11924: internal: remove `FnFlags::IS_IN_EXTERN_BLOCK` r=jonas-schievink a=jonas-schievink

This flag was determined purely based on the AST, which cannot work reliably since macros are allowed in `extern` blocks (in which case the function would not have an extern block parent in the AST).

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoRemove `FnFlags::IS_IN_EXTERN_BLOCK`
Jonas Schievink [Thu, 7 Apr 2022 13:22:11 +0000 (15:22 +0200)]
Remove `FnFlags::IS_IN_EXTERN_BLOCK`

2 years agoconsider types of const generics
hkalbasi [Thu, 7 Apr 2022 01:00:33 +0000 (05:30 +0430)]
consider types of const generics

2 years agoMerge #11919
bors[bot] [Wed, 6 Apr 2022 23:34:05 +0000 (23:34 +0000)]
Merge #11919

11919: minor: Remove pointless rebindings r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agominor: Remove pointless rebindings
Lukas Wirth [Wed, 6 Apr 2022 23:29:31 +0000 (01:29 +0200)]
minor: Remove pointless rebindings

2 years agoMerge #11916
bors[bot] [Wed, 6 Apr 2022 18:59:13 +0000 (18:59 +0000)]
Merge #11916

11916: internal: Add more doc-link tests r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agointernal: Add more doc-link tests
Lukas Wirth [Wed, 6 Apr 2022 18:49:10 +0000 (20:49 +0200)]
internal: Add more doc-link tests

2 years agoMerge #11915
bors[bot] [Wed, 6 Apr 2022 18:27:13 +0000 (18:27 +0000)]
Merge #11915

11915: fix: Attempt to resolve paths in const arguments heuristically in IDE layer r=Veykril a=Veykril

While we don't support const args in type inference yet, we can at least
make use of the fallback path resolution to resolve paths in const args
in the IDE layer to enable some features for them.

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Attempt to resolve paths in const arguments heuristically
Lukas Wirth [Wed, 6 Apr 2022 18:22:12 +0000 (20:22 +0200)]
fix: Attempt to resolve paths in const arguments heuristically

While we don't support const args in type inference yet, we can at least
make use of the fallback path resolution to resolve paths in const args
in the IDE layer to enable some features for them.

2 years agoMerge #11914
bors[bot] [Wed, 6 Apr 2022 17:39:20 +0000 (17:39 +0000)]
Merge #11914

11914: fix: Fix path qualifiers not resolving generic type params when shadowed by trait r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10707
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Fix path qualifiers not resolving generic type params when shadowed by trait
Lukas Wirth [Wed, 6 Apr 2022 17:38:45 +0000 (19:38 +0200)]
fix: Fix path qualifiers not resolving generic type params when shadowed by trait

2 years agoMerge #11912
bors[bot] [Wed, 6 Apr 2022 12:24:58 +0000 (12:24 +0000)]
Merge #11912

11912: Fix `SearchScope::reverse_dependencies` trying to search more files than necessary r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoFix `SearchScope::reverse_dependencies` trying to search more files than necessary
Lukas Wirth [Wed, 6 Apr 2022 12:24:06 +0000 (14:24 +0200)]
Fix `SearchScope::reverse_dependencies` trying to search more files than necessary

2 years agoMerge #11911
bors[bot] [Wed, 6 Apr 2022 12:00:35 +0000 (12:00 +0000)]
Merge #11911

11911: fix: Fix SearchScope using incorrect text ranges for macro-emitted inline modules r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Fix SearchScope using incorrect text ranges for macro-emitted inline modules
Lukas Wirth [Wed, 6 Apr 2022 11:58:40 +0000 (13:58 +0200)]
fix: Fix SearchScope using incorrect text ranges for macro-emitted inline modules

2 years agoMerge #11905
bors[bot] [Tue, 5 Apr 2022 17:00:56 +0000 (17:00 +0000)]
Merge #11905

11905: internal: Remove hir_expand macro recursion check r=jonas-schievink a=jonas-schievink

This check is insufficient to ensure finite macro nesting, and so all callers already have their own recursion limit, which makes this check redundant.

...at least I hope it's redundant. Would be great if someone could double-check this.

Originally, this check was added in https://github.com/rust-analyzer/rust-analyzer/pull/3671

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoMerge #11891
bors[bot] [Tue, 5 Apr 2022 16:31:18 +0000 (16:31 +0000)]
Merge #11891

11891: Better error message on Flycheck Error message (from: unactionable error message if we are using `clippy` as the checker) r=Veykril a=flipbit03

I have commented on this [S-unactionable issue](https://github.com/rust-analyzer/rust-analyzer/issues/6589) that the Flycheck error message should maybe provide a hint about what tool it actually runs. Searching on some places on the Internet I've found multiple people, including myself, losing copious amounts of time on the same issue. So I've decided to make this very small PR :-)

From an user experience standpoint, the current error message is unhelpful to the end user, because the end user does not know exactly what it needs to check/fix (outdated, broken, or missing `cargo clippy`). In my own case, `cargo clippy` was actually missing altogether (developing off `rust:1.59.0-bullseye` official Docker image).

Thanks in advance!

Co-authored-by: Cadu <cadu.coelho@gmail.com>
2 years agoRemove hir_expand macro recursion check
Jonas Schievink [Tue, 5 Apr 2022 15:59:48 +0000 (17:59 +0200)]
Remove hir_expand macro recursion check

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 agoUsing `error` instead of `output.stderr` in failure mode.
Cadu [Tue, 5 Apr 2022 14:17:39 +0000 (11:17 -0300)]
Using `error` instead of `output.stderr` in failure mode.

2 years agoMade error output the contents of Cargo's stderr as well.
Cadu [Mon, 4 Apr 2022 22:14:33 +0000 (19:14 -0300)]
Made error output the contents of Cargo's stderr as well.

2 years agowordsmithing.
Cadu [Sun, 3 Apr 2022 17:06:36 +0000 (14:06 -0300)]
wordsmithing.

2 years agoBetter error message hinting about `cargo clippy`
Cadu [Sun, 3 Apr 2022 16:48:10 +0000 (13:48 -0300)]
Better error message hinting about `cargo clippy`

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