]> git.lizzy.rs Git - rust.git/log
rust.git
20 months agoBump pulldown-cmark-to-cmark
Laurențiu Nicola [Sat, 15 Oct 2022 10:00:41 +0000 (13:00 +0300)]
Bump pulldown-cmark-to-cmark

20 months agoBump mimalloc
Laurențiu Nicola [Sat, 15 Oct 2022 09:59:56 +0000 (12:59 +0300)]
Bump mimalloc

20 months agoBump rowan
Laurențiu Nicola [Sat, 15 Oct 2022 09:58:57 +0000 (12:58 +0300)]
Bump rowan

20 months agoBump url
Laurențiu Nicola [Sat, 15 Oct 2022 09:57:30 +0000 (12:57 +0300)]
Bump url

20 months agoBump libc
Laurențiu Nicola [Sat, 15 Oct 2022 09:55:56 +0000 (12:55 +0300)]
Bump libc

20 months agoBump dashmap
Laurențiu Nicola [Sat, 15 Oct 2022 09:54:25 +0000 (12:54 +0300)]
Bump dashmap

20 months agoBump home
Laurențiu Nicola [Sat, 15 Oct 2022 09:53:26 +0000 (12:53 +0300)]
Bump home

20 months agoBump tracing
Laurențiu Nicola [Sat, 8 Oct 2022 18:30:04 +0000 (21:30 +0300)]
Bump tracing

20 months agoBump smallvec
Laurențiu Nicola [Thu, 6 Oct 2022 12:28:50 +0000 (15:28 +0300)]
Bump smallvec

20 months agoBump anyhow, arbitrary, itertools, semver, serde
Laurențiu Nicola [Mon, 3 Oct 2022 06:02:42 +0000 (09:02 +0300)]
Bump anyhow, arbitrary, itertools, semver, serde

20 months agoBump once_cell
Laurențiu Nicola [Sun, 2 Oct 2022 17:04:47 +0000 (20:04 +0300)]
Bump once_cell

20 months agoAuto merge of #13366 - matklad:xflags, r=lnicola
bors [Sat, 8 Oct 2022 16:46:15 +0000 (16:46 +0000)]
Auto merge of #13366 - matklad:xflags, r=lnicola

internal: :arrow_up: xflags

The main change here should be that flags are not inhereted, so

   $ rust-analyzer analysis-stats . -v -v

would do what it should do

We also no longer Don\'t

20 months agointernal: :arrow_up: xflags
Aleksey Kladov [Sat, 8 Oct 2022 14:35:07 +0000 (15:35 +0100)]
internal: :arrow_up: xflags

The main change here should be that flags are not inhereted, so

   $ rust-analyzer analysis-stats . -v -v

would do what it should do

We also no longer Don\'t

20 months agoAuto merge of #13362 - WaffleLapkin:go_to_def_fix_doc_include_str, r=Veykril
bors [Fri, 7 Oct 2022 09:56:12 +0000 (09:56 +0000)]
Auto merge of #13362 - WaffleLapkin:go_to_def_fix_doc_include_str, r=Veykril

fix: Make go-to-def work for `#[doc = include_str!("path")]`

See the added test, go-to-def on `#[doc = include_str!("path$0")]` should navigate to `path`.

20 months agoFix go-to-def for `#[doc = include_str!("path")]`
Maybe Waffle [Fri, 7 Oct 2022 09:04:41 +0000 (09:04 +0000)]
Fix go-to-def for `#[doc = include_str!("path")]`

20 months agoAuto merge of #13353 - wildbook:fix_type_inference_panic, r=Veykril
bors [Thu, 6 Oct 2022 12:33:50 +0000 (12:33 +0000)]
Auto merge of #13353 - wildbook:fix_type_inference_panic, r=Veykril

