Commit graph

23336 commits

Author SHA1 Message Date
bors
5c28ad1932 Auto merge of #13328 - Veykril:rustc-proc-macro, r=Veykril
Add proc-macro dependency to rustc crates
2022-10-01 19:29:33 +00:00
Lukas Wirth
870825b376 Add proc-macro dependency to rustc crates 2022-10-01 21:29:14 +02:00
bors
cdc5493901 Auto merge of #13327 - Veykril:proc-macro-srv-config, r=Veykril
Add config for supplying sysroot path
2022-10-01 19:17:36 +00:00
Lukas Wirth
5424c51158 Add config for supplying sysroot path 2022-10-01 21:17:06 +02:00
bors
bf5cad8e77 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
2022-10-01 17:51:47 +00:00
Lukas Wirth
26cf250ccc Do not use the sysroot proc-macro server when a server path is given explicitly 2022-10-01 19:50:34 +02:00
bors
f88293f777 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
2022-10-01 13:35:08 +00:00
Lukas Wirth
bfd5f00bfc Fix trait impl item completions using macro file text ranges 2022-10-01 15:34:45 +02:00
bors
5b7e40014e 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
2022-09-30 22:42:40 +00:00
Lukas Wirth
3ad0334718 Fix move_format_string_arg being tokentree unaware 2022-10-01 00:42:16 +02:00
bors
2293949bbf 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
2022-09-30 22:31:05 +00:00
bors
17363b341e Auto merge of #13320 - Veykril:ty-alias-hover, r=Veykril
Fix type alias hovers not rendering generic parameters
2022-09-30 22:22:24 +00:00
Lukas Wirth
77cfc9b392 Fix type alias hovers not rendering generic parameters 2022-10-01 00:21:29 +02:00
Lukas Wirth
3cd57c425a Fix annotations not resolving when lens location is set to whole item 2022-10-01 00:18:23 +02:00
bors
8132b42b73 Auto merge of #13319 - Veykril:req-retry, r=Veykril
Fix requests not being retried anymore
2022-09-30 22:12:48 +00:00
Lukas Wirth
8c433c7296 Fix requests not being retried anymore 2022-10-01 00:07:33 +02:00
bors
97f8f4a3da 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.
2022-09-29 11:04:47 +00:00
Ryo Yoshida
6d8903ae5f
fix: infer for-loop item type with IntoIterator and Iterator 2022-09-29 19:48:08 +09:00
Jonas Platte
a3d79b5172
Update outside test and generated code 2022-09-27 20:40:51 +02:00
Jonas Platte
2c666a08b0
Add convert_named_struct_to_tuple_struct assist 2022-09-27 20:39:48 +02:00
Lukas Wirth
f310d4cbb4 Don't auto-publish lib crates 2022-09-27 18:22:06 +02:00
bors
ad752bd521 Auto merge of #13301 - Veykril:empty-assist-source-changes, r=Veykril
Make assist tests panic again on empty source changes
2022-09-27 15:54:54 +00:00
Lukas Wirth
f5fe6b157f Make assist tests panic again on empty source changes 2022-09-27 17:48:00 +02:00
bors
9ba55bad4f Auto merge of #13202 - Veykril:cancelled-retry, r=Veykril
Don't retry requests that have already been cancelled
2022-09-27 15:43:57 +00:00
Lukas Wirth
1a6c1595fe Don't retry requests that have already been cancelled 2022-09-27 17:39:15 +02:00
bors
b16b0413dc Auto merge of #13272 - oknozor:master, r=Veykril
docs(guide): fix Analysis and AnalysisHost doc links
2022-09-27 15:10:25 +00:00
bors
03aa7042e6 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
2022-09-27 15:03:15 +00:00
bors
093de32f80 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
2022-09-27 14:41:40 +00:00
Lukas Wirth
c3a6c963e5 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
2022-09-27 16:41:04 +02:00
bors
bd8c5b6b42 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
2022-09-27 14:11:04 +00:00
bors
8805d05d01 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.
2022-09-27 13:07:05 +00:00
bors
b01cdd89d5 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
2022-09-27 12:59:45 +00:00
Lukas Wirth
fb736449fd Use cfg(any()) instead of cfg(FALSE) for disabling proc-macro test 2022-09-27 13:52:04 +02:00
bors
f972cdd5fc Auto merge of #13295 - rust-lang:sourcegen, r=Veykril
Remove obsolete in-rust-tree feature from sourcegen
2022-09-27 01:21:07 +00:00
bors
8c7e37697f Auto merge of #13275 - Veykril:find-path, r=Veykril
Fix find_path using the wrong module for visibility calculations
2022-09-27 01:14:02 +00:00
unexge
7e5e5177b6 Generate From impls manually 2022-09-26 19:29:28 +01:00
unexge
3a8d84b4a3 Use Arc<[DefDiagnostic]> instead of Arc<Vec<DefDiagnostic>> 2022-09-26 19:16:02 +01:00
unexge
b21bf25a07 Collect diagnostics in queries instead of nameres 2022-09-26 19:06:29 +01:00
unexge
89107d5469 Emit unconfigured code diagnostics for fields 2022-09-26 19:04:57 +01:00
Noah Santschi-Cooney
651c586035
formatting 2022-09-26 18:35:06 +01:00
Noah Santschi-Cooney
60b432b7e9
fix model tests 2022-09-26 18:18:12 +01:00
Noah Santschi-Cooney
aa093f5a58
Fix PackageInformation having the crate name instead of package name 2022-09-26 17:31:38 +01:00
bors
1a24003eb6 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.
2022-09-26 09:35:59 +00:00
Lukas Wirth
7929e9c56b Remove obsolete in-rust-tree feature from sourcegen 2022-09-26 11:34:30 +02:00
bors
1f929659ac 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
2022-09-26 09:28:41 +00:00
bors
73ab709b38 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
2022-09-24 20:04:48 +00:00
Lukas Wirth
73f6af54c1 Use the sysroot proc-macro server for analysis-stats 2022-09-24 22:04:17 +02:00
bors
fa38c10e7f 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
2022-09-24 01:09:15 +00:00
Lukas Wirth
0231d19f3f Fix diagnostics not working in enum variant bodies 2022-09-24 03:07:05 +02:00
bors
4e7bb5e042 Auto merge of #13285 - Veykril:variant-body, r=Veykril
Properly support IDE functionality in enum variants
2022-09-24 00:39:34 +00:00