Fix assertion failure in type inference (#13352)

Fixes https://github.com/rust-lang/rust-analyzer/issues/13352

20 months agoAuto merge of #13356 - WaffleLapkin:go_to_def_shadow_include, r=Veykril
bors [Thu, 6 Oct 2022 06:28:31 +0000 (06:28 +0000)]
Auto merge of #13356 - WaffleLapkin:go_to_def_shadow_include, r=Veykril

minor: Fix go-to-def for shadowed `include*!`

Add a check in go-to-def feature, so that we don't assume any macro named `include`/`include_str`/`include_bytes` is the builtin one.

20 months agoFix go-to-def for shadowed `include*!`
Maybe Waffle [Thu, 6 Oct 2022 06:10:28 +0000 (06:10 +0000)]
Fix go-to-def for shadowed `include*!`

20 months agoFix assertion failure in type inference (#13352)
Wildbook [Wed, 5 Oct 2022 15:45:32 +0000 (17:45 +0200)]
Fix assertion failure in type inference (#13352)

20 months agoAuto merge of #13344 - lowr:patch/change-generic-param-order, r=Veykril
bors [Tue, 4 Oct 2022 18:26:43 +0000 (18:26 +0000)]
Auto merge of #13344 - lowr:patch/change-generic-param-order, r=Veykril

fix: use `BoundVar`s from current generic scope

Fixup for #13335, addresses https://github.com/rust-lang/rust-analyzer/pull/13339#issuecomment-1266654607

Before the change in generic parameter order, `BoundVar`s for trait reference didn't change whether you are in an impl's scope or in an associated item's scope. Now that item's generic params come before its parent's, we need to shift their indices when we are in an associated item's scope.

20 months agofix: use `BoundVar`s from current generic scope
Ryo Yoshida [Tue, 4 Oct 2022 15:20:01 +0000 (00:20 +0900)]
fix: use `BoundVar`s from current generic scope

20 months agoAuto merge of #13342 - rust-lang:revert-13328-rustc-proc-macro, r=Veykril
bors [Tue, 4 Oct 2022 06:18:57 +0000 (06:18 +0000)]
Auto merge of #13342 - rust-lang:revert-13328-rustc-proc-macro, r=Veykril

Revert "Add proc-macro dependency to rustc crates"

1. This panics since it indexes into the wrong thing, so fixes https://github.com/rust-lang/rust-analyzer/issues/13340
2. This didn't fix what I thought it would either
Reverts rust-lang/rust-analyzer#13328

20 months agoRevert "Add proc-macro dependency to rustc crates"
Lukas Wirth [Tue, 4 Oct 2022 06:18:01 +0000 (08:18 +0200)]
Revert "Add proc-macro dependency to rustc crates"

20 months agoAuto merge of #13339 - lowr:patch/change-generic-param-order, r=Veykril
bors [Mon, 3 Oct 2022 15:34:32 +0000 (15:34 +0000)]
Auto merge of #13339 - lowr:patch/change-generic-param-order, r=Veykril

fix: treat enum variants as generic item on their own

Fixup for #13335

It turns out I tried to merge two procedures into one utility function without noticing the incompatibility.

This time I *did* run analysis-stats on the four crates and confirmed it doesn't crash and this patch doesn't cause regression.

20 months agofix: treat enum variants as generic item on their own
Ryo Yoshida [Mon, 3 Oct 2022 15:07:34 +0000 (00:07 +0900)]
fix: treat enum variants as generic item on their own

20 months agoAuto merge of #13335 - lowr:patch/change-generic-param-order, r=Veykril
bors [Mon, 3 Oct 2022 12:13:25 +0000 (12:13 +0000)]
Auto merge of #13335 - lowr:patch/change-generic-param-order, r=Veykril

internal: change generic parameter order

tl;dr: This PR changes the `Substitution` for trait items and methods like so:

```rust
trait Trait<TP, const CP: usize> { // note the implicit Self as first parameter
  type Type<TC, const CC: usize>;
  fn f<TC, const CC: usize>() {}
}
impl<TP, const CP: usize> S {
  fn f<TC, const CC: usize>() {}
}
```

- before this PR: `[Self, TP, CP, TC, CC]` for each trait item, `[TP, CP, TC, CC]` for `S::f`
- after this PR: `[TC, CC, Self, TP, CP]` for each trait item, `[TC, CC, TP, CP]` for `S::f`

---

This PR "inverts" the generic parameters/arguments of an item and its parent. This is to fulfill [chalk's expectation](https://github.com/rust-lang/chalk/blob/d875af0ff196dd6430b5f5fd87a640fa5ab59d1e/chalk-solve/src/rust_ir.rs#L498-L502) on the order of generic arguments in `Substitution`s for generic associated types and it's one step forward for GATs support (hopefully). Although chalk doesn't put any constraint for other items, it feels more natural to get everything aligned than special casing GATs.

One complication is that `TyBuilder` now demands its users to pass in parent's `Substitution` upon construction unless it's obvious that the the item has no parent (e.g. an ADT never has parent). All users *should* already know the parent of the item in question, and without this, it cannot be easily reasoned about whether we're pushing the argument for the item or for its parent.

Some additional notes:
f8f5a5ea5788a846013545d63c9b46fd70cc4f7c: This isn't related to the change, but I felt it's nicer.

78977cd86cd17e008f94f8579d6a5aaebe46e69b: There's one major change here other than the generic param order: Default arguments are now bound by the same `Binder` as the item in question rather than a `Binder` limited to parameters they can refer to (i.e. arguments that syntactically appear before them). Now that the order of generic parameters is changed, it would be somewhat complicated to make such `Binder`s as before, and the "full" `Binder`s shouldn't be a problem because we already make sure that the default arguments don't refer to the generic arguments after them with `fallback_bound_vars()`.

7556f74b1691276d12e4cf96eb2df8f74836cdc1: This is split from 4385d3dcd0df7713b3a35f31f11034f0a570adbd to make it easy to revert if it turns out that the GATs with const generics panic is actually not resolved with this PR. cc #11878 #11957

20 months agoAuto merge of #13338 - Veykril:flycheck, r=Veykril
bors [Mon, 3 Oct 2022 12:05:11 +0000 (12:05 +0000)]
Auto merge of #13338 - Veykril:flycheck, r=Veykril

Prioritize restart messages in flycheck

cc https://github.com/rust-lang/rust-analyzer/issues/12936#issuecomment-1264670905

20 months agoPrioritize restart messages in flycheck
Lukas Wirth [Mon, 3 Oct 2022 12:03:54 +0000 (14:03 +0200)]
Prioritize restart messages in flycheck

20 months agoRemove hack
Ryo Yoshida [Sun, 2 Oct 2022 12:13:30 +0000 (21:13 +0900)]
Remove hack

20 months agoAdapt to the new generic parameter/argument order
Ryo Yoshida [Sun, 2 Oct 2022 13:15:57 +0000 (22:15 +0900)]
Adapt to the new generic parameter/argument order

20 months agoChange generic parameter/argument order
Ryo Yoshida [Sun, 2 Oct 2022 12:13:21 +0000 (21:13 +0900)]
Change generic parameter/argument order

This commit "inverts" the order of generic parameters/arguments of an
item and its parent. This is to fulfill chalk's expectation on the
order of `Substitution` for generic associated types and it's one step
forward for their support (hopefully).

Although chalk doesn't put any constraint on the order of `Substitution`
for other items, it feels natural to get everything aligned rather than
special casing GATs.

One complication is that `TyBuilder` now demands its users to pass in
parent's `Substitution` upon construction unless it's obvious that the
the item has no parent (e.g. an ADT never has parent). All users
*should* already know the parent of the item in question, and without
this, it cannot be easily reasoned about whether we're pushing the
argument for the item or for its parent.

Quick comparison of how this commit changes `Substitution`:

```rust
trait Trait<TP, const CP: usize> {
  type Type<TC, const CC: usize> = ();
  fn f<TC, const CC: usize>() {}
}
```

- before this commit: `[Self, TP, CP, TC, CC]` for each trait item
- after this commit: `[TC, CC, Self, TP, CP]` for each trait item

20 months agorefactor: use `cast()` instead of interning `GenericArgData`
Ryo Yoshida [Sun, 2 Oct 2022 09:39:42 +0000 (18:39 +0900)]
refactor: use `cast()` instead of interning `GenericArgData`

20 months agoAuto merge of #13328 - Veykril:rustc-proc-macro, r=Veykril
bors [Sat, 1 Oct 2022 19:29:33 +0000 (19:29 +0000)]
Auto merge of #13328 - Veykril:rustc-proc-macro, r=Veykril

Add proc-macro dependency to rustc crates

20 months agoAdd proc-macro dependency to rustc crates
Lukas Wirth [Sat, 1 Oct 2022 19:29:14 +0000 (21:29 +0200)]
Add proc-macro dependency to rustc crates

20 months agoAuto merge of #13327 - Veykril:proc-macro-srv-config, r=Veykril
bors [Sat, 1 Oct 2022 19:17:36 +0000 (19:17 +0000)]
Auto merge of #13327 - Veykril:proc-macro-srv-config, r=Veykril

Add config for supplying sysroot path

20 months agoAdd config for supplying sysroot path
Lukas Wirth [Sat, 1 Oct 2022 18:47:31 +0000 (20:47 +0200)]
Add config for supplying sysroot path

20 months agoAuto merge of #13326 - Veykril:proc-macro-srv-config, r=Veykril
bors [Sat, 1 Oct 2022 17:51:47 +0000 (17:51 +0000)]
Auto merge of #13326 - Veykril:proc-macro-srv-config, r=Veykril

Do not use the sysroot proc-macro server when a server path is given explicitly

20 months agoDo not use the sysroot proc-macro server when a server path is given explicitly
Lukas Wirth [Sat, 1 Oct 2022 17:50:34 +0000 (19:50 +0200)]
Do not use the sysroot proc-macro server when a server path is given explicitly

20 months agoAuto merge of #13324 - Veykril:trait-impl-completion, r=Veykril
bors [Sat, 1 Oct 2022 13:35:08 +0000 (13:35 +0000)]
Auto merge of #13324 - Veykril:trait-impl-completion, r=Veykril

Fix trait impl item completions using macro file text ranges

Fixes https://github.com/rust-lang/rust-analyzer/issues/13323

20 months agoFix trait impl item completions using macro file text ranges
Lukas Wirth [Sat, 1 Oct 2022 13:34:45 +0000 (15:34 +0200)]
Fix trait impl item completions using macro file text ranges

20 months agoAuto merge of #13321 - Veykril:format-str-args, r=Veykril
bors [Fri, 30 Sep 2022 22:42:40 +0000 (22:42 +0000)]
Auto merge of #13321 - Veykril:format-str-args, r=Veykril

Fix move_format_string_arg being tokentree unaware

Fixes https://github.com/rust-lang/rust-analyzer/issues/13261

20 months agoFix move_format_string_arg being tokentree unaware
Lukas Wirth [Fri, 30 Sep 2022 22:42:16 +0000 (00:42 +0200)]
Fix move_format_string_arg being tokentree unaware

20 months agoAuto merge of #13318 - Veykril:annotations, r=Veykril
bors [Fri, 30 Sep 2022 22:31:05 +0000 (22:31 +0000)]
Auto merge of #13318 - Veykril:annotations, r=Veykril

Fix annotations not resolving when lens location is set to whole item

Fixes https://github.com/rust-lang/rust-analyzer/issues/13310

20 months agoAuto merge of #13320 - Veykril:ty-alias-hover, r=Veykril
bors [Fri, 30 Sep 2022 22:22:24 +0000 (22:22 +0000)]
Auto merge of #13320 - Veykril:ty-alias-hover, r=Veykril

Fix type alias hovers not rendering generic parameters

20 months agoFix type alias hovers not rendering generic parameters
Lukas Wirth [Fri, 30 Sep 2022 22:21:29 +0000 (00:21 +0200)]
Fix type alias hovers not rendering generic parameters

20 months agoFix annotations not resolving when lens location is set to whole item
Lukas Wirth [Fri, 30 Sep 2022 22:03:47 +0000 (00:03 +0200)]
Fix annotations not resolving when lens location is set to whole item

20 months agoAuto merge of #13319 - Veykril:req-retry, r=Veykril
bors [Fri, 30 Sep 2022 22:12:48 +0000 (22:12 +0000)]
Auto merge of #13319 - Veykril:req-retry, r=Veykril

Fix requests not being retried anymore

20 months agoFix requests not being retried anymore
Lukas Wirth [Fri, 30 Sep 2022 22:07:33 +0000 (00:07 +0200)]
Fix requests not being retried anymore

21 months agoAuto merge of #13311 - lowr:fix/for-loop-item-resolution, r=Veykril
bors [Thu, 29 Sep 2022 11:04:47 +0000 (11:04 +0000)]
Auto merge of #13311 - lowr:fix/for-loop-item-resolution, r=Veykril

fix: infer for-loop item type with `IntoIterator` and `Iterator`

Part of #13299

We've been inferring the type of the yielded values in for-loop as `<T as IntoIterator>::Item`. We infer the correct type most of the time when we normalize the projection type, but it turns out not always. We should infer the type as `<<T as IntoIterator>::IntoIter as Iterator>::Item`.

When one specifies `IntoIter` assoc type of `IntoIterator` but not `Item` in generic bounds, we fail to normalize `<T as IntoIterator>::Item` (even though `IntoIter` is defined like so: `type IntoIter: Iterator<Item = Self::Item>` - rustc does *not* normalize projections based on other projection's bound I believe; see [this playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=e88e19385094cb98fadbf647b4c2082e)).

Note that this doesn't fully fix # 13299 - given the following code, chalk can normalize `<I as IntoIterator>::IntoIter` to `S`, but cannot normalize `<S as Iterator>::Item` to `i32`.

```rust
struct S;
impl Iterator for S { type Item = i32; /* ... */ }
fn f<I: IntoIterator<IntoIter = S>>(it: I) {
    for elem in it {}
      //^^^^{unknown}
}
```

This is because chalk finds multiple answers that satisfy the query `AliasEq(<S as Iterator>::Item = ?X`: `?X = i32` and `?X = <I as IntoIterator>::Item` - which are supposed to be the same type due to the aforementioned bound on `IntoIter` but chalk is unable to figure it out.

21 months agofix: infer for-loop item type with `IntoIterator` and `Iterator`
Ryo Yoshida [Thu, 29 Sep 2022 09:44:45 +0000 (18:44 +0900)]
fix: infer for-loop item type with `IntoIterator` and `Iterator`

21 months agoAuto merge of #13301 - Veykril:empty-assist-source-changes, r=Veykril
bors [Tue, 27 Sep 2022 15:54:54 +0000 (15:54 +0000)]
Auto merge of #13301 - Veykril:empty-assist-source-changes, r=Veykril

Make assist tests panic again on empty source changes

21 months agoMake assist tests panic again on empty source changes
Lukas Wirth [Tue, 27 Sep 2022 15:35:55 +0000 (17:35 +0200)]
Make assist tests panic again on empty source changes

21 months agoAuto merge of #13202 - Veykril:cancelled-retry, r=Veykril
bors [Tue, 27 Sep 2022 15:43:57 +0000 (15:43 +0000)]
Auto merge of #13202 - Veykril:cancelled-retry, r=Veykril

Don't retry requests that have already been cancelled

21 months agoDon't retry requests that have already been cancelled
Lukas Wirth [Wed, 7 Sep 2022 11:52:55 +0000 (13:52 +0200)]
Don't retry requests that have already been cancelled

21 months agoAuto merge of #13272 - oknozor:master, r=Veykril
bors [Tue, 27 Sep 2022 15:10:25 +0000 (15:10 +0000)]
Auto merge of #13272 - oknozor:master, r=Veykril

docs(guide): fix Analysis and AnalysisHost doc links

21 months agoAuto merge of #13280 - alanz:errorcode-requestfailed, r=Veykril
bors [Tue, 27 Sep 2022 15:03:15 +0000 (15:03 +0000)]
Auto merge of #13280 - alanz:errorcode-requestfailed, r=Veykril

Add RequestFailed error code, as per spec 3.17

See https://github.com/microsoft/language-server-protocol/issues/1341

21 months agoAuto merge of #13237 - Veykril:process-changes, r=Veykril
bors [Tue, 27 Sep 2022 14:41:40 +0000 (14:41 +0000)]
Auto merge of #13237 - Veykril:process-changes, r=Veykril

Amalgamate file changes for the same file ids in process_changes

When receiving multiple change events for a single file id where the last change is a delete the server panics, as it tries to access the file contents of a deleted file. This occurs due to the VFS changes and the in memory file contents being updated immediately, while `process_changes` processes the events afterwards in sequence which no longer works as it will only observe the final file contents. By folding these events together, we will no longer try to process these intermediate changes, as they aren't relevant anyways.

Potentially fixes https://github.com/rust-lang/rust-analyzer/issues/13236

21 months agoAmalgamate file changes for the same file ids in process_changes
Lukas Wirth [Thu, 15 Sep 2022 19:19:57 +0000 (21:19 +0200)]
Amalgamate file changes for the same file ids in process_changes

When receiving multiple change events for a single file id where the
last change is a delete the server panics, as it tries to access the
file contents of a deleted file. This occurs due to the VFS changes and
the in memory file contents being updated immediately, while
`process_changes` processes the events afterwards in sequence which no
longer works as it will only observe the final file contents. By
folding these events together, we will no longer try to process these
intermediate changes, as they aren't relevant anyways.

Potentially fixes https://github.com/rust-lang/rust-analyzer/issues/13236

21 months agoAuto merge of #13300 - Veykril:cfg-false, r=Veykril
bors [Tue, 27 Sep 2022 14:11:04 +0000 (14:11 +0000)]
Auto merge of #13300 - Veykril:cfg-false, r=Veykril

Use cfg(any()) instead of cfg(FALSE) for disabling proc-macro test

cc https://github.com/rust-lang/rust-analyzer/pull/13286

21 months agoAuto merge of #13296 - Strum355:package-information-package-name, r=Veykril
bors [Tue, 27 Sep 2022 13:07:05 +0000 (13:07 +0000)]
Auto merge of #13296 - Strum355:package-information-package-name, r=Veykril

Fix PackageInformation having the crate name instead of package name

The `PackageInformation` type from the LSIF PR used the _crate_ name instead of the _package_ name. This caused issues when looking up crates by this name on the Sourcegraph backend, where we sync crate contents, for crates such as actix-web and many of its components (actix-files, actix-http etc etc), see screenshot 1 for the observed symptom.

This PR hasnt been tested on other entry points besides cargo (such as project json).

See screenshot 2 for the change in behaviour via SCIP snapshot comparison.

<details>
<summary>Screenshot 1</summary>

![crates.io giving 404](https://user-images.githubusercontent.com/18282288/192286637-8bf7c333-4441-4e60-8cce-de7eaa11ee9f.png)

</details>

<details>
<summary>Screenshot 2</summary>

![before and after from SCIP snapshot output](https://user-images.githubusercontent.com/18282288/192287733-d7e73ff0-abbc-4ae5-82d0-bf9dc45d755c.png)

</details>

Follow-up PR to my question over at the [rust-lang Zulip](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/canonical.20crate.20name.20confusion.20for.20monikers), excuse any incorrect usages of the term package vs crate.

21 months agoAuto merge of #13189 - unexge:unconfigured-diagnostics-for-fields, r=Veykril
bors [Tue, 27 Sep 2022 12:59:45 +0000 (12:59 +0000)]
Auto merge of #13189 - unexge:unconfigured-diagnostics-for-fields, r=Veykril

Emit unconfigured code diagnostics for enum variants and struct/union fields

Fixes https://github.com/rust-lang/rust-analyzer/issues/12664

21 months agoUse cfg(any()) instead of cfg(FALSE) for disabling proc-macro test
Lukas Wirth [Tue, 27 Sep 2022 11:52:04 +0000 (13:52 +0200)]
Use cfg(any()) instead of cfg(FALSE) for disabling proc-macro test

21 months agoAuto merge of #13295 - rust-lang:sourcegen, r=Veykril
bors [Tue, 27 Sep 2022 01:21:07 +0000 (01:21 +0000)]
Auto merge of #13295 - rust-lang:sourcegen, r=Veykril

Remove obsolete in-rust-tree feature from sourcegen

21 months agoAuto merge of #13275 - Veykril:find-path, r=Veykril
bors [Tue, 27 Sep 2022 01:14:02 +0000 (01:14 +0000)]
Auto merge of #13275 - Veykril:find-path, r=Veykril

Fix find_path using the wrong module for visibility calculations

21 months agoGenerate `From` impls manually
unexge [Mon, 26 Sep 2022 18:29:28 +0000 (19:29 +0100)]
Generate `From` impls manually

21 months agoUse `Arc<[DefDiagnostic]>` instead of `Arc<Vec<DefDiagnostic>>`
unexge [Mon, 26 Sep 2022 18:16:02 +0000 (19:16 +0100)]
Use `Arc<[DefDiagnostic]>` instead of `Arc<Vec<DefDiagnostic>>`

21 months agoCollect diagnostics in queries instead of nameres
unexge [Wed, 21 Sep 2022 22:05:30 +0000 (23:05 +0100)]
Collect diagnostics in queries instead of nameres

21 months agoEmit unconfigured code diagnostics for fields
unexge [Sun, 4 Sep 2022 17:28:04 +0000 (18:28 +0100)]
Emit unconfigured code diagnostics for fields

21 months agoformatting
Noah Santschi-Cooney [Mon, 26 Sep 2022 17:35:06 +0000 (18:35 +0100)]
formatting

21 months agofix model tests
Noah Santschi-Cooney [Mon, 26 Sep 2022 17:09:46 +0000 (18:09 +0100)]
fix model tests

21 months agoFix PackageInformation having the crate name instead of package name
Noah Santschi-Cooney [Mon, 26 Sep 2022 13:09:54 +0000 (14:09 +0100)]
Fix PackageInformation having the crate name instead of package name

21 months agoAuto merge of #13248 - harudagondi:unwrap-tuple, r=Veykril
bors [Mon, 26 Sep 2022 09:35:59 +0000 (09:35 +0000)]
Auto merge of #13248 - harudagondi:unwrap-tuple, r=Veykril

Feature: Add assist to unwrap tuple declarations

> Implement #12923 for only tuples.
>
> Does not implement unwrapping for structs, as mentioned in the issue.

Add assist to unwrap tuples declarations to separate declarations.

```rust
fn main() {
$0let (foo, bar, baz) = (1.0, "example", String::new())
}
```

becomes:

```rust
fn main() {
let foo = 1.0;
let bar = "example";
let baz = String::new();
}
```

## Changelog

### Feature

- Added assist to unwrap tuple declarations.

21 months agoRemove obsolete in-rust-tree feature from sourcegen
Lukas Wirth [Mon, 26 Sep 2022 09:34:30 +0000 (11:34 +0200)]
Remove obsolete in-rust-tree feature from sourcegen

21 months agoAuto merge of #13209 - lowr:feat/inference-for-generator, r=Veykril
bors [Mon, 26 Sep 2022 09:28:41 +0000 (09:28 +0000)]
Auto merge of #13209 - lowr:feat/inference-for-generator, r=Veykril

feat: type inference for generators

This PR implements basic type inference for generator and yield expressions.

Things not included in this PR:
- Generator upvars and generator witnesses are not implemented. They are only used to determine auto trait impls, so basic type inference should be fine without them, but method resolutions with auto trait bounds may not be resolved correctly.

Open questions:
- I haven't (yet) implemented `HirDisplay` for `TyKind::Generator`, so generator types are just shown as "{{generator}}" (in tests, inlay hints, hovers, etc.), which is not really nice. How should we show them?
- I added moderate amount of stuffs to minicore. I especially didn't want to add `impl<T> Deref for &T` and `impl<T> Deref for &mut T` exclusively for tests for generators; should I move them into the test fixtures or can they be placed in minicore?

cc #4309

21 months agoAuto merge of #13289 - rust-lang:analysis-stats-proc-server, r=Veykril
bors [Sat, 24 Sep 2022 20:04:48 +0000 (20:04 +0000)]
Auto merge of #13289 - rust-lang:analysis-stats-proc-server, r=Veykril

Use the sysroot proc-macro server for analysis-stats

Should fix the metrics issues

21 months agoUse the sysroot proc-macro server for analysis-stats
Lukas Wirth [Sat, 24 Sep 2022 20:04:17 +0000 (22:04 +0200)]
Use the sysroot proc-macro server for analysis-stats

21 months agoAuto merge of #13288 - Veykril:variant-body, r=Veykril
bors [Sat, 24 Sep 2022 01:09:15 +0000 (01:09 +0000)]
Auto merge of #13288 - Veykril:variant-body, r=Veykril

Fix diagnostics not working in enum variant bodies

cc https://github.com/rust-lang/rust-analyzer/pull/12966

21 months agoFix diagnostics not working in enum variant bodies
Lukas Wirth [Sat, 24 Sep 2022 01:07:05 +0000 (03:07 +0200)]
Fix diagnostics not working in enum variant bodies

21 months agoAuto merge of #13285 - Veykril:variant-body, r=Veykril
bors [Sat, 24 Sep 2022 00:39:34 +0000 (00:39 +0000)]
Auto merge of #13285 - Veykril:variant-body, r=Veykril

Properly support IDE functionality in enum variants

21 months agoProperly support IDE functionality in enum variants
Lukas Wirth [Fri, 23 Sep 2022 20:48:38 +0000 (22:48 +0200)]
Properly support IDE functionality in enum variants

21 months agoAuto merge of #13286 - Veykril:proc-macro-srv-tests, r=Veykril
bors [Fri, 23 Sep 2022 22:19:35 +0000 (22:19 +0000)]
Auto merge of #13286 - Veykril:proc-macro-srv-tests, r=Veykril

Don't run proc-macro-srv tests on the rust-analyzer repo

proc-macro ABI breakage still affects the tests when a new stable version releases. Ideally we'd still be able to run the tests on the rust-analyzer repo without having to update the proc-macro ABI, but for now just to unblock CI we will ignore them here, as they are still run in upstream.

21 months agoDon't run proc-macro-srv tests on the rust-analyzer repo
Lukas Wirth [Fri, 23 Sep 2022 21:30:23 +0000 (23:30 +0200)]
Don't run proc-macro-srv tests on the rust-analyzer repo

proc-macro ABI breakage still affects the tests when a new stable version
releases. Ideally we'd still be able to run the tests on the rust-analyzer
repo without having to update the proc-macro ABI, but for now just to
unblock CI we will ignore them here, as they are still run in upstream.

21 months agoAdd RequestFailed error code, as per spec 3.17
Alan Zimmerman [Fri, 23 Sep 2022 08:45:24 +0000 (09:45 +0100)]
Add RequestFailed error code, as per spec 3.17

See https://github.com/microsoft/language-server-protocol/issues/1341

21 months agoFix find_path using the wrong module for visibility calculations
Lukas Wirth [Thu, 22 Sep 2022 15:56:58 +0000 (17:56 +0200)]
Fix find_path using the wrong module for visibility calculations

21 months agodocs(guide): fix Analysis and AnalysisHost doc links
Paul Delafosse [Thu, 22 Sep 2022 03:08:54 +0000 (05:08 +0200)]
docs(guide): fix Analysis and AnalysisHost doc links

21 months agoImplement `HirDisplay` for `TyKind::Generator`
Ryo Yoshida [Wed, 21 Sep 2022 13:04:55 +0000 (22:04 +0900)]
Implement `HirDisplay` for `TyKind::Generator`

21 months agoreturn None instead of assert
harudagondi [Wed, 21 Sep 2022 01:11:02 +0000 (09:11 +0800)]
return None instead of assert

21 months agoAuto merge of #13269 - Veykril:repr, r=Veykril
bors [Tue, 20 Sep 2022 15:50:31 +0000 (15:50 +0000)]
Auto merge of #13269 - Veykril:repr, r=Veykril

Properly set the enum variant body type from the repr attribute

Follow up for https://github.com/rust-lang/rust-analyzer/pull/12966, fixes some type inference problems

21 months agoFix default enum representation not being isize
Lukas Wirth [Tue, 20 Sep 2022 15:43:29 +0000 (17:43 +0200)]
Fix default enum representation not being isize

21 months agoFix using incorrect type for variants in DefWithBody::body_type
Lukas Wirth [Tue, 20 Sep 2022 15:29:35 +0000 (17:29 +0200)]
Fix using incorrect type for variants in DefWithBody::body_type

21 months agoProperly set the enum variant body expected type
Lukas Wirth [Tue, 20 Sep 2022 15:15:48 +0000 (17:15 +0200)]
Properly set the enum variant body expected type

21 months agoParse more repr options
Lukas Wirth [Tue, 20 Sep 2022 15:12:27 +0000 (17:12 +0200)]
Parse more repr options

21 months agoSimplify
Lukas Wirth [Tue, 20 Sep 2022 15:12:10 +0000 (17:12 +0200)]
Simplify

21 months agoAuto merge of #12966 - OleStrohm:master, r=Veykril
bors [Tue, 20 Sep 2022 14:01:16 +0000 (14:01 +0000)]
Auto merge of #12966 - OleStrohm:master, r=Veykril

feat: Display the value of enum variant on hover

fixes #12955

This PR adds const eval support for enums, as well as showing their value on hover, just as consts currently have.

I developed these two things at the same time, but I've realized now that they are separate. However since the hover is just a 10 line change (not including tests), I figured I may as well put them in the same PR. Though if you want them split up into "enum const eval support"  and "show enum variant value on hover", I think that's reasonable too.

Since this adds const eval support for enums this also allows consts that reference enums to have their values computed now too.

The const evaluation itself is quite rudimentary, it doesn't keep track of the actual type of the enum, but it turns out that Rust doesn't actually either, and `E::A as u8` is valid regardless of the `repr` on `E`.

It also doesn't really care about what expression the enum variant contains, it could for example be a string, despite that not being allowed, but I guess it's up to the `cargo check` diagnostics to inform of such issues anyway?

21 months agoAuto merge of #13268 - Veykril:simplify, r=Veykril
bors [Tue, 20 Sep 2022 12:35:18 +0000 (12:35 +0000)]
Auto merge of #13268 - Veykril:simplify, r=Veykril

Simplify

21 months agoFix operator highlighting tags applying too broadly
Lukas Wirth [Tue, 20 Sep 2022 12:33:44 +0000 (14:33 +0200)]
Fix operator highlighting tags applying too broadly

21 months agoSimplify
Lukas Wirth [Tue, 20 Sep 2022 12:33:18 +0000 (14:33 +0200)]
Simplify

21 months agoAuto merge of #13264 - lowr:patch/no-dyn-without-trait, r=Veykril
bors [Mon, 19 Sep 2022 20:36:02 +0000 (20:36 +0000)]
Auto merge of #13264 - lowr:patch/no-dyn-without-trait, r=Veykril

Ensure at least one trait bound in `TyKind::DynTy`

One would expect `TyKind::DynTy` to have at least one trait bound, but we may produce a dyn type with no trait bounds at all. This patch prevents it by returning `TyKind::Error` in such cases.

An "empty" dyn type would have caused panic during method resolution without #13257. Although already fixed, I think an invariant to never produce such types would help prevent similar problems in the future.

21 months agoEnsure at least one trait bound in `TyKind::DynTy`
Ryo Yoshida [Mon, 19 Sep 2022 19:20:43 +0000 (04:20 +0900)]
Ensure at least one trait bound in `TyKind::DynTy`

21 months agoAdded FIXME for the repr type of the enum
OleStrohm [Mon, 19 Sep 2022 18:26:09 +0000 (19:26 +0100)]
Added FIXME for the repr type of the enum